[game-data-packager] 11/14: add debian/copyright generator
Simon McVittie
smcv at debian.org
Sun Feb 15 15:25:39 UTC 2015
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 ce8f270106c533e0cffacf523bd3908b435db9d5
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Thu Feb 12 17:18:53 2015 +0100
add debian/copyright generator
---
Makefile | 2 ++
data/rott.yaml | 2 ++
doc/adding_a_game.mdwn | 9 +++++++++
game_data_packager/__init__.py | 32 ++++++++++++++++++++++++++++----
game_data_packager/make_template.py | 2 ++
5 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 1c4a493..2ee4018 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,7 @@ default: $(DIRS)
gzip -nc9 debian/changelog > ./out/changelog.gz
chmod 0644 ./out/changelog.gz
for f in data/*.yaml data/*.control.in data/*.copyright \
+ data/copyright \
data/*.copyright.in data/*.desktop.in \
data/*.preinst.in data/*.README.Debian.in; do \
if [ -L $$f ]; then \
@@ -35,6 +36,7 @@ $(DIRS):
clean:
rm -f ./out/changelog.gz
+ rm -f ./out/copyright
rm -f ./out/game-data-packager
rm -f ./out/foo ./out/bar ./out/baz
rm -f ./out/*.control
diff --git a/data/rott.yaml b/data/rott.yaml
index 0c6a0dc..c982c19 100644
--- a/data/rott.yaml
+++ b/data/rott.yaml
@@ -28,6 +28,7 @@ packages:
- HUNTBGIN.RTL
- HUNTBGIN.WAD
- REMOTE1.RTS
+ optional:
- VENDOR.DOC
rott-registered-data:
@@ -40,6 +41,7 @@ packages:
- any_registered_rtc
- DARKWAR.RTL
- DARKWAR.WAD
+ optional:
- LICENSE.TXT
rott-extreme-data:
diff --git a/doc/adding_a_game.mdwn b/doc/adding_a_game.mdwn
index 457d049..40756b5 100644
--- a/doc/adding_a_game.mdwn
+++ b/doc/adding_a_game.mdwn
@@ -15,6 +15,8 @@ which should get you easily started.
* `shortname`: string: the short name of the game, such as `quake3`.
* `longname`: string: the "marketing name" of the game, such as Quake
III Arena.
+* `copyright`: string: © <year_of_first_release> <developper/publisher>
+ This should match the title screen of the game, if any.
* `compress_deb`: boolean, default true: If false, the `.deb` will never be
compressed. Use this if it contains non-compressible files (e.g. `*.pk3`
which are zip files) for which `xz` will waste a lot of time and
@@ -82,6 +84,7 @@ to mapping:
* `longname`: string: the "marketing name" of the game or expansion
in this package, if it differs from the top-level `longname`
+* `copyright`: string: the copyright string, if it differs from top-level
* `demo_for`: this reference the full game included in same YAML file
`expansion_for`: this reference the matching full game included
in the same YAML file.
@@ -107,6 +110,12 @@ section of a binary package
For new games in `game-data-packager` these are normally
`data/*.control.in` and `data/*.copyright`.
+`game-data-packager` will automatically build the copyright file
+using the contents of the `copyright:` tags in the yaml file;
+you only need to provide one if the default generated
+copyright file isn't suitable; see for example
+`data/descent1-demo-data.copyright`.
+
`game-data-packager` will automatically provide the control file
with default values if missing. It will also ensure that
all the field required by policy are present:
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 8c6863e..088681e 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -1521,10 +1521,10 @@ class GameData(object):
return complete
def fill_docs(self, package, docdir):
+ copy_to = os.path.join(docdir, 'copyright')
for n in (package.name, self.shortname):
copy_from = os.path.join(DATADIR, n + '.copyright')
- copy_to = os.path.join(docdir, 'copyright')
-
+ continue
if os.path.exists(copy_from):
shutil.copyfile(copy_from, copy_to)
return
@@ -1536,8 +1536,32 @@ class GameData(object):
PACKAGE=package.name)
return
- raise AssertionError('should have found a copyright file for %s' %
- package.name)
+ copy_from = os.path.join(DATADIR, 'copyright')
+ with open(copy_from, encoding='utf-8') as i, \
+ open(copy_to, 'w', encoding='utf-8') as o:
+ o.write('The package %s was generated using '
+ 'game-data-packager.\n\n' % package.name)
+ o.write('The files under "%s"\n' % package.install_to)
+ for f in package.install | package.optional:
+ if self.file_status[f] is FillResult.IMPOSSIBLE:
+ continue
+ install_to = self.files[f].install_to
+ if install_to and install_to.startswith('$docdir'):
+ o.write('and "/usr/share/doc/%s/"' % package.name)
+ o.write(' (except for this copyright file)\n')
+ break
+ o.write('are user-supplied files with copyright\n')
+ o.write(package.copyright or self.copyright)
+ o.write(', with all rights reserved.\n')
+ # this may either be a real file or a symlink (rott-extreme-data)
+ #
+ #The full license appears in /usr/share/doc/PACKAGE/<somefile>,
+ #/usr/share/doc/PACKAGE/<some-other-file>
+ for line in i.readlines():
+ if line.startswith('#'):
+ continue
+ o.write(line)
+
def fill_extra_files(self, package, destdir):
pass
diff --git a/game_data_packager/make_template.py b/game_data_packager/make_template.py
index 614278e..11523d2 100644
--- a/game_data_packager/make_template.py
+++ b/game_data_packager/make_template.py
@@ -126,6 +126,7 @@ def do_one_dir(destdir,lower):
print('---')
if longname:
print('longname: %s\n' % longname)
+ print('copyright: © 1970 FIXME')
if destdir.startswith('/usr/local') or destdir.startswith('/opt/'):
print('try_repack_from:\n- %s\n' % destdir)
yaml.safe_dump(data, stream=sys.stdout, default_flow_style=False)
@@ -257,6 +258,7 @@ def do_one_deb(deb):
print('# data/%s.yaml' % control['package'])
print('%YAML 1.2')
print('---')
+ print('copyright: © 1970 FIXME')
yaml.safe_dump(data, stream=sys.stdout, default_flow_style=False)
for alg, files in sorted(sums.items()):
--
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