[game-data-packager] 01/01: Steam: implement package building & installation

Alexandre Detiste detiste-guest at moszumanska.debian.org
Tue Sep 8 19:48:04 UTC 2015


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit 23179ec2ee4da092c13de8d9e3531769f5d59fc5
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Tue Sep 8 21:46:51 2015 +0200

    Steam: implement package building & installation
    
    'su apt-get install *.deb' got called once for all at the end
---
 doc/game-data-packager.6       | 30 ++++++++++++++++++++
 game_data_packager/__init__.py | 62 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/doc/game-data-packager.6 b/doc/game-data-packager.6
index c3c4e76..efda91e 100644
--- a/doc/game-data-packager.6
+++ b/doc/game-data-packager.6
@@ -76,6 +76,36 @@ The game being packaged. Running
 without arguments will display a list of valid games. Running
 .B game\-data\-packager game \-\-help
 will display a list of valid options for that game.
+
+.SH ALTERNATIVE MODES
+.B game\-data\-packager steam
+[
+.I \-i
+]
+[
+.I \-d
+out-directory [
+.I \-n
+] ]
+[
+.I \-z | --no\-compress
+] [
+.I --new
+|
+.I --all
+]
+.br
+will package all your Steam game at once.
+.br
+Most games can only be downloaded with Windows Steam
+running optionally through Wine.
+.TP
+.B --new
+only package new games
+.TP
+.B --all
+package all games available
+
 .SH ENVIRONMENT VARIABLES
 .TP
 .B LANGUAGE, LANG
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 054d875..118036d 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -2665,8 +2665,11 @@ class GameData(object):
 
         return self._architecture
 
-    def prepare_packages(self, packages, build_demos=False, download=True,
+    def prepare_packages(self, packages=None, build_demos=False, download=True,
             log_immediately=True):
+        if packages is None:
+            packages = self.packages.values()
+
         possible = set()
 
         if self.cd_device is not None:
@@ -3133,6 +3136,63 @@ def run_steam_meta_mode(parsed, games):
             print('\n'.join(p['paths']))
         print()
 
+    if not parsed.new and not parsed.all:
+       logger.info('Please specify --all or --new to create desired packages.')
+       return
+
+    preserve_debs = (getattr(parsed, 'destination', None) is not None)
+    install_debs = getattr(parsed, 'install', True)
+    if getattr(parsed, 'compress', None) is None:
+        # default to not compressing if we aren't going to install it
+        # anyway
+        parsed.compress = preserve_debs
+
+    found_games = ['duke3d']
+
+    all_debs = set()
+
+    for shortname in sorted(found_games):
+        game = games[shortname]
+        game.verbose = getattr(parsed, 'verbose', False)
+        game.save_downloads = parsed.save_downloads
+        game.look_for_files()
+        try:
+            ready = game.prepare_packages(log_immediately=False)
+        except NoPackagesPossible:
+            logger.error('No package possible for %s.' % game.shortname)
+            continue
+        except DownloadsFailed:
+            logger.error('Unable to complete any packages of %s'
+                         ' because downloads failed.' % game.shortname)
+            continue
+
+        if parsed.destination is None:
+            destination = workdir = tempfile.mkdtemp(prefix='gdptmp.')
+        else:
+            workdir = None
+            destination = parsed.destination
+
+        debs = game.build_packages(ready,
+                compress=getattr(parsed, 'compress', True),
+                destination=destination)
+        rm_rf(os.path.join(game.get_workdir(), 'tmp'))
+
+        if preserve_debs:
+            for deb in debs:
+                print('generated "%s"' % os.path.abspath(deb))
+        all_debs = all_debs.union(debs)
+
+    if not all_debs:
+        logger.error('Unable to package any game.')
+        if workdir:
+           rm_rf(workdir)
+        raise SystemExit(1)
+
+    if install_debs:
+        GameData.install_packages(games, all_debs)
+    if workdir:
+        rm_rf(workdir)
+
 def run_command_line():
     logger.debug('Arguments: %r', sys.argv)
 

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