def nightly_complete_mars(self, branch="trunk"): """Generate the paths to the complete .mar file for all nightly builds (most recent first). """ years = buildutils.remote_glob(rjoin(self.nightly_base_dir, "????")) for year_dir in sorted(years, reverse=True): year = rbasename(year_dir) if not _isint(year): continue months = buildutils.remote_glob(rjoin(year_dir, "??")) for month_dir in sorted(months, reverse=True): month = rbasename(month_dir) if not _isint(month): continue nightlies = buildutils.remote_glob( rjoin(month_dir, "????-??-??-??-" + branch)) for nightly_dir in sorted(nightlies, reverse=True): pat = "%s-%s.*-%s-complete.mar" % ( self.pkg_prefix, self.ver_bits[0], self.platname) complete_mar_paths = buildutils.remote_glob( rjoin(nightly_dir, "updates", pat)) if len(complete_mar_paths) < 1: continue elif len(complete_mar_paths) > 1: log.warn( "`%s' has multiple complete update packages " "matching `%s': %r" % (nightly_dir, pat, ", ".join( rbasename(p) for p in complete_mar_paths))) continue yield complete_mar_paths[0]
def nightly_complete_mars(self, branch="trunk"): """Generate the paths to the complete .mar file for all nightly builds (most recent first). """ years = buildutils.remote_glob(rjoin(self.nightly_base_dir, "????")) for year_dir in sorted(years, reverse=True): year = rbasename(year_dir) if not _isint(year): continue months = buildutils.remote_glob(rjoin(year_dir, "??")) for month_dir in sorted(months, reverse=True): month = rbasename(month_dir) if not _isint(month): continue nightlies = buildutils.remote_glob( rjoin(month_dir, "????-??-??-??-"+branch)) for nightly_dir in sorted(nightlies, reverse=True): pat = "%s-%s.*-%s-complete.mar" % ( self.pkg_prefix, self.ver_bits[0], self.platname) complete_mar_paths = buildutils.remote_glob( rjoin(nightly_dir, "updates", pat)) if len(complete_mar_paths) < 1: continue elif len(complete_mar_paths) > 1: log.warn("`%s' has multiple complete update packages " "matching `%s': %r" % (nightly_dir, pat, ", ".join(rbasename(p) for p in complete_mar_paths))) continue yield complete_mar_paths[0]
def get_devbuild_dir(short_ver, repo_name, branch, rev=None): """Return the devbuild dir for the given version, repo, branch and, if given, revision. @param short_ver {str} A Komodo short version, e.g. "5.2.0a1". @param repo_name {str} One of "assvn" (from which Komodo IDE is built) or "oksvn" (from which Komodo Edit is built). @param branch {str} The Komodo branch from which the dev build was built. @param rev {int} A devbuild revision to use. If not given, then the latest available revision is returned. """ if rev is None: pat = rjoin(g_remote_builds_dir, short_ver, "DevBuilds", "%s-%s-*" % (repo_name, norm_branch_from_branch(branch))) revs = [] dir_from_rev = {} for path in buildutils.remote_glob(pat): rev = int(path.rsplit('-', 1)[1]) revs.append(rev) dir_from_rev[rev] = path revs.sort() return dir_from_rev[revs[-1]] else: return rjoin( g_remote_builds_dir, short_ver, "DevBuilds", "%s-%s-%s" % (repo_name, norm_branch_from_branch(branch), rev))
def get_devbuild_dir(short_ver, repo_name, branch, rev=None): """Return the devbuild dir for the given version, repo, branch and, if given, revision. @param short_ver {str} A Komodo short version, e.g. "5.2.0a1". @param repo_name {str} One of "assvn" (from which Komodo IDE is built) or "oksvn" (from which Komodo Edit is built). @param branch {str} The Komodo branch from which the dev build was built. @param rev {int} A devbuild revision to use. If not given, then the latest available revision is returned. """ if rev is None: pat = rjoin(g_remote_builds_dir, short_ver, "DevBuilds", "%s-%s-*" % (repo_name, norm_branch_from_branch(branch))) revs = [] dir_from_rev = {} for path in buildutils.remote_glob(pat): rev = int(path.rsplit('-', 1)[1]) revs.append(rev) dir_from_rev[rev] = path revs.sort() return dir_from_rev[revs[-1]] else: return rjoin(g_remote_builds_dir, short_ver, "DevBuilds", "%s-%s-%s" % (repo_name, norm_branch_from_branch(branch), rev))
def _get_last_release_complete_mar(self, include_betas=False): for ver, ver_str, is_beta in self.released_versions: if ver[0] != self.ver_bits[0]: # Only build partial updates within the same major release # stream. continue if not include_betas and is_beta: continue last_release_ver = ver last_release_ver_dir = ver_str break else: return None last_release_ver_str = '.'.join(map(str, last_release_ver[:3])) if last_release_ver[3] == 'a': last_release_ver_str += "-alpha%d" % last_release_ver[4] elif last_release_ver[3] == 'b': last_release_ver_str += "-beta%d" % last_release_ver[4] elif last_release_ver[3] == 'c': last_release_ver_str += "-rc%d" % last_release_ver[4] last_release_ver_str += "-%s" % last_release_ver[5] mar_name = "%s-%s-%s-complete.mar" \ % (self.pkg_prefix, last_release_ver_str, self.platname) goldbits_dir = rjoin(self.pkg_base_dir, last_release_ver_dir, "GoldBits") candidates = [ rjoin(goldbits_dir, "updates", mar_name), rjoin(goldbits_dir, mar_name), ] for candidate in candidates: mar_paths = buildutils.remote_glob(candidate) if mar_paths: return mar_paths[0]
def released_versions(self): """Generate the list of Komodo releases (latest first). A Komodo "release" counts if there is a ver dir in the Komodo builds share with a GoldBits directory. Returns 3-tuples: (<parsed-version-tuple>, <version-string>, <is-beta>) E.g.: ((4,2,0,'b',1,12345), "4.2.0b1", True) ((6,0,0,'c',0,12346), "6.0.0c1", True) ((4,1,1,'f',0,12346), "4.1.1", False) """ if self._released_versions_cache is None: self._released_versions_cache = [] for f in buildutils.remote_glob( rjoin(self.pkg_base_dir, "*", "GoldBits")): ver_str = basename(dirname(f)) try: ver = buildutils.split_short_ver(ver_str, intify=True) except ValueError, ex: log.warn("invalid GoldBits dir `%s': %s", f, ex) continue if len(ver) == 3: # e.g. (4,1,0) -> (4,1,0,'c',0) # This helps sort 4.1.0 before 4.1.0b2. ver = (ver[0], ver[1], ver[2], 'f', 0) is_beta = False else: is_beta = True pkg_pat = rjoin(self.pkg_base_dir, ver_str, "GoldBits", "%s-*-*.msi" % self.pkg_prefix) for p in buildutils.remote_glob(pkg_pat): # Warning: This parse is brittle. changenum = int(splitext(basename(p))[0].split('-')[-1]) break else: #log.warn("skip version '%s' (can't determine changenum)", # ver_str) continue ver = tuple(list(ver) + [changenum]) self._released_versions_cache.append( (ver, ver_str, is_beta) ) self._released_versions_cache.sort(reverse=True)
def released_versions(self): """Generate the list of Komodo releases (latest first). A Komodo "release" counts if there is a ver dir in the Komodo builds share with a GoldBits directory. Returns 3-tuples: (<parsed-version-tuple>, <version-string>, <is-beta>) E.g.: ((4,2,0,'b',1,12345), "4.2.0b1", True) ((6,0,0,'c',0,12346), "6.0.0c1", True) ((4,1,1,'f',0,12346), "4.1.1", False) """ if self._released_versions_cache is None: self._released_versions_cache = [] for f in buildutils.remote_glob( rjoin(self.pkg_base_dir, "*", "GoldBits")): ver_str = basename(dirname(f)) try: ver = buildutils.split_short_ver(ver_str, intify=True) except ValueError, ex: log.warn("invalid GoldBits dir `%s': %s", f, ex) continue if len(ver) == 3: # e.g. (4,1,0) -> (4,1,0,'c',0) # This helps sort 4.1.0 before 4.1.0b2. ver = (ver[0], ver[1], ver[2], 'f', 0) is_beta = False else: is_beta = True pkg_pat = rjoin(self.pkg_base_dir, ver_str, "GoldBits", "%s-*-*.msi" % self.pkg_prefix) for p in buildutils.remote_glob(pkg_pat): # Warning: This parse is brittle. changenum = int(splitext(basename(p))[0].split('-')[-1]) break else: #log.warn("skip version '%s' (can't determine changenum)", # ver_str) continue ver = tuple(list(ver) + [changenum]) self._released_versions_cache.append((ver, ver_str, is_beta)) self._released_versions_cache.sort(reverse=True)
def dev_complete_mar_from_changenum(self, changenum): """Return the remote path to the dev build complete .mar file for the given change number, if any. Otherwise, returns None. """ pat = "%s-%s-%s-%s-complete.mar" \ % (self.pkg_prefix, self.version, changenum, self.platname) pat = rjoin(self.devbuilds_base_dir, str(changenum), pat) mar_paths = buildutils.remote_glob(pat) if mar_paths: return mar_paths[0] else: return None
def dev_partial_mars_from_changenum(self, changenum): """Return the remote paths to the dev build partial .mar files for the given change number, if any. Otherwise, returns None. """ pat = "%s-%s-%s-%s-partial-*.mar" \ % (self.pkg_prefix, self.version, changenum, self.platname) candidates = [ rjoin(self.devbuilds_base_dir, str(changenum), "updates", pat), rjoin(self.devbuilds_base_dir, str(changenum), pat), ] for candidate in candidates: mar_paths = buildutils.remote_glob(candidate) if mar_paths: return mar_paths