pkgme-devs team mailing list archive
-
pkgme-devs team
-
Mailing list archive
-
Message #00024
Re: pkgme for extras
On 05/08/2012 02:33 PM, Allison Randal wrote
>
> And, yes, I'd be happy to work on developing an ARB backend (or whatever
> else is needed), and imagine other ARB members would be also.
Despite my best intentions, all I've managed so far is the attached
patch. It's a small extras backend that reads the config values pkgme
needs from a .json file, with sane defaults for extras, so only unusual
values need to be specified.
The big time blocker for me at the moment is digging into the pkgme
source to find how to request and pass additional configuration
variables to the copyright and source/format files, which would be
required for extras. It would be nice if pkgme could somehow access the
default license text provided by dh-make. But, dh-make really only
supports a handful of licenses anyway, so not a big deal to duplicate
their default text in pkgme.
That's pretty much all there is to it. I'd appreciate any assistance in
the form of pointers to what part of the code to dig at,
additions/modifications to the patch, or offers of chocolate if I finish
(hey, motivation is key).
Allison
Attachment:
extras.json
Description: application/json
=== added directory 'pkgme/backends/extras'
=== added file 'pkgme/backends/extras/all_info'
--- pkgme/backends/extras/all_info 1970-01-01 00:00:00 +0000
+++ pkgme/backends/extras/all_info 2012-05-11 22:44:53 +0000
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+import json
+import os
+import sys
+
+def default_value (key):
+ if key == "architecture":
+ return "all"
+ elif key == "section":
+ return "utils"
+ elif key == "source_format":
+ return "native"
+ else:
+ return ""
+
+if __name__ == '__main__':
+ wanted = json.load(sys.stdin)
+
+ hints_file = open('extras.json', 'r')
+ hints_source = hints_file.read()
+ hints = json.loads(hints_source)
+
+ result = {}
+ for key in wanted:
+ if key in hints:
+ result[key] = hints[key]
+ else:
+ result[key] = default_value(key)
+
+ print json.dumps(result)
=== added file 'pkgme/backends/extras/want'
--- pkgme/backends/extras/want 1970-01-01 00:00:00 +0000
+++ pkgme/backends/extras/want 2012-05-09 18:25:09 +0000
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+import json
+import os
+
+
+if __name__ == '__main__':
+ if os.path.isfile("extras.json"):
+ print 30
+ else:
+ print json.dumps({'score': 0, 'reason': "Couldn't find extras.json"})
=== added file 'pkgme/templates/copyright'
--- pkgme/templates/copyright 1970-01-01 00:00:00 +0000
+++ pkgme/templates/copyright 2012-05-11 22:43:06 +0000
@@ -0,0 +1,12 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: $package_name
+Source: <$homepage>
+
+Files: *
+Copyright: $copyright_years $maintainer
+License: $license
+
+#if $license_text
+License: $license
+$license_text
+#end if
=== added directory 'pkgme/templates/source'
=== added file 'pkgme/templates/source/format'
--- pkgme/templates/source/format 1970-01-01 00:00:00 +0000
+++ pkgme/templates/source/format 2012-05-11 22:44:21 +0000
@@ -0,0 +1,1 @@
+3.0 ($source_format)
Follow ups
References