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 ed3e15ed9b9ea04d196af7d99699c9d18886218d Author: Simon McVittie <[email protected]> Date: Fri Jan 2 20:26:03 2015 +0000 Add support for including symlinks in a .deb, and use it for rott-data VENDOR.DOC is installed to both /usr/share/doc/rott-data and /usr/share/games/rott by g-d-p 37. Presumably that's actually necessary. It is valid for the doc copy to be a symlink to the other. --- data/rott-data.yaml | 8 +++++--- lib/game_data_packager/__init__.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/data/rott-data.yaml b/data/rott-data.yaml index 080c20f..ae6da72 100644 --- a/data/rott-data.yaml +++ b/data/rott-data.yaml @@ -14,10 +14,12 @@ install_files_from_cksums: | 3228256652 110484 REMOTE1.RTS 4153237746 7752 VENDOR.DOC -files: - VENDOR.DOC: - install_to: usr/share/doc/rott-data +# format: {'symlink': 'real file'} +symlinks: + usr/share/doc/rott-data/VENDOR.DOC: + usr/share/games/rott/VENDOR.DOC +files: 1rott13.zip: size: 3668139 download: diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py index 8f62b33..7fc0f96 100644 --- a/lib/game_data_packager/__init__.py +++ b/lib/game_data_packager/__init__.py @@ -270,9 +270,17 @@ class GameDataPackage(object): if 'install_to' in self.yaml: self.install_to = self.yaml['install_to'] + # symlink => real file (the opposite way round that debhelper does it, + # because the links must be unique but the real files are not + # necessarily) + self.symlinks = {} + self._populate_files(self.yaml.get('files')) self._populate_files(self.yaml.get('install_files'), install=True) + if 'symlinks' in self.yaml: + self.symlinks = self.yaml['symlinks'] + if 'install_files_from_cksums' in self.yaml: for line in self.yaml['install_files_from_cksums'].splitlines(): stripped = line.strip() @@ -882,6 +890,30 @@ class GameDataPackage(object): subprocess.check_call(['cp', '--reflink=auto', copy_from, copy_to]) + for symlink, real_file in self.symlinks.items(): + symlink = symlink.lstrip('/') + real_file = real_file.lstrip('/') + + toplevel, rest = symlink.split('/', 1) + if real_file.startswith(toplevel + '/'): + symlink_dirs = symlink.split('/') + real_file_dirs = real_file.split('/') + + while (len(symlink_dirs) > 0 and len(real_file_dirs) > 0 and + symlink_dirs[0] == real_file_dirs[0]): + symlink_dirs.pop(0) + real_file_dirs.pop(0) + + if len(symlink_dirs) == 0: + raise ValueError('Cannot create a symlink to itself') + + target = ('../' * (len(symlink_dirs) - 1)) + '/'.join(real_file_dirs) + else: + target = '/' + real_file + + mkdir_p(os.path.dirname(os.path.join(destdir, symlink))) + os.symlink(target, os.path.join(destdir, symlink)) + # FIXME: eventually we should build the .deb in Python, but for now # we let the shell script do it -- 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

