[kernel] r8379 - people/waldi/scripts/snapshot
Bastian Blank
waldi at alioth.debian.org
Thu Mar 22 11:58:49 UTC 2007
Author: waldi
Date: Thu Mar 22 10:58:49 2007
New Revision: 8379
Added:
people/waldi/scripts/snapshot/config
Modified:
people/waldi/scripts/snapshot/package.py
Log:
* snapshot/config: Add.
* snapshot/package.py: Read and use config.
Added: people/waldi/scripts/snapshot/config
==============================================================================
--- (empty file)
+++ people/waldi/scripts/snapshot/config Thu Mar 22 10:58:49 2007
@@ -0,0 +1,23 @@
+[DEFAULT]
+base: ~/debian/kernel/snapshot
+changelog_maintainer: Bastian Blank <waldi at debian.org>
+changelog_text: Snapshot.
+repository: svn://svn.debian.org/kernel/
+orig: ~/debian/kernel/orig
+sign: DAEE1CDC
+#upload: debian-kernel
+upload: upload
+
+[dists/sid/linux-2.6]
+dist: kernel-dists-sid
+
+[dists/trunk/linux-2.6]
+dist: kernel-dists-trunk
+
+[dists/trunk/linux-kbuild-2.6]
+dist: kernel-dists-trunk
+
+[dists/trunk/linux-modules-extra-2.6]
+dist: kernel-dists-trunk
+native: True
+
Modified: people/waldi/scripts/snapshot/package.py
==============================================================================
--- people/waldi/scripts/snapshot/package.py (original)
+++ people/waldi/scripts/snapshot/package.py Thu Mar 22 10:58:49 2007
@@ -17,11 +17,27 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import os.path, shutil, sys, time
-import debian_linux
+import debian_linux.config
-base = os.path.expanduser("~/debian/kernel/snapshot")
-repository = "svn://svn.debian.org/kernel/"
-orig_base = os.path.expanduser("~/debian/kernel/orig")
+class Config(dict):
+ schema_item_boolean = debian_linux.config.schema_item_boolean
+ schema_item_list = debian_linux.config.schema_item_list
+
+ class schema_item_path(object):
+ def __call__(self, i):
+ return os.path.expanduser(i.strip())
+
+ schema = {
+ 'base': schema_item_path(),
+ 'native': schema_item_boolean(),
+ 'orig': schema_item_path(),
+ }
+
+ def __init__(self, config):
+ parser = debian_linux.config.config_parser(self.schema, [config])
+ for section in iter(parser):
+ # TODO: don't split sections in parser
+ self[section[0]] = parser[section]
def _spawnvefn(mode, file, args, env, func, prepare, prepare_arg):
# Internal helper; func is the exec*() function to use
@@ -88,12 +104,6 @@
if ret:
raise ExecutionError(ret)
- def _exec_chdir(self, executable, args, dir, force = False, output = True):
- args_real = [executable.split(os.sep)[-1]] + args
- ret = spawnv_chdir(os.P_WAIT, executable, args_real, dir)
- if ret:
- raise ExecutionError(ret)
-
def _mk(self, dir):
try:
os.makedirs(dir, 0755)
@@ -117,30 +127,32 @@
self._rm(self.dir)
class repository_svn(storage):
- def __init__(self, dir, path):
+ def __init__(self, dir, uri):
storage.__init__(self, dir)
- self.path = path
+ self.uri = uri
self.checkout()
def checkout(self):
- path_real = '%s/%s' % (repository, self.path)
- args = ['co', '-q', path_real, self.dir]
+ args = ['co', '-q', self.uri, self.dir]
self.exec_svn(args)
def exec_svn(self, args):
self._exec("/usr/bin/svn", args)
-def package(path, dist, native = False):
- checkout_dir = "checkout-" + path.replace('/', '_')
- last_file = "last-" + path.replace('/', '_')
- checkout_storage = repository_svn(checkout_dir, path)
+def package(path, entry):
+ base = entry['base']
+ native = entry.get('native', False)
+
+ checkout_dir = os.path.join(base, "checkout-" + path.replace('/', '_'))
+ last_file = os.path.join(base, "last-" + path.replace('/', '_'))
+ checkout_storage = repository_svn(checkout_dir, "%s/%s" % (entry['repository'], path))
changelog_entry = debian_linux.Changelog(checkout_dir)[0]
package_name = changelog_entry.source
package_version = changelog_entry.version.upstream
package = "%s-%s" % (package_name, package_version)
package_dir = "gen/%s" % package
package_orig = "%s_%s.orig.tar.gz" % (package_name, package_version)
- package_orig_source = "%s/%s" % (orig_base, package_orig)
+ package_orig_source = "%s/%s" % (entry['orig'], package_orig)
for line in os.popen("svn info %s" % checkout_dir, 'r').read().split('\n'):
if line.startswith('Last Changed Rev: '):
@@ -189,12 +201,13 @@
f.write("""\
%s (%s-%s) %s; urgency=low
- * Snapshot.
+ * %s
- -- Bastian Blank <waldi at debian.org> %s
+ -- %s %s
""" % (
- package_name, package_version, version_debian, dist,
+ package_name, package_version, version_debian, entry['dist'],
+ entry['changelog_text'], entry['changelog_maintainer'],
time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()),
)
)
@@ -206,7 +219,10 @@
if spawnv_chdir(os.P_WAIT, "debian/rules", ['debian/rules', 'orig'], package_dir):
raise RuntimeError
- list = ['dpkg-buildpackage', '-kDAEE1CDC', '-S']
+ list = ['dpkg-buildpackage', '-S']
+ sign = entry.get('sign', None)
+ if sign:
+ list.append('-k%s' % sign)
if not native:
if version_upstream != last_upstream:
list.append('-sa')
@@ -222,7 +238,6 @@
for suffix in suffixes:
prefix = '%s_%s-%s' % (package_name, package_version, version_debian)
- print prefix, suffix
os.link("gen/%s%s" % (prefix, suffix), "out/%s%s" % (prefix, suffix))
os.unlink("gen/%s%s" % (prefix, suffix))
@@ -230,26 +245,21 @@
package_storage.remove()
- spawnv_chdir(os.P_WAIT, 'dput', ['dput', 'debian-kernel', '%s_%s-%s_source.changes' % (package_name, package_version, version_debian)], "out")
+ spawnv_chdir(os.P_WAIT, 'dput', ['dput', entry['upload'], '%s_%s-%s_source.changes' % (package_name, package_version, version_debian)], "out")
def main():
- maps = {
- "dists/sid/linux-2.6": {'dist': "kernel-dists-sid"},
- "dists/trunk/linux-2.6": {'dist': "kernel-dists-trunk"},
- "dists/trunk/linux-kbuild-2.6": {'dist': "kernel-dists-trunk"},
- "dists/trunk/linux-modules-extra-2.6": {'dist': "kernel-dists-trunk", 'native': True},
- }
- if len(sys.argv) > 1:
- paths = sys.argv[1:]
+ config = Config(sys.argv[1])
+ if len(sys.argv) > 2:
+ paths = sys.argv[2:]
else:
- paths = maps.keys()
+ paths = config.keys()
for path in paths:
try:
- package(path, **maps[path])
+ c = config[path]
+ package(path, c)
except Exception, e:
import traceback
traceback.print_exc()
if __name__ == '__main__':
- os.chdir(base)
main()
More information about the Kernel-svn-changes
mailing list