def Exists( self, distribution, architecture, sourcename, version, component=None ): arch_filter = "Architecture (==%s)," % architecture if architecture else "" # for packages that were part pkg_filter = [ "(%s Source (==%s))" % (arch_filter,sourcename), "(%s !Source,Package(==%s))" % (arch_filter,sourcename) ] pkg_filter = "|".join(pkg_filter) print pkg_filter c = subprocess.Popen( ["reprepro"] + ["--waitforlock", "12"] + ["--basedir", self.path] + (["--architecture", architecture] if architecture else []) + (["--component", component ] if component else []) + ["listfilter", distribution , pkg_filter ], stdout=subprocess.PIPE) output = c.communicate()[0] if c.returncode: raise "Process exit with code: %s" % c.returncode for match in _regex_parse_list.finditer(output): if verscmp(match.group("version"), version) >= 0: print version return True return False
def WriteVersion(self): versions = self.GenerateChangelog() # determine last version in changelog lastchangelogversion = '0.0.0' tail = '' try: with codecs.open(self.tmpdir + "/hg/debian/changelog", 'r', 'utf-8') as f: tail = f.read() match = Build.findversion.search(tail) if match: lastchangelogversion = match.group("version") except: pass with codecs.open(self.tmpdir + "/hg/debian/changelog", 'w', 'utf-8') as f: nversions = 0 for version in sorted(versions, reverse=True, cmp=verscmp): if verscmp(version, lastchangelogversion ) > 0 and versions[version].HasChanges(): if version == 'tip': versions[version].description = self.buildtag f.write(versions[version].GetDebianFormatted( distributions=self.targetdistribution)) nversions += 1 if nversions == 0: if versions[self.buildtag]: f.write(versions[self.buildtag].GetDebianFormatted( distributions=self.targetdistribution)) else: self.buildtag = lastchangelogversion f.write(tail) # write version.id with the tag to be built with codecs.open(self.tmpdir + "/hg/version.id", 'w', 'utf-8') as f: f.write(self.buildtag)
def WriteVersion( self ): versions = self.GenerateChangelog() # determine last version in changelog lastchangelogversion = '0.0.0' tail = '' try: with codecs.open( self.tmpdir + "/hg/debian/changelog",'r', 'utf-8') as f: tail = f.read() match = Build.findversion.search( tail ) if match: lastchangelogversion = match.group("version") except: pass with codecs.open( self.tmpdir + "/hg/debian/changelog", 'w', 'utf-8') as f: nversions = 0 for version in sorted( versions, reverse=True, cmp=verscmp ): if verscmp(version, lastchangelogversion) > 0 and versions[version].HasChanges(): if version == 'tip': versions[version].description = self.buildtag f.write( versions[version].GetDebianFormatted( distributions=self.targetdistribution ) ) nversions += 1 if nversions == 0: if versions[self.buildtag]: f.write( versions[self.buildtag].GetDebianFormatted( distributions=self.targetdistribution ) ) else: self.buildtag = lastchangelogversion f.write(tail) # write version.id with the tag to be built with codecs.open( self.tmpdir + "/hg/version.id", 'w', 'utf-8') as f: f.write( self.buildtag )
def Exists(self, distribution, architecture, sourcename, version, component=None): arch_filter = "Architecture (==%s)," % architecture if architecture else "" # for packages that were part pkg_filter = [ "(%s Source (==%s))" % (arch_filter, sourcename), "(%s !Source,Package(==%s))" % (arch_filter, sourcename) ] pkg_filter = "|".join(pkg_filter) print pkg_filter c = subprocess.Popen( ["reprepro"] + ["--waitforlock", "12"] + ["--basedir", self.path] + (["--architecture", architecture] if architecture else []) + (["--component", component] if component else []) + ["listfilter", distribution, pkg_filter], stdout=subprocess.PIPE) output = c.communicate()[0] if c.returncode: raise "Process exit with code: %s" % c.returncode for match in _regex_parse_list.finditer(output): if verscmp(match.group("version"), version) >= 0: print version return True return False