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 7e50e6da93dc079f0a14a6acf5da3e6e8b2e4ac9 Author: Alexandre Detiste <[email protected]> Date: Thu Feb 12 06:02:21 2015 +0100 make_template: add strace wrapper one just needs to complete one game to see which files are used, will tell also about missing files (ENOENT) --- game_data_packager/make_template.py | 50 ++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/game_data_packager/make_template.py b/game_data_packager/make_template.py index 2930807..614278e 100644 --- a/game_data_packager/make_template.py +++ b/game_data_packager/make_template.py @@ -267,14 +267,60 @@ def do_one_deb(deb): print('...') print('') +def do_one_exec(pgm,lower): + with subprocess.Popen(['strace', '-e', 'open', + '-s', '100', pgm], + stderr=subprocess.PIPE, stdout=subprocess.DEVNULL, + universal_newlines=True) as proc: + used = set() + missing = set() + while proc.poll() == None: + line = proc.stderr.readline().strip() + if not line.startswith('open('): + continue + file = line.split('"')[1] + if (not file.startswith('/usr/share/games') + and not file.startswith('/usr/local/games')): + continue + if 'ENOENT' in line: + missing.add(file) + else: + used.add(file) + + dirs = set() + print('# used') + for file in sorted(used): + dirs.add(os.path.dirname(file)) + print(" - %s" % file) + if missing: + print('# missing ?') + for file in sorted(missing): + print(" - %s" % file) + + present = set() + for dir in dirs: + for dirpath, dirnames, filenames in os.walk(dir): + for fn in filenames: + present.add(os.path.join(dirpath, fn)) + + unused = present - used + if unused: + print('# not used') + for file in sorted(unused): + print(" - %s" % file) + + def main(): parser = argparse.ArgumentParser( description='Produce a template for game-data-packager YAML ' + 'based on an existing .deb file or installed directory', prog='game-data-packager guess-contents') - parser.add_argument('args', nargs='+', metavar='DEB|DIRECTORY') + parser.add_argument('args', nargs='+', metavar='DEB|DIRECTORY|FILE') parser.add_argument('-l', '--lower', action='store_true', dest='lower', help='make all files lowercase') + parser.add_argument('-e', '--execute', action='store_true', dest='execute', + help='run this game through strace and see which files from ' + '/usr/share/games or /usr/local/games are needed') args = parser.parse_args() for arg in args.args: @@ -282,6 +328,8 @@ def main(): do_one_dir(arg.rstrip('/'),args.lower) elif arg.endswith('.deb'): do_one_deb(arg) + elif args.execute: + do_one_exec(arg,args.lower) else: do_one_file(arg,args.lower) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

