def _get_greatest_timeline(self, upstream, downstream): versions = VersionTree(upstream) greatest = Timeline(default="0") for date in downstream: version = downstream[date] greatest[date] = versions.max(greatest[-1],version) return greatest
def get_greatest_timeline(self): versions = VersionTree(self.timeline) greatest = Timeline(default="0") for date in self.timeline: versions.add_release(date, self.timeline[date]) greatest[date] = versions.max(greatest[-1], self.timeline[date]) return greatest
def _get_greatest_timeline(self, upstream, downstream): versions = VersionTree(upstream) greatest = Timeline(default="0") for date in downstream: version = downstream[date] greatest[date] = versions.max(greatest[-1], version) return greatest
def _compute_package_age(self, upstream, downstream): ms = timedelta(microseconds=1) versions = VersionTree() age = ConnectedTimeline(default=timedelta()) greatest_downstream = "0" u = 0 d = 0 #print #print "interleave" #interleave the dates while u + d < len(upstream) + len(downstream): version = None date = None if u < len(upstream) and ( len(downstream) == d or upstream.keys()[u] <= downstream.keys()[d]): if VERBOSE: print "upstream", upstream.keys()[u], upstream[u] date = upstream.keys()[u] version = upstream[u] versions.add_release(date, version) if greatest_downstream != "0": age[date] = versions.compute_lag(date, greatest_downstream) u += 1 else: version = downstream[d] date = downstream.keys()[d] if VERBOSE: print "downstream", date, version if VERBOSE: print greatest_downstream, version if greatest_downstream != "0": age[date] = versions.compute_lag(date, greatest_downstream) greatest_downstream = versions.max(greatest_downstream, version) if VERBOSE: print greatest_downstream age[date + ms] = versions.compute_lag(date, greatest_downstream) d += 1 #print #print "age" now = self._now if now == None: now = datetime.now() if greatest_downstream != None: age[now] = versions.compute_lag(now, greatest_downstream) if VERBOSE or VERBOSE_RESULT: for a in age: print a, age[a] print return age
def _compute_package_age(self, upstream, downstream): ms = timedelta(microseconds=1) versions = VersionTree() age = ConnectedTimeline(default=timedelta()) greatest_downstream = "0" u = 0 d = 0 #print #print "interleave" #interleave the dates while u+d < len(upstream)+len(downstream): version = None date = None if u<len(upstream) and (len(downstream)==d or upstream.keys()[u]<=downstream.keys()[d]): if VERBOSE: print "upstream",upstream.keys()[u],upstream[u] date = upstream.keys()[u] version = upstream[u] versions.add_release(date,version) if greatest_downstream != "0": age[date] = versions.compute_lag(date, greatest_downstream) u+=1 else: version = downstream[d] date = downstream.keys()[d] if VERBOSE: print "downstream", date, version if VERBOSE: print greatest_downstream, version if greatest_downstream != "0": age[date] = versions.compute_lag(date, greatest_downstream) greatest_downstream = versions.max(greatest_downstream,version) if VERBOSE: print greatest_downstream age[date+ms] = versions.compute_lag(date, greatest_downstream) d+=1 #print #print "age" now = self._now if now==None: now = datetime.now() if greatest_downstream!=None: age[now] = versions.compute_lag(now, greatest_downstream) if VERBOSE or VERBOSE_RESULT: for a in age: print a,age[a] print return age
def get_all_distros(packages, branch): distros = core.get_all_distros() return map(lambda name: DistroHistory(name, packages, branch), distros) if __name__ == "__main__": if len(sys.argv) < 2: print sys.argv[0], "<package>", "[distro]", "[branch]" sys.exit(1) #VERBOSE = True p = sys.argv[1] d = None b = "current" if len(sys.argv) > 2: d = sys.argv[2] if len(sys.argv) > 3: b = sys.argv[3] p = PackageHistory(p) print p vt = VersionTree(p.timeline) print vt if d != None: d = DistroHistory(d, [p], b) print d.get_lag_timeline() print d.get_obsoletion_count_timeline()