From d956bb6668553694eb610ef89313e4a4b6bb0f72 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Wed, 30 Dec 2015 10:20:14 -0800 Subject: Added scripts and Debian configuration files for Ubuntu PPA --- tools/debs/convert_changelog.py | 108 ++++++++++++++++++++++++++++++++++ tools/debs/upload_debs.sh | 127 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100755 tools/debs/convert_changelog.py create mode 100755 tools/debs/upload_debs.sh (limited to 'tools/debs') diff --git a/tools/debs/convert_changelog.py b/tools/debs/convert_changelog.py new file mode 100755 index 000000000..5d12a958c --- /dev/null +++ b/tools/debs/convert_changelog.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2015 National Instruments Corp. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +""" +Converts our changelog into a format suitable for Debian packaging +""" + +import datetime +from optparse import OptionParser +import os +import re +import sys + +# Pass in first line of Debian changelog file, should contain last version +def detect_last_version(line): + return convert_version_string(re.search("[0-9]+\.[0-9]+\.[0-9]", line).group(), False) + +# "## 003.008.005" to "3.8.5" or vice versa +def convert_version_string(version, to_debian=True): + if version == None: + return "" + + if to_debian: + return ".".join(list(str(int(num)) for num in re.split('[ .]', version)[1:])) + else: + return "## {0}".format(".".join("{0:03d}".format(int(num)) for num in version.split("."))) + +# +# The "trusty" string below doesn't need to be changed, even when Trusty loses support. The script +# to upload packages replaces it anyway. +# +def get_header(version): + return "uhd ({0}-0ubuntu1) trusty; urgency=low\n\n".format(convert_version_string(version)) + +def get_footer(uploader_name, uploader_email): + return " -- {0} <{1}> {2}\n\n".format(uploader_name, uploader_email, datetime.datetime.now().strftime("%a, %d %b %Y %I:%M:%S %Z-0800")) + +if __name__ == "__main__": + + parser = OptionParser() + parser.add_option("--input-file", type="string", help="Input UHD top-level changelog file") + parser.add_option("--output-file", type="string", help="Output Debian changelog file (will append onto existing)") + parser.add_option("--uploader-name", type="string", help="Uploader name (must match GPG key)") + parser.add_option("--uploader-email", type="string", help="Uploader email (must match GPG key)") + parser.add_option("--last-version", type="string", help="Manually specify last version (Debian format)", default="") + (options, args) = parser.parse_args() + + # Input file + f = open(options.input_file, "r") + lines_in = f.readlines() + f.close() + + # Output file + if os.path.exists(os.path.normpath(options.output_file)): + g = open(options.output_file, "r") + lines_out = g.readlines() + g.close() + else: + lines_out = [] + + g = open(options.output_file, "w") + + if options.last_version == "": + if(len(lines_out) > 0): + last_version = detect_last_version(lines_out[0]) + check_last_version = True + else: + last_version = "" + check_last_version = False # Will do every version + else: + last_version = convert_version_string(options.last_version, False) + check_last_version = True + + new_lines_out = [] + for line in lines_in[3:]: + if line.rstrip() == last_version and last_version != "": + # We've fully updated, stop here + break + elif re.search("^## [0-9]{3}\.[0-9]{3}\.[0-9]{3}", line): + # New version + new_lines_out += [get_header(line.rstrip())] + elif line == "\n": + # End of version + new_lines_out += ["\n"] + new_lines_out += [get_footer(options.uploader_name, options.uploader_email)] + else: + # Actual changes + new_lines_out += [" " + line] + + new_lines_out += lines_out + for line in new_lines_out: + g.write(line) + g.close() diff --git a/tools/debs/upload_debs.sh b/tools/debs/upload_debs.sh new file mode 100755 index 000000000..4ff03cced --- /dev/null +++ b/tools/debs/upload_debs.sh @@ -0,0 +1,127 @@ +#!/bin/bash +# +# Copyright 2015 National Instruments Corp. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +if ! ls | grep host > /dev/null +then + echo "This script must be run from UHD's top-level directory." + exit 1 +fi + +FORCE_YES=0 +if [ $# -eq 1 ] +then + if [ "$1" = "-y" ] + then + FORCE_YES=1 + fi +fi + +UHD_TOP_LEVEL=$PWD + +# Get version info +VERSION=`head -1 host/cmake/debian/changelog | grep -o '[0-9.]*' | head -1` +ORIG_RELEASE=`head -1 host/cmake/debian/changelog | sed 's/.*) \(.*\);.*/\1/'` + +# +# Currently supported versions can be found here: +# https://launchpad.net/ubuntu/+ppas +# +RELEASES="precise trusty vivid wily xenial" +PPA=ppa:ettusresearch/uhd + +# +# Make sure this is the intended version. +# +# This is based on the contents of debian/changelog. If convert_changelog.py was not +# run on this version, it will show the previous release. +# +echo "Will generate installer configuration files for UHD "$VERSION +if [ $FORCE_YES -ne 1 ] +then + echo "Is this correct? (yes/no)" + read response + if [ "$response" != "yes" ] + then + exit 0 + fi +fi + +# Generate the TAR file to be uploaded. +echo "Creating UHD source archive." +tar --exclude='*git*' --exclude='./debian' --exclude='*.swp' -cJf ../uhd_${VERSION}.orig.tar.xz . +if [ $? != 0 ] +then + echo "Failed to create UHD source archive." + exit 1 +fi + +# debuild expects our directory name to be ${source package}-${version} +cd .. +ln -fs ${UHD_TOP_LEVEL} uhd-${VERSION} +cd uhd-${VERSION} + +# +# Generate package info for each version. +# +# This script substitutes each version string into the debian/changelog file to +# create package info for each version. We need to store the original outside the +# UHD repo, or dpkg-source will detect the change and error out. +# +cp -r host/cmake/debian . +cp host/utils/uhd-usrp.rules debian/uhd-host.udev +find host/docs -name '*.1' > debian/uhd-host.manpages +rm -f debian/postinst.in debian/postrm.in debian/preinst.in debian/prerm.in +exit 0 + +for RELEASE in ${RELEASES} +do + cp debian/changelog ../changelog.backup + sed -i "s/${ORIG_RELEASE}/${RELEASE}/;s/0ubuntu1/0ubuntu1~${RELEASE}1/" debian/changelog + debuild -S -i -sa + if [ $? != 0 ] + then + echo "Failed to generate package info for" ${RELEASE} + mv changelog.backup debian/changelog + exit 1 + fi + mv ../changelog.backup debian/changelog +done + +# Upload package into to Launchpad, which will automatically build packages +for RELEASE in ${RELEASES} +do + continue + dput ${PPA} ../uhd_${VERSION}-0ubuntu1~${RELEASE}1_source.changes + if [ $? != 0 ] + then + echo "Failed to upload" ${VERSION} "package info to Launchpad." + exit 1 + fi +done + +if [ $FORCE_YES -ne 1 ] +then + echo + echo "Clean up build artifacts? (yes/no)" + read response + if [ "$response" = "yes" ] + then + cd .. + rm -r ${UHD_TOP_LEVEL}/debian uhd-${VERSION} uhd_${VERSION}.orig.tar.xz uhd*dsc uhd*changes uhd*debian.tar.gz uhd*_source.build uhd*.upload + fi +fi -- cgit v1.2.3 From f18abe54083fd0c89c372b1fad2ecd9abb6bf9db Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 30 Dec 2015 11:49:52 -0800 Subject: Final updates for 3.9.2 release - Updated images package - Updated Debian changelog - Updated ppa script --- host/CMakeLists.txt | 4 ++-- host/cmake/debian/changelog | 16 ++++++++++++++++ tools/debs/upload_debs.sh | 27 +++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 4 deletions(-) (limited to 'tools/debs') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index d678b520d..8953e839d 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -269,8 +269,8 @@ UHD_INSTALL(FILES #{{{IMG_SECTION # This section is written automatically by /images/create_imgs_package.py # Any manual changes in here will be overwritten. -SET(UHD_IMAGES_MD5SUM "a7dcdcbc2dc032dbd1532636f9adb87a") -SET(UHD_IMAGES_DOWNLOAD_SRC "uhd-images_003.009.002-rc1.zip") +SET(UHD_IMAGES_MD5SUM "37081e1e73004bd9e74d7e5b6293fd39") +SET(UHD_IMAGES_DOWNLOAD_SRC "uhd-images_003.009.002-release.zip") #}}} ######################################################################## diff --git a/host/cmake/debian/changelog b/host/cmake/debian/changelog index 1ed6ab28d..40f04bf74 100644 --- a/host/cmake/debian/changelog +++ b/host/cmake/debian/changelog @@ -1,3 +1,19 @@ +uhd (3.9.2-0ubuntu1) trusty; urgency=low + + * E310: Added support for Speedgrade 3 + * B205mini: Added support + * E310: Fixed reference counting bug + * B210: Fixed external clock reference bug for devices using ADF4002 PLLs + * B210: Fixed codec loopback test + * OctoClock: Fixed firmware burning on Windows + * B2XX, E3XX, X3XX: Easier time-syncing features. Fixes bug where B210s would + only run after issuing set_time_unknown_pps(). + * X3XX: Fixed bug for IQ imbalance correction + * E310: DRAM testbenching + * Docs/Manual: Many updates and fixes + + -- Martin Braun Wed, 30 Dec 2015 11:48:37 -0800 + uhd (3.9.1-0ubuntu1) trusty; urgency=low * B200mini: Updated udev rules, removed DCM diff --git a/tools/debs/upload_debs.sh b/tools/debs/upload_debs.sh index 4ff03cced..9ecdbbbfb 100755 --- a/tools/debs/upload_debs.sh +++ b/tools/debs/upload_debs.sh @@ -21,6 +21,10 @@ then echo "This script must be run from UHD's top-level directory." exit 1 fi +if [ -f fpga-src/README.md ]; then + echo "This script requires a clean repository without fpga-src checked out!." + exit 1 +fi FORCE_YES=0 if [ $# -eq 1 ] @@ -63,7 +67,7 @@ fi # Generate the TAR file to be uploaded. echo "Creating UHD source archive." -tar --exclude='*git*' --exclude='./debian' --exclude='*.swp' -cJf ../uhd_${VERSION}.orig.tar.xz . +tar --exclude='*git*' --exclude='./debian' --exclude='*.swp' --exclude='fpga-src' --exclude='build' --exclude='images' --exclude='tags' -cJf ../uhd_${VERSION}.orig.tar.xz . if [ $? != 0 ] then echo "Failed to create UHD source archive." @@ -86,7 +90,16 @@ cp -r host/cmake/debian . cp host/utils/uhd-usrp.rules debian/uhd-host.udev find host/docs -name '*.1' > debian/uhd-host.manpages rm -f debian/postinst.in debian/postrm.in debian/preinst.in debian/prerm.in -exit 0 + +if [ $FORCE_YES -ne 1 ] +then + echo "Proceed to generate package info? (yes/no)" + read response + if [ "$response" != "yes" ] + then + exit 0 + fi +fi for RELEASE in ${RELEASES} do @@ -102,6 +115,16 @@ do mv ../changelog.backup debian/changelog done +if [ $FORCE_YES -ne 1 ] +then + echo "Proceed to upload to launchpad? (yes/no)" + read response + if [ "$response" != "yes" ] + then + exit 0 + fi +fi + # Upload package into to Launchpad, which will automatically build packages for RELEASE in ${RELEASES} do -- cgit v1.2.3 From 605b360651e85ca5923d0e9e8ea20343f7202301 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Wed, 30 Dec 2015 12:36:24 -0800 Subject: tools: made upload_debs.sh smarter about ignores --- tools/debs/upload_debs.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'tools/debs') diff --git a/tools/debs/upload_debs.sh b/tools/debs/upload_debs.sh index 9ecdbbbfb..c14096997 100755 --- a/tools/debs/upload_debs.sh +++ b/tools/debs/upload_debs.sh @@ -67,7 +67,7 @@ fi # Generate the TAR file to be uploaded. echo "Creating UHD source archive." -tar --exclude='*git*' --exclude='./debian' --exclude='*.swp' --exclude='fpga-src' --exclude='build' --exclude='images' --exclude='tags' -cJf ../uhd_${VERSION}.orig.tar.xz . +tar --exclude='*git*' --exclude='./debian' --exclude='*.swp' --exclude='fpga-src' --exclude='build' --exclude='./images/*.pyc' --exclude='./images/uhd-*' --exclude='tags' -cJf ../uhd_${VERSION}.orig.tar.xz . if [ $? != 0 ] then echo "Failed to create UHD source archive." @@ -75,9 +75,9 @@ then fi # debuild expects our directory name to be ${source package}-${version} -cd .. -ln -fs ${UHD_TOP_LEVEL} uhd-${VERSION} -cd uhd-${VERSION} +rm -f ${UHD_TOP_LEVEL}/../uhd-${VERSION} +ln -s ${UHD_TOP_LEVEL} ${UHD_TOP_LEVEL}/../uhd-${VERSION} +cd ${UHD_TOP_LEVEL}/../uhd-${VERSION} # # Generate package info for each version. @@ -109,7 +109,7 @@ do if [ $? != 0 ] then echo "Failed to generate package info for" ${RELEASE} - mv changelog.backup debian/changelog + mv ../changelog.backup debian/changelog exit 1 fi mv ../changelog.backup debian/changelog @@ -128,7 +128,6 @@ fi # Upload package into to Launchpad, which will automatically build packages for RELEASE in ${RELEASES} do - continue dput ${PPA} ../uhd_${VERSION}-0ubuntu1~${RELEASE}1_source.changes if [ $? != 0 ] then @@ -145,6 +144,6 @@ then if [ "$response" = "yes" ] then cd .. - rm -r ${UHD_TOP_LEVEL}/debian uhd-${VERSION} uhd_${VERSION}.orig.tar.xz uhd*dsc uhd*changes uhd*debian.tar.gz uhd*_source.build uhd*.upload + rm -r ${UHD_TOP_LEVEL}/debian uhd-${VERSION} uhd_${VERSION}.orig.tar.xz uhd*dsc uhd*changes uhd*debian.tar.xz uhd*_source.build uhd*.upload fi fi -- cgit v1.2.3