[game-data-packager] 16/21: Convert Quake II mission packs to Python/YAML (Closes: #775082)

Simon McVittie smcv at debian.org
Thu Jan 22 01:10:47 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 13058f3093f9714c731493a5b0c8af194142d88c
Author: Simon McVittie <smcv at debian.org>
Date:   Thu Jan 22 00:35:12 2015 +0000

    Convert Quake II mission packs to Python/YAML (Closes: #775082)
---
 data/quake2-demo-data.control.in       |  9 -----
 data/quake2-full-data.control.in       | 12 ------
 data/quake2-music.control.in           |  8 ----
 data/quake2-rogue.control.in           |  7 ----
 data/quake2-xatrix.control.in          |  7 ----
 data/quake2.yaml                       |  2 +
 lib/game_data_packager/games/quake2.py | 61 ++++++++++++++++++++++++++++++
 supported/q2rogue                      | 65 ++------------------------------
 supported/q2xatrix                     | 68 ++--------------------------------
 9 files changed, 69 insertions(+), 170 deletions(-)

diff --git a/data/quake2-demo-data.control.in b/data/quake2-demo-data.control.in
index 1cee25c..2341514 100644
--- a/data/quake2-demo-data.control.in
+++ b/data/quake2-demo-data.control.in
@@ -1,12 +1,3 @@
-Package: quake2-demo-data
-Version: VERSION
-Section: non-free/games
-Priority: optional
-Architecture: all
-Multi-Arch: foreign
-Recommends: quake2 | quake2-server
-Installed-Size: 500000
-Maintainer: Debian Games Team <pkg-games-devel at lists.alioth.debian.org>
 Description: Quake II demo data files
  Quake II requires an engine and game data to play. This package contains
  the data from the demo version of id Software's game "Quake II", and was
diff --git a/data/quake2-full-data.control.in b/data/quake2-full-data.control.in
index 52cfe50..86ab34d 100644
--- a/data/quake2-full-data.control.in
+++ b/data/quake2-full-data.control.in
@@ -1,15 +1,3 @@
-Package: quake2-full-data
-Version: VERSION
-Section: non-free/games
-Priority: optional
-Architecture: all
-Multi-Arch: foreign
-Recommends: quake2 | quake2-server
-Provides: quake2-data
-Conflicts: quake2-data
-Replaces: quake2-data
-Installed-Size: 500000
-Maintainer: Debian Games Team <pkg-games-devel at lists.alioth.debian.org>
 Description: Quake II data files
  Quake II requires an engine and game data to play. This package contains
  the data from the full version of id Software's game "Quake II", and was
diff --git a/data/quake2-music.control.in b/data/quake2-music.control.in
index 37cbc1b..719672a 100644
--- a/data/quake2-music.control.in
+++ b/data/quake2-music.control.in
@@ -1,11 +1,3 @@
-Package: quake2-music
-Version: VERSION
-Section: non-free/games
-Priority: optional
-Architecture: all
-Multi-Arch: foreign
-Installed-Size: 500000
-Maintainer: Debian Games Team <pkg-games-devel at lists.alioth.debian.org>
 Description: Quake II soundtrack
  This package contains the Quake II soundtrack by Sonic Mayhem, Jer Sypult
  and Bill Brown, copied from the CD-ROM and encoded in Ogg Vorbis.
diff --git a/data/quake2-rogue.control.in b/data/quake2-rogue.control.in
index 2a9e8bb..12d7850 100644
--- a/data/quake2-rogue.control.in
+++ b/data/quake2-rogue.control.in
@@ -1,10 +1,3 @@
-Package: quake2-rogue
-Version: VERSION
-Section: non-free/games
-Priority: optional
-Recommends: quake2 | quake2-server
-Installed-Size: 500000
-Maintainer: Debian Games Team <pkg-games-devel at lists.alioth.debian.org>
 Description: Quake II: Ground Zero data files
  Quake II: Ground Zero is a Mission Pack for Quake II created by Rogue
  Entertainment. This package was generated using the "game-data-packager"
diff --git a/data/quake2-xatrix.control.in b/data/quake2-xatrix.control.in
index f280ae0..d9cb9a3 100644
--- a/data/quake2-xatrix.control.in
+++ b/data/quake2-xatrix.control.in
@@ -1,10 +1,3 @@
-Package: quake2-xatrix
-Version: VERSION
-Section: non-free/games
-Priority: optional
-Recommends: quake2 | quake2-server
-Installed-Size: 500000
-Maintainer: Debian Games Team <pkg-games-devel at lists.alioth.debian.org>
 Description: Quake II: The Reckoning data files
  Quake II: The Reckoning is a Mission Pack for Quake II created by Xatrix
  Entertainment. This package was generated using the "game-data-packager"
diff --git a/data/quake2.yaml b/data/quake2.yaml
index 5d7d651..3a75ea5 100644
--- a/data/quake2.yaml
+++ b/data/quake2.yaml
@@ -1073,6 +1073,7 @@ files:
     - data_release.txt
 
   quake2-xatrix-2.01.tar.xz:
+    download: http://deponie.yamagi.org/quake2/quake2-xatrix-2.01.tar.xz
     unpack:
       format: tar.xz
     provides:
@@ -1081,6 +1082,7 @@ files:
     - quake2-xatrix-2.01/README
 
   quake2-rogue-2.00.tar.xz:
+    download: http://deponie.yamagi.org/quake2/quake2-rogue-2.00.tar.xz
     unpack:
       format: tar.xz
     provides:
diff --git a/lib/game_data_packager/games/quake2.py b/lib/game_data_packager/games/quake2.py
new file mode 100644
index 0000000..dc449c0
--- /dev/null
+++ b/lib/game_data_packager/games/quake2.py
@@ -0,0 +1,61 @@
+#!/usr/bin/python3
+# vim:set fenc=utf-8:
+#
+# Copyright © 2015 Simon McVittie <smcv at debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 2
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# You can find the GPL license text on a Debian system under
+# /usr/share/common-licenses/GPL-2.
+
+import glob
+import logging
+import os
+import subprocess
+import tarfile
+
+from .. import (GameData)
+
+logger = logging.getLogger('game-data-packager.games.quake2')
+
+class Quake2GameData(GameData):
+
+    def fill_dest_dir(self, package, destdir):
+        if not super(Quake2GameData, self).fill_dest_dir(package, destdir):
+            return False
+
+        if package.name not in ('quake2-rogue', 'quake2-xatrix'):
+            return True
+
+        subdir = {
+            'quake2-rogue': 'rogue',
+            'quake2-xatrix': 'xatrix',
+        }[package.name]
+
+        installdir = os.path.join(destdir, 'usr', 'share', 'games', 'quake2')
+        unpackdir = os.path.join(self.get_workdir(), 'tmp',
+                package.name + '.build.d')
+
+        tars = list(glob.glob(os.path.join(installdir, '*.tar.xz')))
+        assert len(tars) == 1, tars
+        expect_dir = os.path.basename(tars[0])
+        expect_dir = expect_dir[:len(expect_dir) - 7]
+
+        with tarfile.open(tars[0], mode='r:xz') as tar:
+            tar.extractall(unpackdir)
+
+        subprocess.check_call(['make', '-C',
+            os.path.join(unpackdir, expect_dir), '-s', '-j5'])
+        subprocess.check_call(['install', '-s', '-m644',
+            os.path.join(unpackdir, expect_dir, 'release', 'game.so'),
+            os.path.join(installdir, subdir, 'game.so')])
+
+        return True
+
+GAME_DATA_SUBCLASS = Quake2GameData
diff --git a/supported/q2rogue b/supported/q2rogue
index dceb81a..b84fbc1 100644
--- a/supported/q2rogue
+++ b/supported/q2rogue
@@ -1,68 +1,9 @@
 # vim: set ft=sh:
 SHORTNAME=q2rogue
 LONGNAME="Quake II Mission Pack: Ground Zero"
-pak0sum=5e2ecbe9287152a1e6e0d77b3f47dcb2 # steam as of ~Oct 2013
-url=http://deponie.yamagi.org/quake2/quake2-rogue-2.00.tar.xz
-sum=9b058f2821fddf8776561ab245cfff85
 
-. $LIBDIR/q2mp-common
+. $LIBDIR/via-python
 
-go() {
-  q2mp_prereqs
-  checksum="true"
-  xpath=""
-  q2mp_process_opts "$@"
-
-  if [ -z "$xpath" ]; then
-    xpath="$WORKDIR/$SHORTNAME.tar.xz"
-    wget -O "$xpath" "$url"
-  fi
-  if [ "$checksum" = "true" ]; then
-    verify_md5sum "$xpath" "$sum"
-  fi
-  q2mp_build_gameso "$xpath"
-
-  verify_directory "$root"
-  verify_directory "$root/rogue"
-  verify_file      "$root/rogue/pak0.pak"
-  for i in logo rend reu1_ reu2_ reu3_ reu4_ rintro; do
-    verify_file "$root/rogue/video/$i.cin"
-  done
-
-  # slipstream_instsize, slipstream_repack assume this naming
-  DESTDIR="$WORKDIR/slipstream.unpacked"
-
-  mkdir -p "$DESTDIR/DEBIAN" "$DESTDIR/usr/share/doc/quake2-rogue" \
-    "$DESTDIR/usr/share/games/quake2/rogue/video"
-
-  # the source code component
-  mv "$WORKDIR/$SHORTNAME/release/game.so" "$DESTDIR/usr/share/games/quake2/rogue"
-  mv "$WORKDIR/$SHORTNAME/LICENSE" "$DESTDIR/usr/share/doc/quake2-rogue/LICENSE"
-  rm -rf "$WORKDIR/$SHORTNAME"
-  if [ -f "$WORKDIR/$SHORTNAME.tar.xz" ]; then
-    rm -f "$WORKDIR/$SHORTNAME.tar.xz"
-  fi
-
-  # the data components
-  cp -p "$root/rogue/pak0.pak" "$DESTDIR/usr/share/games/quake2/rogue"
-
-  for i in logo rend reu1_ reu2_ reu3_ reu4_ rintro; do
-    cp -p "$root/rogue/video/$i.cin" "$DESTDIR/usr/share/games/quake2/rogue/video"
-  done
-
-  ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
-  echo "Architecture: $ARCH" > "$DESTDIR/DEBIAN/control"
-  cat "$DATADIR/quake2/quake2-rogue.control" >> "$DESTDIR/DEBIAN/control"
-  cp -p "$DATADIR/quake2-rogue.copyright" "$DESTDIR/usr/share/doc/quake2-rogue/copyright"
-  
-  if [ "" = "$OUTDIR" ]; then
-      OUTFILE="$WORKDIR/out.deb"
-  else
-      OUTFILE=`unravel "$OUTDIR"`"/quake2-rogue_${GAME_PACKAGE_VERSION}_${ARCH}.deb"
-  fi
-
-  debug "building .deb: $OUTFILE"
-  ( cd "$WORKDIR" && slipstream_instsize )
-  ( cd "$WORKDIR" && slipstream_repack "$OUTFILE" )
-  rm -rf "$DESTDIR"
+go () {
+    gdp_data_driven quake2 -pquake2-rogue "$@"
 }
diff --git a/supported/q2xatrix b/supported/q2xatrix
index bf0c1cd..65790c1 100644
--- a/supported/q2xatrix
+++ b/supported/q2xatrix
@@ -2,70 +2,8 @@
 SHORTNAME="q2xatrix"
 LONGNAME="Quake II Mission Pack: The Reckoning"
 
-pak0sum=5e2ecbe9287152a1e6e0d77b3f47dcb2 # steam as of ~Oct 2013
-url=http://deponie.yamagi.org/quake2/quake2-xatrix-2.01.tar.xz
-sum=d8b43978c196bd426acde0efef870ebb
+. $LIBDIR/via-python
 
-. $LIBDIR/q2mp-common
-
-go() {
-
-  q2mp_prereqs
-
-  checksum="true"
-  xpath=""
-  q2mp_process_opts "$@"
-
-  if [ -z "$xpath" ]; then
-    xpath="$WORKDIR/$SHORTNAME.tar.xz"
-    wget -O "$xpath" "$url"
-  fi
-  if [ "$checksum" = "true" ]; then
-    verify_md5sum "$xpath" "$sum"
-  fi
-  q2mp_build_gameso "$xpath"
-
-  verify_directory "$root"
-  verify_directory "$root/xatrix"
-  verify_file      "$root/xatrix/pak0.pak"
-  for i in idlog logo xin xout xu1 xu2 xu3 xu4; do
-    verify_file "$root/xatrix/video/$i.cin"
-  done
-
-  # slipstream_instsize, slipstream_repack assume this naming
-  DESTDIR="$WORKDIR/slipstream.unpacked"
-
-  mkdir -p "$DESTDIR/DEBIAN" "$DESTDIR/usr/share/doc/quake2-xatrix" \
-    "$DESTDIR/usr/share/games/quake2/xatrix/video"
-
-  # the source code component
-  mv "$WORKDIR/$SHORTNAME/release/game.so" "$DESTDIR/usr/share/games/quake2/xatrix"
-  mv "$WORKDIR/$SHORTNAME/LICENSE" "$DESTDIR/usr/share/doc/quake2-xatrix/LICENSE"
-  rm -rf "$WORKDIR/$SHORTNAME"
-  if [ -f "$WORKDIR/$SHORTNAME.tar.xz" ]; then
-    rm -f "$WORKDIR/$SHORTNAME.tar.xz"
-  fi
-
-  # the data components
-  cp -p "$root/xatrix/pak0.pak" "$DESTDIR/usr/share/games/quake2/xatrix"
-
-  for i in idlog logo xin xout xu1 xu2 xu3 xu4; do
-    cp -p "$root/xatrix/video/$i.cin" "$DESTDIR/usr/share/games/quake2/xatrix/video"
-  done
-
-  ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
-  echo "Architecture: $ARCH" > "$DESTDIR/DEBIAN/control"
-  cat "$DATADIR/quake2/quake2-xatrix.control" >> "$DESTDIR/DEBIAN/control"
-  cp -p "$DATADIR/quake2-xatrix.copyright" "$DESTDIR/usr/share/doc/quake2-xatrix/copyright"
-  
-  if [ "" = "$OUTDIR" ]; then
-      OUTFILE="$WORKDIR/out.deb"
-  else
-      OUTFILE=`unravel "$OUTDIR"`"/quake2-xatrix_${GAME_PACKAGE_VERSION}_${ARCH}.deb"
-  fi
-
-  debug "building .deb: $OUTFILE"
-  ( cd "$WORKDIR" && slipstream_instsize )
-  ( cd "$WORKDIR" && slipstream_repack "$OUTFILE" )
-  rm -rf "$DESTDIR"
+go () {
+    gdp_data_driven quake2 -pquake2-xatrix "$@"
 }

-- 
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