diff bin/publishpackages.py @ 200:ce03e24f6d0f

publishpackages command: if --track is omitted, publish files of all tracks.
author Bernhard Herzog <bh@intevation.de>
date Wed, 20 Aug 2008 13:30:21 +0000
parents 3caf4a5ecbf0
children 55337021fe5b
line wrap: on
line diff
--- a/bin/publishpackages.py	Wed Aug 20 13:05:57 2008 +0000
+++ b/bin/publishpackages.py	Wed Aug 20 13:30:21 2008 +0000
@@ -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@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)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)