[game-data-packager] 01/11: conversion of wolf3-demo-data to yaml

Simon McVittie smcv at debian.org
Mon Jan 12 23:37:03 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 8a58a41bde24c22ba6225c3b5700c3daafa120c7
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Mon Jan 12 10:56:25 2015 +0100

    conversion of wolf3-demo-data to yaml
---
 Makefile                                           |   2 -
 .../control.in => data/wolf3d-demo-data.control.in |   4 +-
 .../copyright => data/wolf3d-demo-data.copyright   |   2 +-
 data/wolf3d.yaml                                   |  96 ++++++++++++++++
 lib/game_data_packager/__init__.py                 |  12 ++
 lib/game_data_packager/games/wolf3d.py             |  33 ++++++
 supported/wolf3d                                   | 128 +--------------------
 wolf3d-data/README.Debian                          |   4 -
 wolf3d.mk                                          |  35 ------
 9 files changed, 146 insertions(+), 170 deletions(-)

diff --git a/Makefile b/Makefile
index 92d1938..3539aeb 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,6 @@ default: $(DIRS)
 	make -f quake2.mk VERSION=$(VERSION) PACKAGE=quake2-music
 	make -f quake2.mk VERSION=$(VERSION) PACKAGE=quake2-xatrix
 	make -f quake2.mk VERSION=$(VERSION) PACKAGE=quake2-rogue
-	make -f wolf3d.mk VERSION=$(VERSION)
 	make -f lgeneral.mk LONG="LGeneral" VERSION=$(VERSION)
 
 $(DIRS):
@@ -76,7 +75,6 @@ clean:
 	make -f quake2.mk VERSION=$(VERSION) PACKAGE=quake2-music clean
 	make -f quake2.mk VERSION=$(VERSION) PACKAGE=quake2-xatrix clean
 	make -f quake2.mk VERSION=$(VERSION) PACKAGE=quake2-rogue clean
-	make -f wolf3d.mk VERSION=$(VERSION) clean
 	make -f lgeneral.mk LONG="LGeneral" VERSION=$(VERSION) clean
 	for d in $(DIRS); do [ ! -d "$$d" ]  || rmdir "$$d"; done
 
diff --git a/wolf3d-data/control.in b/data/wolf3d-demo-data.control.in
similarity index 85%
rename from wolf3d-data/control.in
rename to data/wolf3d-demo-data.control.in
index 2514367..1cc5a96 100644
--- a/wolf3d-data/control.in
+++ b/data/wolf3d-demo-data.control.in
@@ -1,5 +1,7 @@
-Package: wolf3d-data-SUFFIX
+Package: wolf3d-demo-data
 Provides: wolf3d-data
+Conflicts: wolf3d-data-wl1
+Replaces: wolf3d-data-wl1
 Section: non-free/games
 Priority: optional
 Architecture: all
diff --git a/wolf3d-data/copyright b/data/wolf3d-demo-data.copyright
similarity index 93%
rename from wolf3d-data/copyright
rename to data/wolf3d-demo-data.copyright
index 04badb5..2fcd8fb 100644
--- a/wolf3d-data/copyright
+++ b/data/wolf3d-demo-data.copyright
@@ -2,7 +2,7 @@ The wolf3d-data package was generated using game-data-packager.
 Copyright © 2008-2013 Jonathan Dowland <jmtd at debian.org>.
 
 The files within "/usr/share/games/wolf3d" are subject to the copyright
-described in /usr/share/doc/wolf3d-data/vendor.doc.
+described in /usr/share/doc/wolf3d-demo-data/vendor.doc.
 
 The remainder of this package is covered by the following
 Licence:
diff --git a/data/wolf3d.yaml b/data/wolf3d.yaml
new file mode 100644
index 0000000..7033847
--- /dev/null
+++ b/data/wolf3d.yaml
@@ -0,0 +1,96 @@
+%YAML 1.2
+---
+
+packages:
+  wolf3d-demo-data:
+    type: full
+    longname: Wolfenstein 3D
+    steam_path: Wolfenstein 3D
+    install_to: usr/share/games/wolf3d
+    install_files_from_cksums: |
+      2707522358 1156   audiohed.wl1
+      3282605936 132613 audiot.wl1
+      1349328142 27425  gamemaps.wl1
+      3655120917 402    maphead.wl1
+      202991744  7641   vendor.doc
+      3984709669 1024   vgadict.wl1
+      1729266021 326568 vgagraph.wl1
+      3936285452 471    vgahead.wl1
+      4022822569 742912 vswap.wl1
+    symlinks:
+      usr/share/doc/wolf3d-demo-data/vendor.doc:
+        usr/share/games/wolf3d/vendor.doc
+
+files:
+  1wolf14.zip:
+    size: 856401
+    download:
+      alioth-mirrors:
+        path: .
+    provides:
+    - W3DSW14.SHR
+    md5: a29432cd4a5184d552d8e5da8f80a531
+    sha1: a4553d7ec4216061b9486c40be90b066862ea8e0
+    sha256: cb2a2ef7ecef14152c65ff93cc3b84fbd3e8eb0c5c1de41a6fc8cdef559451a8
+    unpack:
+      format: zip
+
+  W3DSW14.SHR:
+    size: 790409
+    provides:
+    - audiohed.wl1
+    - audiot.wl1
+    - gamemaps.wl1
+    - maphead.wl1
+    - vendor.doc
+    - vgadict.wl1
+    - vgagraph.wl1
+    - vgahead.wl1
+    - vswap.wl1
+    md5: 229402f7d893b91beb15c8794f2d6fdf
+    sha1: 6ef108e303bfb8c12b4c5b924a118b54d26cf922
+    sha256: 77ed56ae06ef28c01cf2f26e1199d63ee9dd5852087086d02198319c369aadb1
+    unpack:
+      format: id-shr-extract
+      unpack:
+      - audiohed.wl1
+      - audiot.wl1
+      - gamemaps.wl1
+      - maphead.wl1
+      - vendor.doc
+      - vgadict.wl1
+      - vgagraph.wl1
+      - vgahead.wl1
+      - vswap.wl1
+
+md5sums: |
+  58aa1b9892d5adfa725fab343d9446f8  audiohed.wl1
+  4b6109e957b584e4ad7f376961f3887e  audiot.wl1
+  30fecd7cce6bc70402651ec922d2da3d  gamemaps.wl1
+  7b6dd4e55c33c33a41d1600be5df3228  maphead.wl1
+  eccc7fc421f3d1f00e6eabd6848637f6  vendor.doc
+  76a6128f3c0dd9b77939ce8313992746  vgadict.wl1
+  74decb641b1a4faed173e10ab744bff0  vgagraph.wl1
+  61bf1616e78367853c91f2c04e2c1cb7  vgahead.wl1
+  6efa079414b817c97db779cecfb081c9  vswap.wl1
+sha1sums: |
+  732460795d77cab19c8018d879f5c27a3cbd5f84  audiohed.wl1
+  0254cc09b7a8ab0b884766b5dcd0e8555c424937  audiot.wl1
+  d49fc8a7887d7e73be7c813177307b68206f8147  gamemaps.wl1
+  b3942ddb4f6bb671b026a3f85611bf314acefce7  maphead.wl1
+  6b066ff8a8ae6537f97b4b0af7e11c8c326ca995  vendor.doc
+  10ae325f5ce124d2536a63805023c56a4e438ea1  vgadict.wl1
+  3ad077aca0e775bd6a241515c8b2874d4fa4099a  vgagraph.wl1
+  a9ba5551f54f88d810b9aa82a15caae623509a4c  vgahead.wl1
+  63134a2e3165b5291ece7b8a4145d2bd67d4f787  vswap.wl1
+sha256sums: |
+  39351624ae6f8eef4b873e060c1a6f3e5ee7e81c4939c485275a89b145336338  audiohed.wl1
+  1e2c9ae30398a14c61a4ddd39aabaa0dbcc984cc4924a3e51df75574c259cfb9  audiot.wl1
+  a6a6654b342f2c027bcb22bfce0a41f9fc0063b775e9e4da0c771970e53e11aa  gamemaps.wl1
+  3458f661c9b875bca99ea22a7267771fad8f2a33c699ea732cf7c3322909bf8c  maphead.wl1
+  fc1f4c23122702198eaa0df09a12af135801bdc835317638f2b895e948a33710  vendor.doc
+  59878fec65f033b00dbb1240317d1793f5858213dc8013b4d68f9ac8b45b0c80  vgadict.wl1
+  d5176f843c53415132db199c19f38591eaf3cedd35a4f7eb2698c1865d83030d  vgagraph.wl1
+  f4cc800dc8444373092d4eaa5d6ab59d63d23a510a9d38b73ca9b3dbb700d18b  vgahead.wl1
+  698f217257e2cbb951a4d110ba09140291f38d0121b3784d1d6be59c03a6b47b  vswap.wl1
+...
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 50ff6f9..cdc71b0 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -924,6 +924,18 @@ class GameData(object):
                             cwd=tmpdir)
                     for f in provider.unpack['unpack']:
                         self.consider_file(os.path.join(tmpdir, f), True)
+                elif fmt == 'id-shr-extract':
+                    logger.debug('Extracting %r from %s',
+                            provider.unpack['unpack'], found_name)
+                    tmpdir = os.path.join(self.get_workdir(), 'tmp',
+                            provider_name + '.d')
+                    mkdir_p(tmpdir)
+                    subprocess.check_call(['id-shr-extract',
+                                os.path.abspath(found_name)],
+                            cwd=tmpdir)
+                    for f in provider.unpack['unpack']:
+                        self.consider_file(os.path.join(tmpdir, f), True)
+
 
             elif providable:
                 # we don't have it, but we can get it
diff --git a/lib/game_data_packager/games/wolf3d.py b/lib/game_data_packager/games/wolf3d.py
new file mode 100644
index 0000000..83f061c
--- /dev/null
+++ b/lib/game_data_packager/games/wolf3d.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python3
+# vim:set fenc=utf-8:
+#
+# Copyright © 2014 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
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# 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 logging
+
+from .. import GameData
+
+logger = logging.getLogger('game-data-packager.games.wolf3d')
+
+class Wolf3DGameData(GameData):
+    def add_parser(self, parsers):
+        parser = super(Wolf3DGameData, self).add_parser(parsers)
+        parser.add_argument('-f', action='append', dest='paths',
+                metavar='1wolf14.zip', help='Path to 1wolf14.zip')
+        parser.add_argument('-w', dest='download', action='store_true',
+                help='Download 1wolf14.zip (done automatically if necessary)')
+        return parser
+
+GAME_DATA_SUBCLASS = Wolf3DGameData
diff --git a/supported/wolf3d b/supported/wolf3d
index 28b8eab..80ced53 100644
--- a/supported/wolf3d
+++ b/supported/wolf3d
@@ -1,130 +1,4 @@
 SHORTNAME=wolf3d
 LONGNAME="Wolfenstein 3D"
 
-ZIPSUM=a29432cd4a5184d552d8e5da8f80a531
-
-wolf3d_usage() {
-	echo "game-data-packager ${SHORTNAME} arguments:"
-	printf "\tgame-data-packager ${SHORTNAME} [ -f path ] | [ -w ]
-\t\t-f path\t\tpath to your existing copy of 1wolf14.zip\n\
-\t\t-w\t\tfetch 1wolf14.zip from the World Wide Web\n"
-}
-
-verify_args() {
-    case $# in
-        0)
-            wolf3d_usage
-            exit 0
-            ;;
-        1)
-            if [ "$1" != "-w" ]; then
-                    usage >&2
-                    wolf3d_usage >&2
-                    exit 1
-            fi
-            downloadzip
-            ;;
-        2)
-            if [ "$1" != "-f" ]; then
-                usage >&2
-                wolf3d_usage >&2
-                exit 1
-            fi
-            downloaded=false
-            wolf3dzip="$2"
-            ;;
-        *)
-            usage >&2
-            wolf3d_usage >&2
-            exit 1
-            ;;
-    esac
-}
-
-wolf3dmirrors=$LIBDIR/wolf3d-mirrors
-
-downloadzip() {
-    dest="$WORKDIR/1wolf14.zip"
-    mirror=$(grep -v ^# "$wolf3dmirrors" | sort -R | head -n1)
-    for try in $mirror; do
-        if wget --progress=dot --directory-prefix "$WORKDIR" -c "$try"
-        then
-            wolf3dzip="$dest"
-            downloaded=true
-            return
-        fi
-    done
-    die "error: could not find 1wolf14.zip at our chosen mirror"
-}
-
-checksum() {
-	CHECKSUM=`md5sum "$1" | cut -d' ' -f1`
-	debug "checksum = $CHECKSUM"
-}
-
-SUFFIX=wl1
-DEBBASE="wolf3d-data-${SUFFIX}_${GAME_PACKAGE_VERSION}_all.deb"
-DEB="$DATADIR/$DEBBASE"
-
-go() {
-	require_program id-shr-extract dynamite
-	verify_args "$@"
-	ZIPFILE=`unravel "$wolf3dzip"`
-    [ -e "$ZIPFILE" ] || die "ERROR: '$ZIPFILE' does not exist."
-    [ -f "$ZIPFILE" ] || die "ERROR: '$ZIPFILE' is not a file."
-    [ -r "$ZIPFILE" ] || die "ERROR: '$ZIPFILE' cannot be read."
-	checksum "$ZIPFILE"
-	if [ "$CHECKSUM" != "$ZIPSUM" ]; then
-		echo "warning: checksum is not what we expected" >&2
-	fi
-
-    OUTFILE=`unravel "$OUTDIR"`"/$DEBBASE"
-	cp -p "$DEB" "$OUTFILE"
-
-	oldpwd=`pwd`
-	cd "$WORKDIR"
-
-    gdp_unzip "$ZIPFILE" W3DSW14.SHR
-    id-shr-extract W3DSW14.SHR >/dev/null
-    rm order.frm  w3dhelp.exe  W3DSW14.SHR  wolf3d.exe
-
-	wlfiles="
-		audiohed.wl1:58aa1b9892d5adfa725fab343d9446f8
-		audiot.wl1:4b6109e957b584e4ad7f376961f3887e
-		gamemaps.wl1:30fecd7cce6bc70402651ec922d2da3d
-		maphead.wl1:7b6dd4e55c33c33a41d1600be5df3228
-		vgadict.wl1:76a6128f3c0dd9b77939ce8313992746
-		vgagraph.wl1:74decb641b1a4faed173e10ab744bff0
-		vgahead.wl1:61bf1616e78367853c91f2c04e2c1cb7
-		vswap.wl1:6efa079414b817c97db779cecfb081c9
-		vendor.doc:eccc7fc421f3d1f00e6eabd6848637f6
-
-	"
-
-    # XXX: we have to re-implement most of slipstream() here, due
-    # to the way we use it
-    slipstream_permcheck "$OUTFILE"
-    slipstream_unpack "$OUTFILE"
-    for fc in $wlfiles; do
-        # XXX: files are treated as being relative to $WORKDIR, hence
-        # unpacking straight into it. Might be nicer to tidy away the
-        # unpack into a subdir (no risk of stamping over another part
-        # of g-d-p's operation) and specify full paths
-		file=$(echo "$fc" | cut -d: -f1)
-		checksum "$file"
-		if [ "$CHECKSUM" != $(echo "$fc" | cut -d: -f2) ]; then
-				echo "warning: checksum is not what we expected for $file" >&2
-		fi
-        slipstream_file "$file" "usr/share/games/wolf3d/$file"
-		rm "$file"
-    done
-    slipstream_instsize
-    slipstream_repack "$OUTFILE"
-    slipstream_cleanup
-
-    if [ "$downloaded" = "true" ]; then
-        rm "$ZIPFILE"
-    fi
-
-	cd "$oldpwd"
-}
+. "$LIBDIR/via-python"
diff --git a/wolf3d-data/README.Debian b/wolf3d-data/README.Debian
deleted file mode 100644
index 4e93a36..0000000
--- a/wolf3d-data/README.Debian
+++ /dev/null
@@ -1,4 +0,0 @@
-This package was generated by the game-data-packager program, to facilitate
-installation of the Wolfenstein 3D (wolf3d) data files into a Debian system.
-
- -- Jon Dowland <jmtd at debian.org>, Wed, 16 Dec 2009 16:37:22 +0000
diff --git a/wolf3d.mk b/wolf3d.mk
deleted file mode 100644
index ff48795..0000000
--- a/wolf3d.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-BASICFILES = usr/share/doc/wolf3d-data/README.Debian \
-usr/share/doc/wolf3d-data/copyright
-DESTFILES = $(addprefix build/wolf3d-data/, $(BASICFILES))
-
-# VERSION is defined by the parent make
-SUFFIX = wl1
-out/wolf3d-data-$(SUFFIX)_$(VERSION)_all.deb: build/wolf3d-data/DEBIAN/control $(DESTFILES)
-		fakeroot dpkg-deb -b build/wolf3d-data $@
-
-DIRS = build/wolf3d-data \
-build/wolf3d-data/DEBIAN \
-build/wolf3d-data/usr \
-build/wolf3d-data/usr/share \
-build/wolf3d-data/usr/share/games \
-build/wolf3d-data/usr/share/games/wolf3d \
-build/wolf3d-data/usr/share/doc \
-build/wolf3d-data/usr/share/doc/wolf3d-data
-
-$(DIRS):
-	mkdir $@
-
-$(DESTFILES): $(DIRS)
-	cp -p wolf3d-data/`basename "$@"` $@
-
-build/wolf3d-data/DEBIAN/control: wolf3d-data/control.in $(DIRS)
-	m4 -DPACKAGE=wolf3d-data -DVERSION=$(VERSION) -DSUFFIX=wl1 $< > $@ 
-
-clean:
-	rm -f build/wolf3d-data/DEBIAN/control out/wolf3d-data-$(SUFFIX)_$(VERSION)_all.deb \
-		build/wolf3d-data/usr/share/doc/wolf3d-data/copyright \
-		build/wolf3d-data/usr/share/doc/wolf3d-data/README.Debian
-	for d in $(DIRS); do echo "$$d"; done | sort -r | while read d; do \
-		[ ! -d "$$d" ] || rmdir "$$d"; done
-
-.PHONY: clean $(DESTFILES)

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