[game-data-packager] 10/13: game-data-packager: produce almost every .deb for which we have files
Simon McVittie
smcv at debian.org
Sun Jan 4 22:36:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository game-data-packager.
commit ef152cfdee7baf9ed04c9300fa6cd885c7ee67ff
Author: Simon McVittie <smcv at debian.org>
Date: Sun Jan 4 21:49:28 2015 +0000
game-data-packager: produce almost every .deb for which we have files
The only exception is that if we have the full version, we won't
produce demo/shareware versions.
---
lib/game_data_packager/__main__.py | 59 +++++++++++++++++---------------------
lib/via-python | 51 +++++++++++++++++++-------------
2 files changed, 58 insertions(+), 52 deletions(-)
diff --git a/lib/game_data_packager/__main__.py b/lib/game_data_packager/__main__.py
index 8171e43..237d59e 100644
--- a/lib/game_data_packager/__main__.py
+++ b/lib/game_data_packager/__main__.py
@@ -105,43 +105,38 @@ def go(argv):
raise SystemExit('Unable to complete any packages. ' +
'Please provide more files or directories.')
- package = None
-
- # We can only build one package for now, because the shell script
- # wrapper can only do one. Pick the "best": full if we have the
- # right stuff, or expansion if we have the right stuff, or demo.
- if len(possible) == 1:
- for p in possible:
- package = p
- else:
- for p in possible:
- if p.type == 'full':
- package = p
- break
- else:
- for p in possible:
- if p.type == 'expansion':
- package = p
- break
- else:
- # just pick the first one
- for p in possible:
- package = p
-
- logger.debug('chose to produce %s', package.name)
+ ready = set()
+
+ have_full = False
+ for package in possible:
+ if package.type == 'full':
+ have_full = True
+
+ for package in possible:
+ if have_full and package.type == 'demo':
+ # no point in packaging the demo if we have the full
+ # version
+ logger.debug('will not produce %s because we have a full ' +
+ 'version', package.name)
+ continue
- if not game.fill_gaps(package=package, download=True, log=True):
- raise SystemExit('Failed to download necessary files for %s',
- package.name)
+ logger.debug('will produce %s', package.name)
+ if game.fill_gaps(package=package, download=True, log=True):
+ ready.add(package)
+ else:
+ logger.error('Failed to download necessary files for %s',
+ package.name)
- if not game.fill_dest_dir(package, os.environ['DESTDIR']):
+ if not ready:
sys.exit(1)
- # FIXME: make the .deb (currently done in shell script by the wrapper)
+ for package in ready:
+ destdir = os.path.join(os.environ['WORKDIR'],
+ '%s.deb.d' % package.name)
+ if not game.fill_dest_dir(package, destdir):
+ sys.exit(1)
- # This is a hack to communicate the name of the .deb to the shell
- # script...
- open(os.environ['WORKDIR'] + '/DEB_NAME', 'w').write(package.name)
+ # FIXME: make the .deb (currently done in shell script by the wrapper)
if __name__ == '__main__':
go(sys.argv[1:])
diff --git a/lib/via-python b/lib/via-python
index 5102de8..ab80fd9 100644
--- a/lib/via-python
+++ b/lib/via-python
@@ -38,46 +38,57 @@ gdp_data_driven () {
# We still do the actual .deb creation in shell, for now
+ if [ -e "$WORKDIR/DO-NOT-COMPRESS" ]; then
+ COMPRESS=no
+ fi
+
for DESTDIR in "$WORKDIR"/*.deb.d; do
deb="${DESTDIR%.deb.d}"
- deb="${DESTDIR##*/}"
+ deb="${deb##*/}"
# it had better have a /usr and a DEBIAN directory or something has
# gone very wrong
if ! [ -e "$DESTDIR/usr" ]; then
- echo "$DESTDIR/usr not found" >&2
+ echo "internal error: $DESTDIR/usr not found" >&2
exit 1
fi
if ! [ -e "$DESTDIR/DEBIAN" ]; then
- echo "$DESTDIR/DEBIAN not found" >&2
+ echo "internal error: $DESTDIR/DEBIAN not found" >&2
exit 1
fi
- done
- if [ "" = "$OUTDIR" ]; then
- OUTFILE="$WORKDIR/out.deb"
- else
- OUTFILE="$(unravel "$OUTDIR")/${deb}_${VERSION_PREFIX:-}${GAME_PACKAGE_VERSION}_all.deb"
- ln -s "$OUTFILE" "$WORKDIR/out.deb"
- fi
+ output="${deb}_${VERSION_PREFIX:-}${GAME_PACKAGE_VERSION}_all.deb"
- ( cd "$DESTDIR" && find usr -type f -print0 | xargs -0 md5sum ) > \
- "$WORKDIR/slipstream.unpacked/DEBIAN/md5sums"
+ if [ "" = "$OUTDIR" ]; then
+ OUTFILE="$WORKDIR/$output"
+ else
+ OUTFILE="$(unravel "$OUTDIR")/$output"
+ ln -s "$OUTFILE" "$WORKDIR/$output"
+ fi
- if [ -e "$WORKDIR/DO-NOT-COMPRESS" ]; then
- COMPRESS=no
- fi
+ ( cd "$DESTDIR" && find usr -type f -print0 | xargs -0 md5sum ) > \
+ "$DESTDIR/DEBIAN/md5sums"
+
+ # slipstream_* assume this naming
+ if [ -e "$WORKDIR/slipstream.unpacked" ]; then
+ echo "internal error: $WORKDIR/slipstream.unpacked exists" >&2
+ exit 1
+ fi
+ mv "$DESTDIR" "$WORKDIR/slipstream.unpacked"
+
+ debug "building .deb: $OUTFILE"
+ ( cd "$WORKDIR" && slipstream_instsize )
+ ( cd "$WORKDIR" && slipstream_repack "$OUTFILE" )
- debug "building .deb: $OUTFILE"
- ( cd "$WORKDIR" && slipstream_instsize )
- ( cd "$WORKDIR" && slipstream_repack "$OUTFILE" )
+ rm -fr "$WORKDIR/slipstream.unpacked"
+ done
# Special value to signal that gdp should just install every .deb
# in $WORKDIR
OUTFILE="*.deb"
- rm -f "$WORKDIR/DEB_NAME"
rm -f "$WORKDIR/DO-NOT-COMPRESS"
+
+ # The Python code does all its work in this directory
rm -fr "$WORKDIR/tmp"
- rm -fr "$DESTDIR"
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list