Exemplo n.º 1
0
def project(universe, options, config):
    """Project a copy of all the files in each checkout'ed repository
    into a plain, non-version-controlled directory in
    the projection directory, at (TODO) the latest tag specified in data.

    """
    space_key = 'node'  # FIXME hardcoded
    space = universe[space_key]

    checkout_dir = os.path.abspath(config[space_key]['checkout_dir'])
    projection_dir = os.path.abspath(config[space_key]['projection_dir'])
    try:
        os.makedirs(projection_dir)
    except OSError:
        pass

    cwd = os.getcwd()
    for (key, user, repo) in sorted(space.github_repos()):
        repo_path = os.path.join(checkout_dir, repo)
        os.chdir(repo_path)
        distname = get_distname(space[key])
        proj_path = os.path.join(projection_dir, distname)
        command = "rm -rf %s && git archive --format=tar --prefix=%s/ HEAD | (cd %s && tar xf -)" % (
            proj_path, distname, projection_dir
        )
        print command
        os.system(command)

    os.chdir(cwd)
Exemplo n.º 2
0
 def documentation_link(filename, key=key):
     node = self.universe.get_node(key)
     # This is a URL. TODO don't make so many assumptions in URLs.
     path = os.path.join(
         '..', 'view',
         get_distname(node),
         pathname2url(filename)
     )
     # TODO: stat the file, fallback to Github link if not there
     return path
Exemplo n.º 3
0
        def documentation(key=key):
            """Return a list of documentation file names for the given key."""
            filenames = []
            node = self.universe.get_node(key)
            if 'github' in node:
                path = os.path.join(
                    self.projection_dir, get_distname(node),
                )
                for filename in find_likely_documents(path):
                    filenames.append(filename)

            return sorted(filenames)
Exemplo n.º 4
0
def check_distfiles(universe, options, config):
    """Check for missing distfiles based on Chrysoberyl releases

    """
    # FIXME hardcoded
    depo = '/media/cpressey/Transcend/mine/catseye.tc/distfiles/'
    space = universe['node']  # FIXME hardcoded


    def v_name_to_rel_name(v_name):
        match = re.match(r'^(\d+)\.(\d+)\-(\d\d\d\d)\.(\d\d\d\d)$', v_name)
        if match:
            return 'rel_%s_%s_%s_%s' % match.groups()
        match = re.match(r'^(\d+)\.(\d+)$', v_name)
        if match:
            return 'rel_%s_%s' % match.groups()
        return v_name

    commands = []
    for (key, user, repo) in space.github_repos():
        for release in space[key]['releases']:
            url = release['url']
            match = re.match(r'^http\:\/\/catseye\.tc\/distfiles\/(.*?)$', url)
            if not match:
                raise ValueError(url)
            filename = os.path.join(depo, match.group(1))
            if not os.path.exists(filename):
                print filename
                distname = get_distname(space[key])
                match = re.match(r'^http\:\/\/catseye\.tc\/distfiles\/' + re.escape(distname) + r'\-(.*?)\.zip$', url)
                if not match:
                    raise ValueError(url)
                v_name = match.group(1)
                if not os.getenv('DECIMAL_VERSIONS'):
                    v_name = v_name_to_rel_name(v_name)
                command = "cd `toolshelf.py pwd %s` && toolshelf.py --output-dir=%s release .@%s" % (distname, depo, v_name)
                commands.append(command)

    print
    for command in commands:
        print command
Exemplo n.º 5
0
def check_releases(universe, options, config):
    """Check for missing Chrysoberyl releases based on hg tags.

    """

    # TODO: use version of this function from toolshelf release command
    def match_tag(tag):
        match = re.match(r'^rel_(\d+)_(\d+)_(\d\d\d\d)_?(\d\d\d\d)$', tag)
        if match:
            v_maj = match.group(1)
            v_min = match.group(2)
            r_maj = match.group(3)
            r_min = match.group(4)
            v_name = '%s.%s-%s.%s' % (
                v_maj, v_min, r_maj, r_min
            )
            return (v_maj, v_min, r_maj, r_min, v_name)
    
        match = re.match(r'^rel_(\d+)_(\d+)$', tag)
        if not match:
            match = re.match(r'^v?(\d+)\.(\d+)$', tag)
        if match:
            v_maj = match.group(1)
            v_min = match.group(2)
            v_name = '%s.%s' % (v_maj, v_min)
            return (v_maj, v_min, "0", "0", v_name)
    
        match = re.match(r'^v?(\d+)\.(\d+)\-(\d+)\.(\d+)$', tag)
        if match:
            v_maj = match.group(1)
            v_min = match.group(2)
            r_maj = match.group(3)
            r_min = match.group(4)
            v_name = '%s.%s-%s.%s' % (
                v_maj, v_min, r_maj, r_min
            )
            return (v_maj, v_min, r_maj, r_min, v_name)

        return None

    def print_release(version):
        print """\
  - version: "%s"
    revision: "%s"
    url: %s""" % (version['version'], version['revision'], version['url'])

    passes = 0
    space = universe['node']  # FIXME hardcoded
    for (key, user, repo) in sorted(space.github_repos()):
        if key in ('The Dipple', 'Illgol: Grand Mal',):
            continue

        releases = space[key]['releases']

        # record releases which are associated with a tag that does exist,
        # so we can filter them out at the discovery phase
        release_tags = set()
        for r in releases:
            tag = r.get('tag', None)
            if tag:
                release_tags.add(tag)

        versions = []
        tags = []
        source = shelf.make_source_from_spec('github.com/%s/%s' % (user, repo))
        for tag, hg_rev in source.each_tag():
            tags.append((tag, hg_rev))
            if tag in ('tip',) or tag in release_tags:
                continue
            result = match_tag(tag)
            if not result:
                print "Weird tag in %s: '%s'.  Skipping." % (key, tag)
                continue
            (v_maj, v_min, r_maj, r_min, v_name) = result
            distname = get_distname(space[key])
            versions.append((hg_rev, {
                'url': 'http://catseye.tc/distfiles/%s-%s.zip' % (distname, v_name),
                'version': "%s.%s" % (v_maj, v_min),
                'revision': "%s.%s" % (r_maj, r_min),
            }))
        versions = [version[1] for version in sorted(versions)]

        def strip_release(r):
            return {
               'version': str(r['version']), 'revision': str(r['revision'])
            }

        stripped_releases = [strip_release(v) for v in releases]

        missing_releases = []
        for version in versions:
            if strip_release(version) not in stripped_releases:
                missing_releases.append(version)

        if not missing_releases:
            passes += 1
        else:
            print '-' * 40
            print key
            print '-' * 40
            print
            for release in releases:
                print_release(release)
            print
            for (tag, hg_rev) in tags:
                print "%20s %5d" % (tag, hg_rev)
            print
            print "** MISSING: **"
            print
            for release in missing_releases:
                print_release(release)
            print

    print
    print "%s passed" % passes