Mercurial > treepkg
annotate bin/publishdebianpackages.py @ 409:ecc671a84a73 treepkg-status
fixed small bugs
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Thu, 22 Jul 2010 10:26:40 +0000 |
parents | 02d498ee90b8 |
children | 58ecf7c0ecba |
rev | line source |
---|---|
406
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
1 #! /usr/bin/python |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
2 # Copyright (C) 2007 - 2010 by Intevation GmbH |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
3 # Authors: |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
4 # Bernhard Herzog <bh@intevation.de> |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
5 # Bjoern Ricks <bjoern.ricks@intevation.de> |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
6 # |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
7 # This program is free software under the GPL (>=v2) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
8 # Read the file COPYING coming with the software for details. |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
9 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
10 """Publishes selected packages created by treepkg""" |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
11 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
12 import os |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
13 import sys |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
14 import shlex |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
15 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
16 from optparse import OptionParser |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
17 from ConfigParser import SafeConfigParser |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
18 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
19 import treepkgcmd |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
20 from treepkg.readconfig import read_config_section, convert_bool |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
21 from treepkg.run import call, capture_output |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
22 from treepkg.cmdexpand import cmdexpand |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
23 from treepkg.publish import * |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
24 from treepkg.util import md5sum |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
25 from treepkg.info.status import TreepkgInfo |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
26 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
27 config_desc = ["distribution", "section", "num_newest", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
28 "build_user", "build_host", "build_listpackages", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
29 "publish_user", "publish_host", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
30 ("architectures", shlex.split, "i386, source"), |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
31 ("after_upload_hook", shlex.split), |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
32 ("publish_remove_old_packages", convert_bool), |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
33 ("publish_dir", remove_trailing_slashes), |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
34 ("cachedir", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
35 lambda s: expand_filename(remove_trailing_slashes(s)))] |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
36 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
37 def read_config(filename): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
38 if not os.path.exists(filename): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
39 print >>sys.stderr, "Config file %s does not exist" % filename |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
40 sys.exit(1) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
41 parser = SafeConfigParser() |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
42 parser.read([filename]) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
43 return read_config_section(parser, "publishpackages", config_desc) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
44 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
45 def parse_commandline(): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
46 parser = OptionParser() |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
47 parser.set_defaults(config_file=os.path.join(treepkgcmd.topdir, |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
48 "publishpackages.cfg"), |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
49 quiet=False) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
50 parser.add_option("--config-file", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
51 help=("The configuration file." |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
52 " Default is publishpackages.cfg")) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
53 parser.add_option("--dist", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
54 help=("The debian distribution name to use on" |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
55 " the publishing system")) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
56 parser.add_option("--section", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
57 help=("The debian distribution section name to use on" |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
58 " the publishing system")) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
59 parser.add_option("--track", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
60 help=("The package track whose files are to be" |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
61 " published. If not given, files of all tracks" |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
62 " will be published")) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
63 parser.add_option("--quiet", action="store_true", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
64 help=("Do not print progress meters or other" |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
65 " informational output")) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
66 return parser.parse_args() |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
67 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
68 def get_treepkg_info(variables): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
69 runremote = prefix_for_remote_command(variables["build_user"], |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
70 variables["build_host"]) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
71 xml = capture_output(cmdexpand("@runremote $build_listpackages" |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
72 " --newest=$num_newest", |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
73 #runremote=runremote, |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
74 runremote="", |
409 | 75 **variables)) |
408
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
76 return TreepkgInfo.fromxml(xml) |
406
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
77 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
78 def get_binary_arch(arch): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
79 if not arch == "source": |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
80 if not arch.startswith("binary"): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
81 arch = "binary-" + arch |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
82 return arch |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
83 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
84 def check_package_is_new(packagename, destdir, packagemd5sum): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
85 destpackage = os.path.join(destdir, packagename) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
86 if not os.path.isfile(destpackage): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
87 return True |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
88 destmd5sum = md5sum(destpackage) |
408
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
89 return (destmd5sum != packagemd5sum) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
90 |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
91 def copy_to_destdir(package, dir, arch, subdir): |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
92 scp_flags = [] |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
93 destdir = os.path.join(dir, arch, subdir) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
94 print "package: %s, destdir: %s" % (package.name, destdir) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
95 md5sum = "" |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
96 for checksum in package.checksums: |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
97 if checksum.type == "md5": |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
98 md5sum = checksum.checksum |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
99 break |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
100 # update only if the packages differ |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
101 if check_package_is_new(package.name, destdir, md5sum): |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
102 pass |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
103 # scp the packages to the cache dir |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
104 #call(cmdexpand("scp -p @scp_flags $file $cachedir/", file=package.path, |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
105 # scp_flags=scp_flags, cachedir=destdir)) |
406
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
106 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
107 def copy_to_cache(variables, track, revision, quiet, architectures=None): |
408
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
108 cachedir = variables["cachedir"] |
406
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
109 if quiet: |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
110 scp_flags.append("-q") |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
111 treepkginfo = get_treepkg_info(variables) |
408
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
112 allowedarchs = set([]) # contains all wanted architectures (incl. source) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
113 allarchs = set([]) # contains all present architectures (incl. source) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
114 binaryallpackages = [] |
406
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
115 # change e.g. armel in binary-armel |
408
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
116 if not architectures is None: |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
117 for arch in architectures: |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
118 allowedarchs.append(get_binary_arch(arch)) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
119 |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
120 for track in treepkginfo.tracks: |
406
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
121 for rev in track.revisions: |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
122 for package in rev.packages: |
408
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
123 # handle binary-all |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
124 if package.arch == "binary-all": |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
125 # add trackname for subdir name |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
126 package.tackname = track.name |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
127 binaryallpackages.append(package) |
406
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
128 break |
408
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
129 allarchs.append(package.arch) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
130 # only copy requested archs |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
131 if len(allowedarchs) == 0 or \ |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
132 package.arch in allowedarchs: |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
133 copy_to_destdir(package, cachedir, package.arch, track.name) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
134 |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
135 # copy binary-all packages |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
136 if len(allowedarchs) == 0: |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
137 binallarchs = allarchs - set(["source"]) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
138 else: |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
139 binallarchs = allowedarchs & allarchs - set(["source"]) |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
140 for package in binaryallpackages: |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
141 for arch in binallarchs: |
02d498ee90b8
copy binary-all packages in all binary-xyz dirs
Bjoern Ricks <bricks@intevation.de>
parents:
406
diff
changeset
|
142 copy_to_destdir(package, cachedir, arch, package.trackname) |
406
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
143 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
144 def publish_packages_arch(variables, track, revision, dist, section, |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
145 quiet, architectures): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
146 copy_to_cache(variables, track, revision, quiet, architectures) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
147 # copy_to_publishdir(variables, dist, section, arch, quiet) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
148 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
149 def publish_packages(config_filename, track, revision, dist, section, quiet): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
150 config = read_config(config_filename) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
151 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
152 if dist is None: |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
153 dist = config["distribution"] |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
154 if section is None: |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
155 section = config["section"] |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
156 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
157 architectures = config["architectures"] |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
158 publish_packages_arch(config, track, revision, dist, section, |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
159 quiet, architectures) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
160 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
161 # update apt archive |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
162 # call(config["after_upload_hook"]) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
163 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
164 def main(): |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
165 options, args = parse_commandline() |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
166 revision = None # for future use cases |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
167 publish_packages(options.config_file, options.track, revision, |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
168 options.dist, options.section, options.quiet) |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
169 |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
170 if __name__ == "__main__": |
52e3c3976e53
inital checkin for new publishpackages processing
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
171 main() |