comparison bin/publishdebianpackages.py @ 408:02d498ee90b8 treepkg-status

copy binary-all packages in all binary-xyz dirs
author Bjoern Ricks <bricks@intevation.de>
date Thu, 22 Jul 2010 10:17:42 +0000
parents 52e3c3976e53
children ecc671a84a73
comparison
equal deleted inserted replaced
407:fb473f67345b 408:02d498ee90b8
71 xml = capture_output(cmdexpand("@runremote $build_listpackages" 71 xml = capture_output(cmdexpand("@runremote $build_listpackages"
72 " --newest=$num_newest", 72 " --newest=$num_newest",
73 #runremote=runremote, 73 #runremote=runremote,
74 runremote="", 74 runremote="",
75 **variables)).splitlines() 75 **variables)).splitlines()
76 treepkginfo = TreepkgInfo.fromxml(xml) 76 return TreepkgInfo.fromxml(xml)
77 77
78 def get_binary_arch(arch): 78 def get_binary_arch(arch):
79 if not arch == "source": 79 if not arch == "source":
80 if not arch.startswith("binary"): 80 if not arch.startswith("binary"):
81 arch = "binary-" + arch 81 arch = "binary-" + arch
84 def check_package_is_new(packagename, destdir, packagemd5sum): 84 def check_package_is_new(packagename, destdir, packagemd5sum):
85 destpackage = os.path.join(destdir, packagename) 85 destpackage = os.path.join(destdir, packagename)
86 if not os.path.isfile(destpackage): 86 if not os.path.isfile(destpackage):
87 return True 87 return True
88 destmd5sum = md5sum(destpackage) 88 destmd5sum = md5sum(destpackage)
89 return destmd5sum == packagemd5sum 89 return (destmd5sum != packagemd5sum)
90
91 def copy_to_destdir(package, dir, arch, subdir):
92 scp_flags = []
93 destdir = os.path.join(dir, arch, subdir)
94 print "package: %s, destdir: %s" % (package.name, destdir)
95 md5sum = ""
96 for checksum in package.checksums:
97 if checksum.type == "md5":
98 md5sum = checksum.checksum
99 break
100 # update only if the packages differ
101 if check_package_is_new(package.name, destdir, md5sum):
102 pass
103 # scp the packages to the cache dir
104 #call(cmdexpand("scp -p @scp_flags $file $cachedir/", file=package.path,
105 # scp_flags=scp_flags, cachedir=destdir))
90 106
91 def copy_to_cache(variables, track, revision, quiet, architectures=None): 107 def copy_to_cache(variables, track, revision, quiet, architectures=None):
92 scp_flags = [] 108 cachedir = variables["cachedir"]
93 if quiet: 109 if quiet:
94 scp_flags.append("-q") 110 scp_flags.append("-q")
95 treepkginfo = get_treepkg_info(variables) 111 treepkginfo = get_treepkg_info(variables)
96 treepkgroot = treepkginfo.root 112 allowedarchs = set([]) # contains all wanted architectures (incl. source)
97 binaryarchs = [] 113 allarchs = set([]) # contains all present architectures (incl. source)
114 binaryallpackages = []
98 # change e.g. armel in binary-armel 115 # change e.g. armel in binary-armel
99 for arch in architectures: 116 if not architectures is None:
100 binaryarchs.append(get_binary_arch(arch)) 117 for arch in architectures:
101 # add binary-all to requested packages 118 allowedarchs.append(get_binary_arch(arch))
102 if not binaryarchs is None: 119
103 binaryarchs.append("binary-all") 120 for track in treepkginfo.tracks:
104
105 for track in treepkgroot.tracks:
106 files = []
107 for rev in track.revisions: 121 for rev in track.revisions:
108 for package in rev.packages: 122 for package in rev.packages:
109 # only copy requested archs (+ all) 123 # handle binary-all
110 if not binaryarchs is None and \ 124 if package.arch == "binary-all":
111 not package.arch in binaryarchs: 125 # add trackname for subdir name
126 package.tackname = track.name
127 binaryallpackages.append(package)
112 break 128 break
113 destdir = os.path.join(variables["cachedir"], 129 allarchs.append(package.arch)
114 package.arch, 130 # only copy requested archs
115 track.name) 131 if len(allowedarchs) == 0 or \
116 print "package: %s, destdir: %s" % (package.name, destdir) 132 package.arch in allowedarchs:
117 md5sum = "" 133 copy_to_destdir(package, cachedir, package.arch, track.name)
118 for checksum in package.checksums: 134
119 if checksum.type == "md5": 135 # copy binary-all packages
120 md5sum = checksum.checksum 136 if len(allowedarchs) == 0:
121 break 137 binallarchs = allarchs - set(["source"])
122 # update only if the packages differ 138 else:
123 if check_package_is_new(package.name, destdir, md5sum): 139 binallarchs = allowedarchs & allarchs - set(["source"])
124 files.append(package.path) 140 for package in binaryallpackages:
125 # scp the packages of a track to the cache dir 141 for arch in binallarchs:
126 #call(cmdexpand("scp -p @scp_flags @files $cachedir/", files=files, 142 copy_to_destdir(package, cachedir, arch, package.trackname)
127 # scp_flags=scp_flagsd, cachedir=destdir))
128 143
129 def publish_packages_arch(variables, track, revision, dist, section, 144 def publish_packages_arch(variables, track, revision, dist, section,
130 quiet, architectures): 145 quiet, architectures):
131 copy_to_cache(variables, track, revision, quiet, architectures) 146 copy_to_cache(variables, track, revision, quiet, architectures)
132 # copy_to_publishdir(variables, dist, section, arch, quiet) 147 # copy_to_publishdir(variables, dist, section, arch, quiet)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)