[game-data-packager] 01/01: GoG: add a tool to detect outdated package
Alexandre Detiste
detiste-guest at moszumanska.debian.org
Fri Mar 17 23:56:56 UTC 2017
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 7602e05f47aebb2c7880498381b7ff1658dfcd81
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Sat Mar 18 00:54:38 2017 +0100
GoG: add a tool to detect outdated package
The old setup_*.exe have to remain;
but the new ones needs to be added.
(as a fallback, GDP will also trust
files coming fresh from LGOGdownloader)
TODO:
leisure_suit_larry3 2.2.0.19 -> 2.2.0.20
leisure_suit_larry 2.2.0.18 -> 2.2.0.19
leisure_suit_larry_vga 2.2.0.20 -> 2.2.0.21
leisure_suit_larry2 2.2.0.18 -> 2.2.0.19
leisure_suit_larry5 2.2.0.20 -> 2.2.0.21
leisure_suit_larry6_vga 2.2.0.18 -> 2.2.0.19
---
debian/changelog | 1 +
tools/gog_updated.py | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index cec802f..ffd518a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,7 @@ game-data-packager (50) UNRELEASED; urgency=medium
- Use locale 'C.UTF-8' instead of 'C' in Makefile,
CPython will coerce it anyway (see PEP 538)
- Use ImageMagick as a fallback when XCFTools are missing [adetiste]
+ - Add a tool to detect outdated GoG packages [adetiste]
-- Simon McVittie <smcv at debian.org> Thu, 22 Dec 2016 16:43:05 +0000
diff --git a/tools/gog_updated.py b/tools/gog_updated.py
new file mode 100755
index 0000000..65dfc32
--- /dev/null
+++ b/tools/gog_updated.py
@@ -0,0 +1,68 @@
+#!/usr/bin/python3
+# encoding=utf-8
+#
+# Copyright © 2017 Alexandre Detiste <alexandre at detiste.be>
+#
+# 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.
+
+# GDP_UNINSTALLED=1 python3 -m tools.gog_updated
+
+import json
+import os
+import subprocess
+
+from game_data_packager import load_games
+from distutils.version import LooseVersion
+
+yaml_files = {}
+owned_files = []
+
+def decode_filename(archive):
+ game = archive[len('setup_')::]
+ game = game.rsplit('_', 1)[0].strip()
+ version = archive.split('_')[-1][:-4:]
+ return(archive, game, version)
+
+print('# Reading data from YAML...')
+for name, game in load_games().items():
+ game.load_file_data()
+ for filename,f in game.files.items():
+ if filename.startswith('setup_') and filename.endswith('.exe'):
+ _, supported, version = decode_filename(filename)
+ if '.' not in version:
+ # ancient GOG packages
+ continue
+ if LooseVersion(version) > LooseVersion(yaml_files.get(supported, '0')):
+ yaml_files[supported] = version
+
+print('# Reading data from LGOGDOWNLOADER...')
+cache = os.path.expanduser('~/.cache/lgogdownloader/gamedetails.json')
+if not os.path.isfile(cache):
+ print("Couldn't locate any game, running 'lgogdownloader --login'")
+ subprocess.call(['lgogdownloader', '--login'])
+ print("... and now 'lgogdownloader --update-cache'")
+ subprocess.call(['lgogdownloader', '--update-cache'])
+
+data = json.load(open(cache, encoding='utf-8'))
+for game in data['games']:
+ for installer in game['installers']:
+ filename = installer['path']
+ filename = os.path.basename(filename)
+ if filename.startswith('setup_') and filename.endswith('.exe'):
+ owned_files.append(decode_filename(filename))
+
+print('# Left join...')
+for supported, curr_ver in yaml_files.items():
+ for _, to_match, last_ver in owned_files:
+ if supported == to_match and last_ver > curr_ver:
+ print("%-40s %12s -> %-12s" % (supported, curr_ver, last_ver))
--
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