[minetest-v04x] 01/10: Move the repacking logic to an external script

Martin Quinson mquinson at moszumanska.debian.org
Tue May 17 06:39:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

mquinson pushed a commit to branch master
in repository minetest-v04x.

commit 4d47ca3a9d7853de33933e7bfc5cd17db64875ef
Author: Martin Quinson <martin.quinson at loria.fr>
Date:   Tue May 17 06:56:23 2016 +0200

    Move the repacking logic to an external script
    
    - it's using a uscan feature, so there is no usage change.
    - but it's really easier to write extra scripts rather to make rules
      (comments, spaces, etc)
    - Plus, the version parsing was broken for some reason and the
       get-orig target was failing on me.
      Now, uscan gives me the version number on the command line.
---
 debian/repack.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/rules     | 30 +-------------------------
 debian/watch     |  5 ++++-
 3 files changed, 71 insertions(+), 30 deletions(-)

diff --git a/debian/repack.sh b/debian/repack.sh
new file mode 100755
index 0000000..98b749f
--- /dev/null
+++ b/debian/repack.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Repack an upstream tarball, unpacking waf files inside it.
+#
+# Meant to be run by uscan(1) as the "command param", after repacking
+# (if any) by mk-origtargz. So you shouldn't give "repacksuffix" to
+# debian/watch; instead you should set it below; however this should
+# still match the dversionmangle in that file.
+
+repacksuffix="+repack"
+dfsgremovals="Makefile.bak \
+	     .gitattributes \
+	     .gitignore \
+	     .hg_archival \
+	     .hg_archival.txt \
+	     .hgignore \
+	     .hgtags \
+	     fontlucida.png \
+	     sqlite \
+	     json \
+	     lua"
+#	     jthread # upstream patched that lib, which seem dead upstream itself, so use minetest's version even if I don't like it.
+
+included_games="minetest_game"
+
+# You shouldn't need to change anything below here.
+
+USAGE="Usage: $0 --upstream-version version filename"
+
+test "$1" = "--upstream-version" || { echo >&2 "$USAGE"; exit 2; }
+upstream="$2"
+filename="$3"
+
+source="$(dpkg-parsechangelog -SSource)"
+newups="${upstream}${repacksuffix}"
+basedir="$(dirname "$filename")"
+
+set -e
+
+mkdir temp
+cd temp
+tar -xf "../$filename"
+
+cd "${source}-${upstream}"
+
+# Remove non-free content
+set +ex
+for file in $dfsgremovals ; do
+  filelist="$filelist "`find . -name $file`
+done
+set -ex
+rm -rf $filelist
+
+# Add the basic game
+for game in $included_games ; do 
+  wget --no-verbose https://github.com/minetest/${game}/archive/${upstream}.tar.gz -O - | tar xfz - 
+  mv ${game}-${upstream} games/${game}
+done
+
+# Repack everything
+cd ..
+mv "${source}-${upstream}" "${source}-${newups}"
+GZIP="-9fn" tar -czf "../$basedir/${source}_${newups}.orig.tar.gz" "${source}-${newups}"
+rm -rf "${source}-${newups}"
+
+cd ../ # out of temp
+rm -rf temp
\ No newline at end of file
diff --git a/debian/rules b/debian/rules
index 1298f48..ac3b23e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,7 +4,6 @@
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
 # upstream version
-version=$(shell uscan --report-status | head -2 | tail -1 | cut -d' ' -f7 | cut -d, -f1)
 tmpdir:=$(shell mktemp -d)
 wrkdir:=$(shell pwd)
 
@@ -14,17 +13,6 @@ export DEB_BUILD_MAINT_OPTIONS="hardening=+all"
 # file names
 sources=$(shell find . -name *.cpp)
 headers=$(shell find . -name *.h)
-dfsgremovals=Makefile.bak \
-	     .gitattributes \
-	     .hg_archival \
-	     .hg_archival.txt \
-	     .hgignore \
-	     .hgtags \
-	     fontlucida.png \
-	     sqlite \
-	     json \
-	     lua
-#	     jthread # upstream patched that lib, which seem dead upstream itself, so use minetest's version even if I don't like it.
 cleanremovals= bin \
 	       CMakeFiles \
 	       src/CMakeFiles \
@@ -102,23 +90,7 @@ override_dh_strip:
 	dh_strip --dbg-package=minetest-dbg
 
 get-orig-source:
-	rm -f ${wrkdir}/../minetest_${version}+repack.orig.tar.gz
-	uscan --verbose --force-download && mv ../${version}.tar.gz ${tmpdir} || true
-	set +ex; cd ${tmpdir} && \
-	    tar xf ${version}.tar.gz && rm -f ${version}.tar.gz && \
-	    cd minetest-${version}/games && \
-	    for game in minetest_game ; do \
-	       wget --no-verbose https://github.com/minetest/$${game}/archive/${version}.tar.gz -O - | tar xfz - ; \
-	       mv $${game}-${version} $${game} ; \
-	       done && \
-	    cd .. ; \
-	    for file in ${dfsgremovals}; do \
-	        find . -name $$file -execdir rm -rf {} \; 2>/dev/null || true; \
-		done && \
-	    tar cf ${wrkdir}/../minetest_${version}+repack.orig.tar * ; \
-	    gzip --best ${wrkdir}/../minetest_${version}+repack.orig.tar
-	rm -rf ${tmpdir}
-	@echo "successfully created new tarball: ${wrkdir}/../minetest_${version}+repack.orig.tar.gz"
+	uscan --verbose --force-download
 
 %:
 	dh ${@} --parallel --with systemd
diff --git a/debian/watch b/debian/watch
index 242e085..1dd256d 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,3 +1,6 @@
 version=3
 opts=dversionmangle=s/\+(repack|dfsg|ds|deb)\d*$// \
-https://github.com/minetest/minetest/tags .*/(\d[\d\.]+)\.tar\.gz
+https://github.com/minetest/minetest/tags \
+  .*/(\d[\d\.]+)\.tar\.gz \
+  debian sh debian/repack.sh
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/minetest-v04x.git



More information about the Pkg-games-commits mailing list