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 742aaffcede4dd8c9b023df1ae211d3ea5c57749 Author: Simon McVittie <[email protected]> Date: Tue Nov 1 12:28:56 2016 +0000 Do not modify GamePackage.component in-place --- game_data_packager/build.py | 21 +++++++++++++-------- game_data_packager/packaging/__init__.py | 10 ++++++---- game_data_packager/packaging/arch.py | 2 +- game_data_packager/packaging/deb.py | 21 +++++++++++++-------- game_data_packager/packaging/rpm.py | 2 +- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/game_data_packager/build.py b/game_data_packager/build.py index efa1b6a..979316f 100644 --- a/game_data_packager/build.py +++ b/game_data_packager/build.py @@ -231,6 +231,11 @@ class PackagingTask(object): # 'usr/share/games/quake3-data/baseq3/pak0.pk3': '1197ca...' } self.package_md5sums = {} + # Components for packages, possibly modified: if the license + # for a freely redistributable game is missing, we demote it from + # main or non-free to local (i.e. non-distributable). + self.package_components = {} + # Found CD tracks # e.g. { 'quake-music': { 2: '/usr/.../id1/music/track02.ogg' } } self.cd_tracks = {} @@ -1189,10 +1194,10 @@ class PackagingTask(object): 'usr/share/doc/%s/%s' % (package.name, license_file)) - if package.component == 'local': + if self.package_components[package.name] == 'local': o.write('It contains proprietary game data ' 'and must not be redistributed.\n\n') - elif package.component == 'non-free': + elif self.package_components[package.name] == 'non-free': o.write('It contains proprietary game data ' 'that may be redistributed\n' 'only under conditions specified in\n') @@ -1260,7 +1265,7 @@ class PackagingTask(object): o.write(package.copyright or self.game.copyright) o.write(', with all rights reserved.\n') - if licenses and package.component == 'local': + if licenses and self.package_components[package.name] == 'local': o.write('\nThe full license appears in ') o.write(',\n'.join(licenses)) o.write('\n') @@ -1281,6 +1286,7 @@ class PackagingTask(object): shutil.copyfile(os.path.join(DATADIR, 'changelog.gz'), os.path.join(dest_pkgdocdir, 'changelog.gz')) + self.__check_component(package) self.fill_docs(package, destdir, pkgdocdir) for wanted in (package.install_files | package.optional_files): @@ -2013,10 +2019,10 @@ class PackagingTask(object): destdir = os.path.join(per_package_dir, 'DESTDIR') self.fill_dest_dir(package, destdir) - self.__check_component(package) pkg = self.packaging.build_package(per_package_dir, self.game, package, destination, compress=compress, - md5sums=self.package_md5sums.get(package.name)) + md5sums=self.package_md5sums.get(package.name), + component=self.package_components[package.name]) assert pkg is not None packages.add(pkg) @@ -2133,8 +2139,7 @@ class PackagingTask(object): def __check_component(self, package): # redistributable packages are redistributable as long as their # optional license file is present - # FIXME: only do this for .deb? - # FIXME: shouldn't modify package.component in-place + self.package_components[package.name] = package.component if package.component == 'local': return for f in package.optional_files: @@ -2142,7 +2147,7 @@ class PackagingTask(object): continue if self.file_status[f.name] is not FillResult.COMPLETE: - package.component = 'local' + self.package_components[package.name] = 'local' return return diff --git a/game_data_packager/packaging/__init__.py b/game_data_packager/packaging/__init__.py index 4fd8325..6f5fa15 100644 --- a/game_data_packager/packaging/__init__.py +++ b/game_data_packager/packaging/__init__.py @@ -218,8 +218,10 @@ class PackagingSystem(metaclass=ABCMeta): def merge_relations(self, package, rel): return set(self.format_relations(package.relations[rel])) - def generate_description(self, game, package): + def generate_description(self, game, package, component=None): longname = package.longname or game.longname + if component is None: + component = package.component if package.short_description is not None: short_desc = package.short_description @@ -234,10 +236,10 @@ class PackagingSystem(metaclass=ABCMeta): return (short_desc, long_desc) long_desc = 'This package was built using game-data-packager.\n' - if package.component == 'local': + if component == 'local': long_desc += 'It contains proprietary game data and must not be redistributed.\n' long_desc += '.\n' - elif package.component == 'non-free': + elif component == 'non-free': long_desc += 'It contains proprietary game data that may be redistributed\n' long_desc += 'only under some conditions.\n' long_desc += '.\n' @@ -304,7 +306,7 @@ class PackagingSystem(metaclass=ABCMeta): @abstractmethod def build_package(self, per_package_dir, game, package, - destination, compress=True, md5sums=None): + destination, compress=True, md5sums=None, component=None): """Build the .deb or equivalent in destination, and return its filename. diff --git a/game_data_packager/packaging/arch.py b/game_data_packager/packaging/arch.py index c8d92a1..c7e8364 100644 --- a/game_data_packager/packaging/arch.py +++ b/game_data_packager/packaging/arch.py @@ -155,7 +155,7 @@ class ArchPackaging(PackagingSystem): + sorted(files), env={'LANG':'C'}, cwd=destdir) def build_package(self, per_package_dir, game, package, destination, - compress=True, md5sums=None): + compress=True, md5sums=None, component=None): destdir = os.path.join(per_package_dir, 'DESTDIR') arch = self.get_effective_architecture(package) diff --git a/game_data_packager/packaging/deb.py b/game_data_packager/packaging/deb.py index b2e5673..a7512ae 100644 --- a/game_data_packager/packaging/deb.py +++ b/game_data_packager/packaging/deb.py @@ -217,7 +217,7 @@ class DebPackaging(PackagingSystem): return self.rename_package(pr.package) - def __generate_control(self, game, package, destdir): + def __generate_control(self, game, package, destdir, component): if Deb822 is None: raise FileNotFoundError('Cannot generate .deb packages without ' 'python3-debian') @@ -256,10 +256,10 @@ class DebPackaging(PackagingSystem): installed_size += 1 control['Installed-Size'] = str(installed_size) - if package.component == 'main': + if component == 'main': control['Section'] = package.section else: - control['Section'] = package.component + '/' + package.section + control['Section'] = component + '/' + package.section if package.architecture == 'all': control['Architecture'] = 'all' @@ -347,8 +347,12 @@ class DebPackaging(PackagingSystem): return control - def __fill_dest_dir_deb(self, game, package, destdir, md5sums=None): - if package.component == 'local': + def __fill_dest_dir_deb(self, game, package, destdir, md5sums=None, + component=None): + if component is None: + component = package.component + + if component == 'local': self.override_lintian(destdir, package.name, 'unknown-section', 'local/%s' % package.section) @@ -380,15 +384,16 @@ class DebPackaging(PackagingSystem): os.chmod(md5sums_path, 0o644) control = os.path.join(destdir, 'DEBIAN/control') - self.__generate_control(game, package, destdir).dump( + self.__generate_control(game, package, destdir, component).dump( fd=open(control, 'wb'), encoding='utf-8') os.chmod(control, 0o644) def build_package(self, per_package_dir, game, package, destination, - compress=True, md5sums=None): + compress=True, md5sums=None, component=None): destdir = os.path.join(per_package_dir, 'DESTDIR') arch = self.get_effective_architecture(package) - self.__fill_dest_dir_deb(game, package, destdir, md5sums) + self.__fill_dest_dir_deb(game, package, destdir, md5sums, + component) normalize_permissions(destdir) # it had better have a /usr and a DEBIAN directory or diff --git a/game_data_packager/packaging/rpm.py b/game_data_packager/packaging/rpm.py index f7d84a4..de2d2c7 100644 --- a/game_data_packager/packaging/rpm.py +++ b/game_data_packager/packaging/rpm.py @@ -231,7 +231,7 @@ class RpmPackaging(PackagingSystem): return specfile def build_package(self, per_package_dir, game, package, destination, - compress=True, md5sums=None): + compress=True, md5sums=None, component=None): destdir = os.path.join(per_package_dir, 'DESTDIR') arch = self.get_effective_architecture(package) -- 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

