[Treepkg-commits] r125 - trunk/bin

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Aug 20 15:30:21 CEST 2008


Author: bh
Date: 2008-08-20 15:30:21 +0200 (Wed, 20 Aug 2008)
New Revision: 125

Modified:
   trunk/bin/publishpackages.py
Log:
publishpackages command: if --track is omitted, publish files of all tracks.


Modified: trunk/bin/publishpackages.py
===================================================================
--- trunk/bin/publishpackages.py	2008-08-20 13:05:57 UTC (rev 124)
+++ trunk/bin/publishpackages.py	2008-08-20 13:30:21 UTC (rev 125)
@@ -1,5 +1,5 @@
 #! /usr/bin/python2.4
-# Copyright (C) 2007 by Intevation GmbH
+# Copyright (C) 2007, 2008 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh at intevation.de>
 #
@@ -59,21 +59,35 @@
                             " the publishing system"))
     parser.add_option("--track",
                       help=("The package track whose files are to be"
-                            " published"))
+                            " published. If not given, files of all tracks"
+                            " will be published"))
     return parser.parse_args()
 
 
 def publish_packages_arch(variables, track, revision, dist, section, arch):
     # create web-page on build host
+    listpackages_vars = variables.copy()
+
     if arch == "source":
-        variables["pkgtype"] = "--source"
+        listpackages_vars["pkgtype"] = "--source"
     else:
-        variables["pkgtype"] = "--binary"
+        listpackages_vars["pkgtype"] = "--binary"
 
+    if track:
+        listpackages_vars["track"] = ["--track", track]
+    else:
+        listpackages_vars["track"] = []
+
+    if revision:
+        listpackages_vars["revision"] = ["--revision", revision]
+    else:
+        listpackages_vars["revision"] = []
+
     files = capture_output(cmdexpand("ssh $build_user$@$build_host"
                                      " $build_listpackages"
-                                     " --track $track @revision $pkgtype",
-                                     **variables)).strip().split("\n")
+                                     " @track @revision $pkgtype",
+                                     **listpackages_vars)).strip().split("\n")
+
     # scp the packages to the cache dir
     cachedir = variables["cachedir"]
     shutil.rmtree(cachedir, ignore_errors=True)
@@ -96,24 +110,17 @@
 def publish_packages(config_filename, track, revision, dist, section):
     config = read_config(config_filename)
 
-    variables = config.copy()
-    variables["track"] = track
-    if revision:
-        variables["revision"] = ["--revision", revision]
-    else:
-        variables["revision"] = []
-
     for arch in ["binary-i386", "source"]:
-        publish_packages_arch(variables, track, revision, dist, section, arch)
+        publish_packages_arch(config, track, revision, dist, section, arch)
 
     # update apt archive
     call(cmdexpand("ssh $publish_user$@$publish_host"
                    " $publish_apt_archive_update",
-                   **variables))
+                   **config))
 
 def main():
     options, args = parse_commandline()
-    for required_opt in ["track", "dist", "section"]:
+    for required_opt in ["dist", "section"]:
         if getattr(options, required_opt) is None:
             print >>sys.stderr, "The --%s option must be given" % required_opt
             sys.exit(1)



More information about the Treepkg-commits mailing list