[game-data-packager] 12/18: No more shell scripting!
Simon McVittie
smcv at debian.org
Thu Jan 22 12:40:42 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 a009d2d74ab31a7b1fc5d2cfa74d259d84fb69de
Author: Simon McVittie <smcv at debian.org>
Date: Thu Jan 22 11:11:42 2015 +0000
No more shell scripting!
(Almost - there's still a wrapper to set PYTHONPATH.)
---
Makefile | 1 -
debian/dirs | 1 -
debian/game-data-packager.install | 1 -
doc/adding_a_game.mdwn | 17 +-
game-data-packager | 157 +-------------
lib/game-data-packager-shared | 419 -------------------------------------
lib/game_data_packager/__init__.py | 2 +-
lib/q2mp-common | 53 -----
lib/via-python | 57 -----
supported/doom | 4 -
supported/doom2 | 4 -
supported/heretic | 4 -
supported/hexen | 4 -
supported/hexen2 | 4 -
supported/ja | 6 -
supported/jk2 | 6 -
supported/lgeneral | 6 -
supported/plutonia | 8 -
supported/q2rogue | 9 -
supported/q2xatrix | 9 -
supported/quake | 6 -
supported/quake2 | 6 -
supported/quake3 | 6 -
supported/rott | 4 -
supported/rtcw | 6 -
supported/spear-of-destiny | 4 -
supported/tnt | 8 -
supported/tyrian | 4 -
supported/wolf3d | 4 -
t/verify-md5sum-alternatives.sh | 18 --
tests/empty/DEBIAN/control | 10 -
tests/lib/die | 14 --
tests/lib/require_program | 13 --
tests/lib/verify_directory | 14 --
tests/lib/verify_file | 14 --
tests/lib/verify_md5sum | 15 --
tests/runtests | 120 -----------
tests/testfile | 1 -
38 files changed, 8 insertions(+), 1031 deletions(-)
diff --git a/Makefile b/Makefile
index 7ce055b..e42a9a5 100644
--- a/Makefile
+++ b/Makefile
@@ -51,7 +51,6 @@ clean:
for d in $(DIRS); do [ ! -d "$$d" ] || rmdir "$$d"; done
check:
- ./t/verify-md5sum-alternatives.sh
GDP_UNINSTALLED=1 PYTHONPATH=lib python3 -m game_data_packager.check_syntax
pyflakes3 lib/game_data_packager/*.py lib/game_data_packager/*/*.py || :
diff --git a/debian/dirs b/debian/dirs
index 3939a87..0bee199 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -1,6 +1,5 @@
usr/games
usr/share/man/man6
usr/share/games/game-data-packager
-usr/share/games/game-data-packager/supported
usr/lib/game-data-packager
etc
diff --git a/debian/game-data-packager.install b/debian/game-data-packager.install
index bd033fa..aed11ad 100644
--- a/debian/game-data-packager.install
+++ b/debian/game-data-packager.install
@@ -1,6 +1,5 @@
lib/* usr/lib/game-data-packager
game-data-packager usr/games
-supported/* usr/share/games/game-data-packager/supported
etc/game-data-packager.conf etc
etc/*-mirrors etc/game-data-packager
out/*.control.in usr/share/games/game-data-packager
diff --git a/doc/adding_a_game.mdwn b/doc/adding_a_game.mdwn
index f2051f0..2a2f075 100644
--- a/doc/adding_a_game.mdwn
+++ b/doc/adding_a_game.mdwn
@@ -135,22 +135,7 @@ to mapping:
* `install`: list of strings: unique names of known files or alternative
sets to install
-### Step 3: the gdp "supported" file
-
-Until gdp is completely ported to Python you will need a `supported` file.
-Use `supported/quake3` as an example.
-
-A "supported" file must define the following variables:
-
- * `SHORTNAME`: this is the name which a user must provide as an argument
- to gdp in order to invoke your code.
- * `LONGNAME`: this is used by gdp when printing a usage message. It can be
- used to disambiguate or expand upon the short name, which might not be
- enough to explain what it is.
-
-It can chain to `$LIBDIR/via-python` for the rest.
-
-### Step 4: advanced
+### Step 3: advanced
You can write a Python plugin in `lib/game_data_packager/games/SHORTNAME.py`
if you need to implement different command-line parsing or behaviour.
diff --git a/game-data-packager b/game-data-packager
index 79ebfd4..790e738 100755
--- a/game-data-packager
+++ b/game-data-packager
@@ -2,162 +2,17 @@
set -e
set -u
-# unset grep options that could affect output
-unset GREP_OPTIONS
-
-# defaults
-INSTALL="no"
-PRESERVE="yes"
-COMPRESS="maybe"
-
# test to see whether we are running in 'development mode'
if [ "$0" = "./game-data-packager" ]; then
GDP_UNINSTALLED=1
export GDP_UNINSTALLED
- SUPPORTED=./supported
- LIBDIR=./lib
- DATADIR="./out"
- ETCDIR="./etc"
- . "./etc/game-data-packager.conf"
+ PYTHONPATH="$(pwd)/lib"
else
- SUPPORTED=/usr/share/games/game-data-packager/supported
- LIBDIR=/usr/lib/game-data-packager
- DATADIR="/usr/share/games/game-data-packager"
- ETCDIR=/etc/game-data-packager
- . "/etc/game-data-packager.conf"
-fi
-. $LIBDIR/game-data-packager-shared
-LIBDIR="`unravel "$LIBDIR"`"
-DATADIR="`unravel "$DATADIR"`"
-
-if [ $# -lt 1 ]; then
- usage >&2
- exit 1
-fi
-
-OUTDIR="$(pwd)"
-OUTFILE=""
-
-# process command line arguments
-while [ $# -gt 1 ]; do
- case "$1" in
- '-n')
- INSTALL="no"
- ;;
- '-d')
- PRESERVE="yes"
- shift
- if [ $# -lt 2 ]; then
- echo "missing directory or game argument" >&2
- usage >&2
- exit 1
- fi
- OUTDIR="$1"
- ;;
- '-i')
- INSTALL="yes"
- ;;
- '-z'|'--compress')
- COMPRESS="yes"
- ;;
- '--no-compress')
- COMPRESS="no"
- ;;
- '--')
- shift
- break;
- ;;
- *) # possibly the game name
- break;
- ;;
- esac
- shift
-done
-
-# If we're not going to keep the .deb, there's no point in having
-# a good compression ratio.
-if [ "$COMPRESS" = "maybe" ]; then
- COMPRESS="$PRESERVE"
-fi
-
-if [ "$INSTALL" = "no" -a "$PRESERVE" = "no" ]; then
- echo "if you specify -n, you must also specify -d." >&2
- exit 1
-fi
-
-debug "INSTALL=$INSTALL"
-debug "PRESERVE=$PRESERVE"
-
-# ensure we can write to OUTDIR
-[ -w "$OUTDIR" ] || die "cannot write generated file to '$OUTDIR'"
-
-GAME="$1"
-shift
-
-# Handle non-game modes
-case "$GAME" in
- (make-template)
- PYTHONPATH="$LIBDIR"
- export PYTHONPATH
- export DATADIR
- export ETCDIR
- export LIBDIR
- python3 -m game_data_packager.make_template "$@"
- exit $?
- ;;
-esac
-
-if [ ! -f "$SUPPORTED/$GAME" ]; then
- echo "unknown option or game '$GAME'" >&2
- usage >&2
- exit 1
+ PYTHONPATH=/usr/lib/game-data-packager
fi
-. "$SUPPORTED/$GAME"
-
-debug "short: $SHORTNAME"
-debug "long: $LONGNAME"
-
-# setup a working directory
-WORKDIR=`mktemp -t -d game-data-packager.XXXXXX`
-debug "WORKDIR=$WORKDIR"
-cleanup() {
- if [ "$OUTFILE" != "" ]; then
- 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
+export PYTHONPATH
- return "$e"
- fi
-}
-trap cleanup EXIT
-
-# now the game's handler needs to be executed
-go "$@"
-
-if [ "$PRESERVE" = "yes" ]; then
- if [ "$OUTFILE" != "" ]; then
- echo "generated \"$OUTFILE\"."
- fi
-fi
-
-if [ "$INSTALL" = "yes" ]; then
- debug "invoking dpkg to install the package"
-
- if [ "$OUTFILE" = "*.deb" ]; then
- install_debs "$WORKDIR"/*.deb
- else
- install_deb "$OUTFILE"
- fi
-fi
+# FIXME: undocumented feature currently disabled:
+# python3 -m game_data_packager.make_template "$@"
-cleanup
+exec python3 -m game_data_packager "$@"
diff --git a/lib/game-data-packager-shared b/lib/game-data-packager-shared
deleted file mode 100644
index 00d57d8..0000000
--- a/lib/game-data-packager-shared
+++ /dev/null
@@ -1,419 +0,0 @@
-# vim:set ft=sh:
-
-supported() {
- echo "the following games are supported:"
- echo
- printf "\t\t name\tdescription\n"
- printf "\t\t ----\t-----------\n"
-
- find $SUPPORTED -type f | grep -v '\.svn' | grep -v 'swp$' | sort |
- while read file; do
- . $file
- printf "\t%16s\t%s\n" "$SHORTNAME" "$LONGNAME"
- done
-}
-options() {
- echo "game-data-packager arguments:"
- echo " -i install the generated package"
- echo " -n do not install the generated package (requires -d, default)"
- echo " -d OUTDIR write the generated .deb(s) to OUTDIR"
- echo " -z | --compress compress generated .deb (default unless -i is used)"
- echo " --no-compress do not compress generated .deb (default with -i)"
-}
-
-usage() {
- echo "usage:"
- printf "\tgame-data-packager [game-data-packager-args] game [game-args]\n"
- echo
- options
- echo
- supported
- echo
- echo "run game-data-packager [game] to see game-specific arguments."
- echo
-}
-
-set +u
-if [ -n "$DEBUG" ]; then
-debug() {
- echo "DEBUG: $*" >&2
-}
-else
-debug() { :; }
-fi
-set -u
-
-warn() {
- echo "WARNING: $*" >&2
-}
-
-## die(string,retcode)
-## end the program, complaining with string on stderr
-## and returning retcode if supplied, 2 if not.
-die() {
- if [ $# -lt 2 ]; then
- RET=2
- else
- RET=$2
- fi
- echo $0: $1 >&2
- exit $RET
-}
-
-## verify_md5sum(file,sum)
-## calculates the md5sum of file and compares it to sum.
-## if the sum doesn't match, complains on stderr and causes the program
-## to exit.
-verify_md5sum() {
- FILE=$1
- GOODSUM=$2
- SUM=`md5sum $FILE|cut -d' ' -f1`
- [ "$SUM" = "$GOODSUM" ] || die "$FILE's md5 checksum is unknown"
-}
-
-## verify_md5sum_alternatives(file,sums,warn)
-## calculates the md5sum of file and compares it to sums (comma-separated).
-## if the sum doesn't match any of them, complains on stderr and causes
-## the program to exit.
-## If warn is supplied, warn the user if the first sum doesn't match.
-verify_md5sum_alternatives() {
- FILE=$1
- GOODSUMS=$2
- SUM=`md5sum $FILE|cut -d' ' -f1`
- case ",$GOODSUMS," in
- (,$SUM,*)
- ;;
- (*,$SUM,*)
- if [ $# -gt 2 ]; then
- warn "$3"
- fi
- ;;
- (*)
- die "$FILE's md5 checksum $SUM is unknown"
- ;;
- esac
-}
-
-## verify_directory(dir)
-## ensures dir is a directory, or complains on stderr
-## and causes the program to exit.
-verify_directory() {
- DIR=$1
- [ -d "$DIR" ] || die "$DIR is not a directory"
-}
-
-## verify_file(file)
-## ensures file is a file, or complains on stderr
-## and causes the program to exit.
-verify_file() {
- FILE=$1
- [ -f "$FILE" ] || die "$FILE is not a file"
- [ -r "$FILE" ] || die "$FILE is not readable"
-}
-
-## slipstream(deb,relpath,file1,file2...)
-## insert file1,file2... into the deb, under the
-## path 'relpath', relative to the package root, e.g.:
-## slipstream(deb, 'usr/share/doc', 'README', 'copyright')
-## => /usr/share/doc/README
-## => /usr/share/doc/copyright
-## prerequisites:
-## * $WORKDIR must be defined to a directory within which
-## slipstream can do it's work (somewhere writeable)
-# TODO: this assumes every file is going to go in the same RELPATH. hmm.
-slipstream() {
- DEB="$1" # the .deb file we are going to mangle
- RELPATH="$2" # relative path in the unpacked .deb
- shift 2
-
- OLDWD=`pwd`
- cd "$WORKDIR"
-
- slipstream_permcheck "$DEB"
- slipstream_unpack "$DEB"
-
- if [ ! -d "$RELPATH" ]; then
- mkdir -p "./slipstream.unpacked/$RELPATH"
- fi
-
- while [ "$#" -gt 0 ]; do
- file="$1"
- destpath="${RELPATH}/${file##*/}"
- slipstream_file "$file" "$destpath"
- shift
- done
-
- slipstream_instsize
- slipstream_repack "$DEB"
- slipstream_cleanup
-
- cd "$OLDWD"
-}
-
-## slipstream_dir(deb,relpath,directory)
-## insert a directory with game data instead of single files
-slipstream_dir() {
- DEB="$1" # the .deb file we are going to mangle
- RELPATH="$2" # relative path in the unpacked .deb
- DIR="$3" # directory with game data
-
- find $DIR -type f | (
-
- OLDWD=`pwd`
- cd "$WORKDIR"
-
- slipstream_permcheck "$DEB"
- slipstream_unpack "$DEB"
- while read f; do
- destpath="$RELPATH$f"
- targetdir=`dirname "$destpath"`
- mkdir -p "./slipstream.unpacked/$targetdir"
- cp -p "$f" "./slipstream.unpacked/$targetdir"
- chmod 644 "./slipstream.unpacked/$destpath"
-
- # add a line to md5sums
- cd slipstream.unpacked
- md5sum "$destpath" >> "DEBIAN/md5sums"
- cd ..
- done
-
- slipstream_instsize
- slipstream_repack "$DEB"
- slipstream_cleanup
-
- cd "$OLDWD"
- )
-}
-
-
-## slipstream_permcheck(deb)
-## ensures that the file deb can be written to and
-## that the current working directory is writeable
-slipstream_permcheck() {
- DEB="$1"
-
- # ensure we can write to $DEB
- if [ ! -w "$DEB" ]; then
- ls -l "$DEB"
- die "wrong permissions on $DEB (I can't write to it)"
- fi
-
- # ensure we can write to the workdir
- if [ ! -w . ]; then
- die "cannot write to $PWD"
- fi
-}
-
-## slipstream_unpack(deb)
-## unpacks the deb file into "./slipstream_unpacked"
-## and the control data into "./slipstream_unpacked/DEBIAN"
-slipstream_unpack() {
- DEB="$1"
- dpkg-deb -x "$DEB" "./slipstream.unpacked"
- dpkg-deb -e "$DEB" "./slipstream.unpacked/DEBIAN"
-}
-
-## slipstream_file(file,destpath)
-## copies the file into "./slipstream_unpacked/$destpath",
-## calculates the files md5sum and adds it to the md5sums
-## file in the control area.
-slipstream_file() {
- file="$1"
- destpath="$2"
-
- cp -p "$file" "./slipstream.unpacked/$destpath"
- chmod 644 "./slipstream.unpacked/$destpath"
-
- # add a line to md5sums
- cd slipstream.unpacked
- md5sum "$destpath" >> "DEBIAN/md5sums"
- cd ..
-}
-
-## slipstream_instsize
-## calculates the installed size of the deb, (based on
-## the contents of the ./slipstream_unpacked directory)
-## and writes the result to the control file in the
-## control area.
-slipstream_instsize() {
- # figure out the new installed-size
- INSTSIZE=`du -sk ./slipstream.unpacked | cut -f1`
- sed -i "s/^Installed-Size.*/Installed-Size: $INSTSIZE/" \
- "./slipstream.unpacked/DEBIAN/control"
-}
-
-## slipstream_repack(deb)
-## writes a new debian package over deb, packing
-## the files from ./slipstream_unpacked inside,
-## using the control area in ./slipstream_unpacked/DEBIAN
-slipstream_repack() {
- DEB="$1" # the .deb file we are going to mangle
-
- # XXX: store output in a temporary file, then cat the file if
- # dpkg-deb fails for some reason. (this is all to hide a non-
- # suppressable "building package foo in ..." message)
- if [ "$COMPRESS" = "no" ]; then
- fakeroot dpkg-deb -Znone -b slipstream.unpacked "$DEB" >/dev/null
- else
- fakeroot dpkg-deb -b slipstream.unpacked "$DEB" >/dev/null
- fi
-
-}
-
-## slipstream_cleanup()
-## removes the ./slipstream_unpacked directory.
-slipstream_cleanup() {
- rm -rf ./slipstream.unpacked
-}
-
-# 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_debs() {
- 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 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"
- su -c "dpkg -i \"$DEB\""
-}
-
-## unravel(path)
-## convert 'path' from relative to absolute
-## if it does not begin with a slash.
-unravel() {
- FILE="$1"
- if echo "$FILE" | grep ^/ >/dev/null; then
- :
- else
- # assume a relative path
- FILE="$PWD/$FILE"
- fi
-
- echo $FILE
-}
-
-if [ -f ./debian/changelog -a -x ./game-data-packager ]; then
- GAME_PACKAGE_VERSION=`dpkg-parsechangelog -ldebian/changelog --format \
- rfc822 | grep Version | cut -d' ' -f2`
-else
- GAME_PACKAGE_VERSION=`dpkg-query --showformat='${Version}\n' \
- --show game-data-packager`
-fi
-
-## gdp_unzip_into (zipfile, extraction directory, [files...])
-## Unpack files (or everything if not given) from zipfile, with hierarchy
-## preserved.
-##
-## e.g. gdp_unzip_into q2-3.20-x86-full-ctf.exe ~/tmp baseq2/pak1.pak
-## will extract the zip file member "baseq2/pak1.pak" to
-## ~/tmp/baseq2/pak1.pak
-gdp_unzip_paths () {
- zipfile="$1"
- shift
- target="$1"
- shift
- if which 7za >/dev/null; then
- debug "using 7za"
- 7za x -o"$target" -y "$zipfile" "$@" >/dev/null
- elif which 7z >/dev/null; then
- debug "using 7z"
- 7z x -o"$target" -y "$zipfile" "$@" >/dev/null
- else
- debug "using unzip"
- unzip -d "$target" -qqo "$zipfile" "$@"
- fi
-}
-
-## Deprecated version of gdp_unzip_paths with ambiguous behaviour.
-## If the zip file does not contain subdirectories,
-## "gdp_unzip x.zip y" is equivalent to "gdp_unzip_paths x.zip . y".
-## If the zip file contains a/b/c, it might unpack to either ./a/b/c
-## or ./c, depending on the tool used.
-gdp_unzip() {
- zipfile="$1"
- shift
- if which 7za >/dev/null; then
- debug "using 7za"
- 7za e -y "$zipfile" "$@" >/dev/null
- elif which 7z >/dev/null; then
- debug "using 7z"
- 7z e -y "$zipfile" "$@" >/dev/null
- else
- debug "using unzip"
- unzip -qqo "$zipfile" "$@"
- fi
-}
-
-## ifind(base,file)
-## case-insensitive search for file in base
-ifind() {
- base="$1"
- file="$2"
- [ -d "$base" ] && find "$base" -iwholename "$base/$file"
-}
-
-package_installed() {
- dpkg-query -W "$1" >/dev/null 2>&1
-}
-
-## require_program(program,package,..)
-## make sure 'program' exists and can be executed, if not, instruct
-## the user to install package (or packages) and quit gdp.
-require_program() {
- program="$1"
- shift
-
- which "$program" >/dev/null || {
- diestr="'$program' is required for this target.\n"
- if [ $# -gt 1 ]; then
- diestr="${diestr}Please install the following packages:\n"
- while [ $# -gt 0 ]; do
- package_installed "$1" || diestr="${diestr} • $1\n"
- shift
- done
- die "${diestr}and try again."
- fi
- die "${diestr}Please install the package '$1' and try again."
- }
-}
-
-package_installed() {
- dpkg-query -W "$1" >/dev/null 2>&1
-}
-
-## require_program(program,package,..)
-## make sure 'program' exists and can be executed, if not, instruct
-## the user to install package (or packages) and quit gdp.
-require_program() {
- program="$1"
- shift
-
- which "$program" >/dev/null || {
- diestr="'$program' is required for this target.\n"
- if [ $# -gt 1 ]; then
- diestr="${diestr}Please install the following packages:\n"
- while [ $# -gt 0 ]; do
- package_installed "$1" || diestr="${diestr} • $1\n"
- shift
- done
- die "${diestr}and try again."
- fi
- die "${diestr}Please install the package '$1' and try again."
- }
-}
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 2c0cc69..c411e03 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -2291,7 +2291,7 @@ def run_command_line():
game_parsers = parser.add_subparsers(dest='shortname',
title='supported games', metavar='GAME')
- games = load_yaml_games(os.environ.get('WORKDIR', None))
+ games = load_yaml_games(None)
for g in sorted(games.keys()):
games[g].add_parser(game_parsers, base_parser)
diff --git a/lib/q2mp-common b/lib/q2mp-common
deleted file mode 100644
index 08a4e8e..0000000
--- a/lib/q2mp-common
+++ /dev/null
@@ -1,53 +0,0 @@
-q2mp_prereqs() {
- packages="make gcc binutils"
- require_program make $packages
- require_program cc $packages
- require_program strip $packages
-}
-
-q2mp_usage() {
- echo "$SHORTNAME arguments: [ -t tarball ] q2path"
- echo
- echo "\t-t tarball use user-supplied source tarball (default is to"
- echo "\t download)"
- echo "\t-f force installation when MD5 sum of tarball is unknown"
- echo "\tq2path path to an unpacked Quake 2 directory containing"
- echo "\t mission pack data"
- exit 1
-}
-
-q2mp_process_opts() {
- while [ $# -gt 1 ]; do
- case "$1" in
- "-t")
- [ $# -ge 2 ] || q2mp_usage
- xpath="$2"
- shift 2
- ;;
- "-f")
- checksum="false"
- shift
- ;;
- *)
- q2mp_usage
- ;;
- esac
- done
- [ $# -eq 1 ] || q2mp_usage
- root=`unravel "$1"`
- debug "xpath = '$xpath'"
- debug "checksum = '$checksum'"
- debug "root = '$root'"
-}
-
-q2mp_build_gameso() {
- srcball=`unravel "$1"`
- verify_file "$srcball"
- cd "$WORKDIR"
- mkdir "$SHORTNAME"
- cd "$SHORTNAME"
- tar --strip-components=1 -xf "$srcball"
- make -s -j5 >/dev/null # XXX: parameterize
- verify_file "release/game.so"
- strip "release/game.so"
-}
diff --git a/lib/via-python b/lib/via-python
deleted file mode 100644
index 9862340..0000000
--- a/lib/via-python
+++ /dev/null
@@ -1,57 +0,0 @@
-# vim:set ft=sh sw=4 sts=4 et:
-
-# Data-driven game-data-packager code for Jedi Outcast, Jedi Academy,
-# Return to Castle Wolfenstein; hopefully generalizable to others.
-#
-# Must define SHORTNAME, LONGNAME first.
-
-gdp_data_driven () {
- if [ "$*" = "" ]; then
- set _ --help
- shift
- fi
-
- (
- export WORKDIR
- PYTHONPATH="$LIBDIR"
- export PYTHONPATH
- if [ -n "${DEBUG:-}" ]; then
- export DEBUG
- fi
- if [ "$INSTALL" = "yes" ]; then
- set _ --install "$@"
- else
- set _ --no-install "$@"
- fi
- shift
- if [ "$COMPRESS" = "yes" ]; then
- set _ --compress "$@"
- else
- set _ --no-compress "$@"
- fi
- shift
- if [ "$PRESERVE" = "yes" ]; then
- set _ -d "$OUTDIR" "$@"
- shift
- fi
- debug "Packaging $LONGNAME via Python code"
- debug "Will run: python3 -m game_data_packager $*"
- python3 -m game_data_packager "$@"
- exit $?
- )
-
- if [ "$?" != 0 ]; then
- exit $?
- fi
-
- # Special value to signal that we did our own installation
- OUTFILE=""
-
- # The Python code does the installation if necessary, so we don't
- # need to deal with this in shell script any more
- INSTALL=no
-}
-
-go () {
- gdp_data_driven "$SHORTNAME" "$@"
-}
diff --git a/supported/doom b/supported/doom
deleted file mode 100644
index 33f79f7..0000000
--- a/supported/doom
+++ /dev/null
@@ -1,4 +0,0 @@
-SHORTNAME=doom
-LONGNAME="Doom (including Ultimate Doom)"
-
-. $LIBDIR/via-python
diff --git a/supported/doom2 b/supported/doom2
deleted file mode 100644
index d2c97c5..0000000
--- a/supported/doom2
+++ /dev/null
@@ -1,4 +0,0 @@
-SHORTNAME=doom2
-LONGNAME="Doom II: Hell on Earth"
-
-. $LIBDIR/via-python
diff --git a/supported/heretic b/supported/heretic
deleted file mode 100644
index 45a8e15..0000000
--- a/supported/heretic
+++ /dev/null
@@ -1,4 +0,0 @@
-SHORTNAME=heretic
-LONGNAME="Heretic: Shadow of the Serpent Riders"
-
-. $LIBDIR/via-python
diff --git a/supported/hexen b/supported/hexen
deleted file mode 100644
index c009f0e..0000000
--- a/supported/hexen
+++ /dev/null
@@ -1,4 +0,0 @@
-SHORTNAME=hexen
-LONGNAME="Hexen: Beyond Heretic"
-
-. $LIBDIR/via-python
diff --git a/supported/hexen2 b/supported/hexen2
deleted file mode 100644
index 2a89531..0000000
--- a/supported/hexen2
+++ /dev/null
@@ -1,4 +0,0 @@
-SHORTNAME=hexen2
-LONGNAME="Hexen II"
-
-. $LIBDIR/via-python
diff --git a/supported/ja b/supported/ja
deleted file mode 100644
index 7758c30..0000000
--- a/supported/ja
+++ /dev/null
@@ -1,6 +0,0 @@
-# vim:set ft=sh sw=4 sts=4 et:
-
-SHORTNAME=ja
-LONGNAME="Star Wars Jedi Knight: Jedi Academy"
-
-. $LIBDIR/via-python
diff --git a/supported/jk2 b/supported/jk2
deleted file mode 100644
index 80aef81..0000000
--- a/supported/jk2
+++ /dev/null
@@ -1,6 +0,0 @@
-# vim:set ft=sh sw=4 sts=4 et:
-
-SHORTNAME=jk2
-LONGNAME="Star Wars Jedi Knight II: Jedi Outcast"
-
-. $LIBDIR/via-python
diff --git a/supported/lgeneral b/supported/lgeneral
deleted file mode 100644
index 9619639..0000000
--- a/supported/lgeneral
+++ /dev/null
@@ -1,6 +0,0 @@
-# vim:set ft=sh:
-
-SHORTNAME=lgeneral
-LONGNAME="LGeneral"
-
-. $LIBDIR/via-python
diff --git a/supported/plutonia b/supported/plutonia
deleted file mode 100644
index 494b25d..0000000
--- a/supported/plutonia
+++ /dev/null
@@ -1,8 +0,0 @@
-SHORTNAME=plutonia
-LONGNAME="Final Doom: The Plutonia Experiment"
-
-. $LIBDIR/via-python
-
-go () {
- gdp_data_driven final-doom "$@"
-}
diff --git a/supported/q2rogue b/supported/q2rogue
deleted file mode 100644
index b84fbc1..0000000
--- a/supported/q2rogue
+++ /dev/null
@@ -1,9 +0,0 @@
-# vim: set ft=sh:
-SHORTNAME=q2rogue
-LONGNAME="Quake II Mission Pack: Ground Zero"
-
-. $LIBDIR/via-python
-
-go () {
- gdp_data_driven quake2 -pquake2-rogue "$@"
-}
diff --git a/supported/q2xatrix b/supported/q2xatrix
deleted file mode 100644
index 65790c1..0000000
--- a/supported/q2xatrix
+++ /dev/null
@@ -1,9 +0,0 @@
-# vim: set ft=sh:
-SHORTNAME="q2xatrix"
-LONGNAME="Quake II Mission Pack: The Reckoning"
-
-. $LIBDIR/via-python
-
-go () {
- gdp_data_driven quake2 -pquake2-xatrix "$@"
-}
diff --git a/supported/quake b/supported/quake
deleted file mode 100644
index 4ec2037..0000000
--- a/supported/quake
+++ /dev/null
@@ -1,6 +0,0 @@
-# vim:set ft=sh:
-
-SHORTNAME=quake
-LONGNAME="Quake (including mission packs)"
-
-. $LIBDIR/via-python
diff --git a/supported/quake2 b/supported/quake2
deleted file mode 100644
index 3ae963c..0000000
--- a/supported/quake2
+++ /dev/null
@@ -1,6 +0,0 @@
-# vim:set ft=sh sw=4 sts=4 et:
-
-SHORTNAME=quake2
-LONGNAME="Quake II"
-
-. $LIBDIR/via-python
diff --git a/supported/quake3 b/supported/quake3
deleted file mode 100644
index 7b41cc0..0000000
--- a/supported/quake3
+++ /dev/null
@@ -1,6 +0,0 @@
-# vim:set ft=sh:
-
-SHORTNAME=quake3
-LONGNAME="Quake III Arena"
-
-. $LIBDIR/via-python
diff --git a/supported/rott b/supported/rott
deleted file mode 100644
index dc196ed..0000000
--- a/supported/rott
+++ /dev/null
@@ -1,4 +0,0 @@
-SHORTNAME=rott
-LONGNAME="Rise of the Triad"
-
-. "$LIBDIR/via-python"
diff --git a/supported/rtcw b/supported/rtcw
deleted file mode 100644
index da80f64..0000000
--- a/supported/rtcw
+++ /dev/null
@@ -1,6 +0,0 @@
-# vim:set ft=sh sw=4 sts=4 et:
-
-SHORTNAME=rtcw
-LONGNAME="Return to Castle Wolfenstein"
-
-. $LIBDIR/via-python
diff --git a/supported/spear-of-destiny b/supported/spear-of-destiny
deleted file mode 100644
index 224d3e4..0000000
--- a/supported/spear-of-destiny
+++ /dev/null
@@ -1,4 +0,0 @@
-SHORTNAME=spear-of-destiny
-LONGNAME="Spear of Destiny (Wolfenstein 3D prequel)"
-
-. "$LIBDIR/via-python"
diff --git a/supported/tnt b/supported/tnt
deleted file mode 100644
index 36b50f8..0000000
--- a/supported/tnt
+++ /dev/null
@@ -1,8 +0,0 @@
-SHORTNAME=tnt
-LONGNAME="Final Doom: TNT: Evilution"
-
-. $LIBDIR/via-python
-
-go () {
- gdp_data_driven final-doom "$@"
-}
diff --git a/supported/tyrian b/supported/tyrian
deleted file mode 100644
index 7275645..0000000
--- a/supported/tyrian
+++ /dev/null
@@ -1,4 +0,0 @@
-SHORTNAME=tyrian
-LONGNAME="Tyrian"
-
-. $LIBDIR/via-python
diff --git a/supported/wolf3d b/supported/wolf3d
deleted file mode 100644
index 80ced53..0000000
--- a/supported/wolf3d
+++ /dev/null
@@ -1,4 +0,0 @@
-SHORTNAME=wolf3d
-LONGNAME="Wolfenstein 3D"
-
-. "$LIBDIR/via-python"
diff --git a/t/verify-md5sum-alternatives.sh b/t/verify-md5sum-alternatives.sh
deleted file mode 100755
index 8dc0b58..0000000
--- a/t/verify-md5sum-alternatives.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-. lib/game-data-packager-shared
-
-echo "foo" > out/foo
-echo "bar" > out/bar
-echo "baz" > out/baz
-
-foosum=`md5sum out/foo | cut -d' ' -f1`
-barsum=`md5sum out/bar | cut -d' ' -f1`
-
-verify_md5sum_alternatives out/foo $foosum,$barsum
-verify_md5sum_alternatives out/bar $foosum,$barsum
-if ( verify_md5sum_alternatives out/baz $foosum,$barsum ); then
- die "out/baz should have failed the md5sum check!"
-else
- echo "^ don't worry, that was meant to fail the md5sum check"
-fi
diff --git a/tests/empty/DEBIAN/control b/tests/empty/DEBIAN/control
deleted file mode 100644
index c4da7aa..0000000
--- a/tests/empty/DEBIAN/control
+++ /dev/null
@@ -1,10 +0,0 @@
-Package: emptypackage
-Section: non-free/games
-Priority: optional
-Architecture: all
-Multi-Arch: foreign
-Installed-Size: 0
-Version: 1
-Maintainer: Debian Games Team <pkg-games-devel at lists.alioth.debian.org>
-Description: an empty .deb file
- used as part of the game-data-packager test harness
diff --git a/tests/lib/die b/tests/lib/die
deleted file mode 100755
index e3f4fe4..0000000
--- a/tests/lib/die
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-set -u
-set -e
-
-[ $# -eq 2 ] || {
- echo "usage: $0 string retcode" >&2
- exit 1
-}
-string="$1"
-retcode="$2"
-
-. ./lib/game-data-packager-shared
-
-die "$string" "$retcode"
diff --git a/tests/lib/require_program b/tests/lib/require_program
deleted file mode 100755
index 16bafa1..0000000
--- a/tests/lib/require_program
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-set -u
-set -e
-
-[ $# -gt 1 ] || {
- echo "usage: $0 program package [ package… ]" >&2
- exit 1
-}
-
-. ./lib/game-data-packager-shared
-
-require_program $@ >/dev/null 2>&1
-exit 0
diff --git a/tests/lib/verify_directory b/tests/lib/verify_directory
deleted file mode 100755
index 1278aed..0000000
--- a/tests/lib/verify_directory
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-set -u
-set -e
-
-[ $# -eq 1 ] || {
- echo "usage: $0 dir" >&2
- exit 1
-}
-dir="$1"
-
-. ./lib/game-data-packager-shared
-
-verify_directory "$dir" >/dev/null 2>&1
-exit 0
diff --git a/tests/lib/verify_file b/tests/lib/verify_file
deleted file mode 100755
index bede4f3..0000000
--- a/tests/lib/verify_file
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-set -u
-set -e
-
-[ $# -eq 1 ] || {
- echo "usage: $0 file" >&2
- exit 1
-}
-file="$1"
-
-. ./lib/game-data-packager-shared
-
-verify_file "$file" >/dev/null 2>&1
-exit 0
diff --git a/tests/lib/verify_md5sum b/tests/lib/verify_md5sum
deleted file mode 100755
index cfc33f6..0000000
--- a/tests/lib/verify_md5sum
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-set -u
-set -e
-
-[ $# -eq 2 ] || {
- echo "usage: $0 testfile md5sum" >&2
- exit 1
-}
-file="$1"
-sum="$2"
-
-. ./lib/game-data-packager-shared
-
-verify_md5sum "$file" "$sum" >/dev/null 2>&1
-exit 0
diff --git a/tests/runtests b/tests/runtests
deleted file mode 100755
index ed76c1e..0000000
--- a/tests/runtests
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/sh
-
-. ./lib/game-data-packager-shared
-
-if [ ! -f /usr/share/shunit2/shunit2 ]; then
- echo "you need to install shunit2 to run tests" >&2
- exit 1
-fi
-
-## verify_file(file)
-## ensures file is a file, or complains on stderr
-## and causes the program to exit.
-test_verify_file_yes() {
- ./tests/lib/verify_file "tests/runtests"
- assertEquals $? 0
-}
-test_verify_file_no() {
- ./tests/lib/verify_file "tests/does_not_exist"
- assertNotEquals $? 0
-}
-
-## verify_directory(dir)
-## ensures dir is a directory, or complains on stderr
-## and causes the program to exit.
-test_verify_dir_yes() {
- ./tests/lib/verify_directory "tests"
- assertEquals $? 0
-}
-test_verify_dir_yes() {
- ./tests/lib/verify_directory "tests/does_not_exist"
- assertNotEquals $? 0
-}
-
-## verify_md5sum(file,sum)
-## calculates the md5sum of file and compares it to sum.
-## if the sum doesn't match, complains on stderr and causes the program
-## to exit.
-test_md5sum_yes() {
- ./tests/lib/verify_md5sum "tests/testfile" "5d41402abc4b2a76b9719d911017c592"
- assertEquals $? 0
-}
-test_md5sum_no() {
- ./tests/lib/verify_md5sum "tests/testfile" "incorrect"
- assertNotEquals $? 0
-}
-
-## die(string,retcode)
-## end the program, complaining with string on stderr
-## and returning retcode if supplied, 2 if not.
-test_die() {
- # XXX: capture stderr and ensure it matches diestring
- ./tests/lib/die "diestring" 6
- assertEquals $? 6
- ./tests/lib/die "diestring" 42
- assertEquals $? 42
-}
-
-test_require_program() {
- ./tests/lib/require_program "sh" dash
- assertEquals $? 0
- ./tests/lib/require_program "does-not-exist" nopackage
- assertEquals $? 2
-}
-
-## slipstream(deb,relpath,file1,file2...)
-## insert file1,file2... into the deb, under the
-## path 'relpath', relative to the package root, e.g.:
-## slipstream(deb, 'usr/share/doc', 'README', 'copyright')
-## => /usr/share/doc/README
-## => /usr/share/doc/copyright
-## prerequisites:
-## * $WORKDIR must be defined to a directory within which
-## slipstream can do it's work (somewhere writeable)
-test_slipstream() {
- debsrc="./tests/empty.deb"
- wd=`mktemp -td game-data-packager.tests.XXXXXX`
- deb="$wd/empty.deb"
- file="`readlink -f tests/testfile`"
-
- cp -p "$debsrc" "$deb"
- WORKDIR="$wd"
- COMPRESS=no
- slipstream "$deb" "foo/bar/baz" "$file"
- dpkg-deb -c "$deb" | grep "/foo/bar/baz/testfile$" >/dev/null
- assertEquals $? 0
-
- rm "$deb"
- rmdir "$wd"
-}
-
-### procedures we are still to write tests for:
-
-## slipstream_permcheck(deb)
-## ensures that the file deb can be written to and
-## that the current working directory is writeable
-## slipstream_unpack(deb)
-## unpacks the deb file into "./slipstream_unpacked"
-## and the control data into "./slipstream_unpacked/DEBIAN"
-## slipstream_file(file,destpath)
-## copies the file into "./slipstream_unpacked/$destpath",
-## calculates the files md5sum and adds it to the md5sums
-## file in the control area.
-## slipstream_instsize
-## calculates the installed size of the deb, (based on
-## the contents of the ./slipstream_unpacked directory)
-## and writes the result to the control file in the
-## control area.
-## slipstream_repack(deb)
-## writes a new debian package over deb, packing
-## the files from ./slipstream_unpacked inside,
-## using the control area in ./slipstream_unpacked/DEBIAN
-## slipstream_cleanup()
-## removes the ./slipstream_unpacked directory.
-## install_deb(deb)
-## uses sudo and dpkg to install the supplied .deb file
-## unravel(path)
-## convert 'path' from relative to absolute
-## if it does not begin with a slash.
-
-. /usr/share/shunit2/shunit2
diff --git a/tests/testfile b/tests/testfile
deleted file mode 100644
index b6fc4c6..0000000
--- a/tests/testfile
+++ /dev/null
@@ -1 +0,0 @@
-hello
\ No newline at end of file
--
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