[game-data-packager] 09/13: Add the ability for a game to produce more than one .deb
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 c05be16f1affab3f08ad4b6bba49410985471674
Author: Simon McVittie <smcv at debian.org>
Date: Sun Jan 4 21:13:11 2015 +0000
Add the ability for a game to produce more than one .deb
---
game-data-packager | 43 ++++++++++++++++++++++++++++++++++++-------
lib/game-data-packager-shared | 21 ++++++++++++++++++---
lib/via-python | 32 ++++++++++++++++++++------------
3 files changed, 74 insertions(+), 22 deletions(-)
diff --git a/game-data-packager b/game-data-packager
index d671da5..3f4c641 100755
--- a/game-data-packager
+++ b/game-data-packager
@@ -119,12 +119,28 @@ debug "long: $LONGNAME"
WORKDIR=`mktemp -t -d game-data-packager.XXXXXX`
debug "WORKDIR=$WORKDIR"
cleanup() {
- if [ "$PRESERVE" != "yes" ] && [ -f "$OUTFILE" ]; then
- rm "$OUTFILE"
- fi
- if [ -d "$WORKDIR" ]; then
- rmdir "$WORKDIR"
- fi
+ # some magic so that methods can produce multiple debs
+ if [ "$OUTFILE" = "*.deb" ]; then
+ for deb in "$WORKDIR"/*.deb; do
+ rm -f "$deb"
+ done
+ else
+ if [ "$PRESERVE" != "yes" ] && [ -f "$OUTFILE" ]; then
+ rm "$OUTFILE"
+ fi
+ fi
+
+ if [ -d "$WORKDIR" ]; then
+ e=0
+ rmdir "$WORKDIR" || e=$?
+
+ if [ "$e" != 0 ]; then
+ echo "Files remaining in $WORKDIR:" >&2
+ ( cd "$WORKDIR" && find ) >&2
+ fi
+
+ return "$e"
+ fi
}
trap cleanup EXIT
@@ -132,12 +148,25 @@ trap cleanup EXIT
go "$@"
if [ "$PRESERVE" = "yes" ]; then
- echo "generated \"$OUTFILE\"."
+ if [ "$OUTFILE" = "*.deb" ]; then
+ for deb in "$WORKDIR"/*.deb; do
+ realdeb="$(realpath "$deb")"
+ echo "generated \"$realdeb\"."
+ done
+ else
+ echo "generated \"$OUTFILE\"."
+ fi
fi
if [ "$INSTALL" = "yes" ]; then
debug "invoking dpkg to install the package"
install_deb "$OUTFILE"
+
+ if [ "$OUTFILE" = "*.deb" ]; then
+ install_debs "$WORKDIR"/*.deb
+ else
+ install_deb "$OUTFILE"
+ fi
fi
cleanup
diff --git a/lib/game-data-packager-shared b/lib/game-data-packager-shared
index 7b5b7b5..0f0e19d 100644
--- a/lib/game-data-packager-shared
+++ b/lib/game-data-packager-shared
@@ -268,13 +268,28 @@ slipstream_cleanup() {
# stuff relating to installing the generated packages ########################
+## install_debs(deb ...)
+## uses su and dpkg to install the supplied .deb files
+# TODO: configurable priviledge escalation method (not hardcoded su)
+# TODO: configurable package installation method (not hardcoded dpkg)
+# TODO: if using sudo or pkexec, use multiple arguments rather than doing
+# silly things with shell-quoting
+install_deb() {
+ echo "using su(1) to obtain root privileges and install the package(s)"
+ cmd="dpkg -i "
+ for deb in "$@"; do
+ cmd="$cmd \"$deb\""
+ done
+ su -c $cmd
+}
+
## install_deb(deb)
-## uses sudo and dpkg to install the supplied .deb file
-# TODO: configurable priviledge escalation method (not hardcoded sudo)
+## uses su and dpkg to install the supplied .deb file
+# TODO: configurable priviledge escalation method (not hardcoded su)
# TODO: configurable package installation method (not hardcoded dpkg)
install_deb() {
DEB="$1"
- echo "using su(1) to obtain root privileges and install the package"
+ echo "using su(1) to obtain root privileges and install the package"
su -c "dpkg -i \"$DEB\""
}
diff --git a/lib/via-python b/lib/via-python
index 4dfa76d..5102de8 100644
--- a/lib/via-python
+++ b/lib/via-python
@@ -13,9 +13,6 @@ copyin () {
}
gdp_data_driven () {
- # slipstream_instsize, slipstream_repack assume this naming
- DESTDIR="$WORKDIR/slipstream.unpacked"
-
if [ "$*" = "" ]; then
set _ --help
shift
@@ -25,7 +22,6 @@ gdp_data_driven () {
export ETCDIR
export SHORTNAME
export DATADIR
- export DESTDIR
export WORKDIR
PYTHONPATH="$LIBDIR"
export PYTHONPATH
@@ -40,21 +36,29 @@ gdp_data_driven () {
exit $?
fi
- # It had better have a /usr
- if ! [ -e "$DESTDIR/usr" ]; then
- exit 1
- fi
+ # We still do the actual .deb creation in shell, for now
- # We still do this bit in shell script, for now
+ for DESTDIR in "$WORKDIR"/*.deb.d; do
+ deb="${DESTDIR%.deb.d}"
+ deb="${DESTDIR##*/}"
- if [ -e "$WORKDIR/DEB_NAME" ]; then
- deb="$(cat "$WORKDIR/DEB_NAME")"
- fi
+ # 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
+ exit 1
+ fi
+ if ! [ -e "$DESTDIR/DEBIAN" ]; then
+ echo "$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
( cd "$DESTDIR" && find usr -type f -print0 | xargs -0 md5sum ) > \
@@ -68,6 +72,10 @@ gdp_data_driven () {
( cd "$WORKDIR" && slipstream_instsize )
( cd "$WORKDIR" && slipstream_repack "$OUTFILE" )
+ # 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"
rm -fr "$WORKDIR/tmp"
--
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