[SCM] musescore/master: set revision automatically when importing new upstream versions via uscan

shoogle-guest at users.alioth.debian.org shoogle-guest at users.alioth.debian.org
Tue May 24 12:49:23 UTC 2016


The following commit has been merged in the master branch:
commit 3a8691d8ea8f00066e8a63a691fa66f5c102dbfa
Author: Peter Jonas <pjonas56 at gmail.com>
Date:   Mon May 23 17:24:21 2016 +0100

    set revision automatically when importing new upstream versions via uscan
    
    Closes: #818795

diff --git a/debian/README.Debian b/debian/README.Debian
index b0f4a92..e3053e0 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -1,9 +1,31 @@
 musescore for Debian
 ********************
 
-  usr/share/mscore is versioned (ie usr/share/mscore-0.7), as upstream 
-  said he wants to make it possible for other users, not necessarily 
-  ours, to install more than one version concurrently for testing. Some 
+  usr/share/mscore is versioned (ie usr/share/mscore-0.7), as upstream
+  said he wants to make it possible for other users, not necessarily
+  ours, to install more than one version concurrently for testing. Some
   files there are version specific, so he versions /usr/share/mscore.
 
  -- Toby Smithe <tsmithe at ubuntu.com>
+
+  IMPORTING NEW UPSTREAM RELEASES:
+  Upstream tracks bugs against the Git short commit number (first 7 digits of
+  upstream commit SHA). This is the "revision" displayed in MuseScore's Help ->
+  About dialog. This number is stored in the file mscore/revision.h and must be
+  set *after* importing a new upstream version. This is done automatically if
+  the new version is imported via `uscan` or `debian/rules get-orig-source`. The
+  recommended method for importing a new upstream release is as follows:
+
+    uscan --verbose
+    gbp import-orig --merge-mode=replace ../musescore_$(VER)+dfsg.orig.tar.gz
+
+    * uscan fetches the upstream tarball, unpacks it, makes changes necessary
+      for DFSG compliance, and repacks into a dfsg tarball (see debian/repack).
+    * gbp (git-buildpackage) unpacks the dfsg tarball and commits the changes.
+      gbp version 0.7.2 or later required. (Note: gbp import-orig --uscan wont
+      work because it uses the upstream tarball instead of the dfsg tarball.)
+    * If you don't have gbp just run uscan, then delete everything in the repo
+      (except the "debian" and ".git" directories) and then unpack the dfsg
+      tarball into the repo. Update patches and changelog. Commit the changes.
+
+ -- Peter Jonas <pjonas56 at gmail.com>
diff --git a/debian/gbp.conf b/debian/gbp.conf
index 370eb92..be885f5 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -18,7 +18,7 @@ sign-tags = True
 postbuild = lintian $GBP_CHANGES_FILE
 
 # Options only affecting git-import-orig
-[git-import-orig]
+[import-orig]
 # run hook after the import:
 postimport = git-dch -N%(version)s -S -a --debian-branch=$GBP_BRANCH
 # commit message:
diff --git a/debian/repack b/debian/repack
new file mode 100755
index 0000000..d0a344f
--- /dev/null
+++ b/debian/repack
@@ -0,0 +1,111 @@
+#!/bin/bash
+# debian/repack - Produce DFSG compliant orig.tar.gz from upstream tarball.
+#  1) Unpack upstream tarball.
+#  2) Set revision number in mscore/revision.h to match Git commit number.
+#  3) Ensure DSFG compliance (removes precompiled binaries and PDFs).
+#  4) Pack into orig.tar.gz
+
+set -e # exit on error
+
+function usage() {
+cat <<EOF
+debian/repack - Produce DFSG compliant orig.tar.gz from upstream tarball.
+
+Usage:    debian/repack  --upstream-version  VERSION  UPSTREAM-TARBALL
+Example:  debian/repack  --upstream-version  "2.0.1"  "../v2.0.1.tar.gz"
+EOF
+}
+
+[[ "$1" == "--usage" || "$1" == "--help" || "$1" == -[h?] ]] && usage && exit
+
+if [ "$1" != "--upstream-version" ] || [ ! "$2" ]; then
+  printf "$0: Error! Upstream version was not specified.\n\n$(usage)\n" >&2
+  exit 1
+fi
+
+if [ ! -f "$3" ]; then
+  printf "$0: Error! Upstream tarball was not specified.\n\n$(usage)\n" >&2
+  exit 1
+fi
+
+version="$2"
+tarball="$(basename "$3")"
+outdir="$(dirname "$3")" # output files to same dir as input files were located
+
+if [ "$(which realpath)" ]; then
+  outdir="$(realpath --relative-to="$PWD" "$outdir")"
+fi
+
+cd "$outdir"
+
+symlink=""
+if [ -L "$tarball" ]; then
+  # If $tarball was actually a symlink then resolve it
+  symlink="$tarball"
+  tarball="$(readlink "$symlink")"
+fi
+
+tempdir="tmp-musescore-$version"
+
+# 1) Unpack upstream tarball
+echo "Unpacking upstream tarball into '$tempdir'." >&2
+mkdir "$tempdir"
+tar -zxf "$tarball" -C "$tempdir"
+cd "$tempdir/MuseScore-$version"
+
+# 2) Set revision number in mscore/revision.h to match upstream Git commit
+# Note: upstream has a Makefile target "make revision" to set the revision, but
+# it only works inside a Git repo so we have to get the revision another way.
+echo "Determining upstream revision (first 7 characters of Git commit SHA)." >&2
+
+commit="$( \
+  wget -qO - https://api.github.com/repos/musescore/MuseScore/tags \
+   | tr -d '[:space:]' | sed -r 's/("name":)/\n\1/g' \
+   | grep -F "\"name\":\"v$version\"" \
+   | sed -nr 's/.*"sha":"([[:alnum:]]{7})[[:alnum:]]{33}".*/\1\n/p' \
+)"
+
+if [ ! "$commit" ]; then
+ echo "$0: Error! Couldn't get upstream commit." >&2
+ exit 1
+fi
+
+echo "Upstream revision is '$commit'." >&2
+
+echo "Setting revision number in 'mscore/revision.h' to '$commit'." >&2
+echo "$commit" > "mscore/revision.h"
+
+# 3) Ensure DSFG compliance (remove precompiled binaries and PDFs, etc).
+echo "Making changes to ensure DFSG compliance." >&2
+
+echo "Removing PDF files." >&2
+echo "Files-Excluded:"
+find . -iname "*.pdf" -exec rm "{}" \; -exec echo "                {}" \;
+echo  "Comment: PDFs removed for DFSG compliance (not a transparent format)."
+
+echo "Removing precompiled binaries." >&2
+echo "Files-Excluded:"
+find -type f -executable \
+  -exec sh -c "file -i '{}' | grep -q 'x-executable; charset=binary'" \; \
+  -exec rm "{}" \; -exec echo "                {}" \;
+echo "Comment: Binaries removed for DFSG compliance (not a transparent format)."
+
+# 4) Pack into orig.tar.gz
+cd .. # now inside $tempdir
+mv "MuseScore-$version" "musescore-$version+dfsg"
+tar -cf "../musescore_$version+dfsg.orig.tar" "musescore-$version+dfsg"
+cd .. # now back to output directory (outside $tempdir)
+gzip -9 "musescore_$version+dfsg.orig.tar"
+
+# Tidy up
+echo "Removing temporary files." >&2
+rm -rf "$tempdir" "$tarball" "$symlink"
+
+cat >&2 <<EOF
+Finished!
+The upstream code is in "$outdir/musescore_$version+dfsg.orig.tar.gz".
+Use 'uupdate' to upgrade the source package based on the upstream release:
+ \$ uupdate --upstream-version $version $outdir/musescore_$version+dfsg.orig.tar.gz
+Or, if working in a Git repository, use git-buildpackage to update the source:
+ \$ gbp import-orig --merge-mode=replace  $outdir/musescore_$version+dfsg.orig.tar.gz
+EOF
diff --git a/debian/rules b/debian/rules
index 578ad5e..4476fee 100755
--- a/debian/rules
+++ b/debian/rules
@@ -29,18 +29,11 @@ override_dh_install:
 	cd $(CURDIR)/debian/musescore-common/usr/share && ln -s mscore-* mscore
 	chrpath -d $(CURDIR)/debian/musescore/usr/bin/mscore
 
-get-orig-source: version = $(shell uscan --force-download --dehs --destdir . | sed -n 's/.*<upstream-version>\(.*\)<\/upstream-version>.*/\1/p')
+.PHONY: get-orig-source
+## Usage: debian/rules get-orig-source
+## Based on: http://wiki.debian.org/onlyjob/get-orig-source
+get-orig-source: PKG_DIR:=$(abspath $(dir $(MAKEFILE_LIST)))
 get-orig-source:
-	-mkdir tmp-musescore-$(version)
-	unzip MuseScore-$(version).zip -d tmp-musescore-$(version)
-	cd tmp-musescore-$(version)/MuseScore-$(version) && \
-	find -name *pdf -exec rm {} + && \
-	rm thirdparty/rtf2html/rtf2html
-	mv tmp-musescore-$(version)/MuseScore-$(version) \
-	    tmp-musescore-$(version)/musescore-$(version)\+dfsg
-	tar -C tmp-musescore-$(version) -czf musescore_$(version)\+dfsg.orig.tar.gz \
-	    musescore-$(version)\+dfsg/
-	#mv musescore_$(version)\+dfsg.orig.tar.gz ../
-	rm -r tmp-musescore-$(version)
-	-rm MuseScore-$(version).zip musescore_$(version).orig.tar.gz
-
+	# Simply call uscan (changes for DFSG done in debian/watch and debian/repack)
+	uscan --noconf --verbose --destdir=$(CURDIR) \
+	  --check-dirname-level=0 --force-download $(PKG_DIR)
diff --git a/debian/watch b/debian/watch
index 4966a4c..56dfd65 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,3 +1,8 @@
+# debian/watch - check for a new upstream release and fetch it. See USCAN(1).
+# The script 'debian/repack' is called to perform changes for DFSG compliance.
 version=3
-opts=dversionmangle=s/\+dfsg\d*$// \
- http://ftp.osuosl.org/pub/musescore/releases/MuseScore-(\d[\d.]*)/MuseScore-(\d[\d.]*)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+opts=\
+dversionmangle=s/\+dfsg\d*$//,\
+filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/MuseScore-$1\.tar\.gz/ \
+  https://github.com/musescore/MuseScore/tags .*/v?(\d\S*)\.tar\.gz \
+debian debian/repack

-- 
musescore packaging



More information about the pkg-multimedia-commits mailing list