Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add extract-releases command; start filling in build command
  • Loading branch information
Geoffrey Broadwell committed Oct 21, 2012
1 parent f6ce8a9 commit 21065ad
Showing 1 changed file with 56 additions and 5 deletions.
61 changes: 56 additions & 5 deletions bench
Expand Up @@ -75,11 +75,62 @@ sub needs-setup ($action) {
}
}

multi MAIN ('build') {
# %*ENV<GIT_DIR> = $bare;
# my $tag_list = open 'git tag', :p;
# my @tags = $tag_list.lines;
# .say for @tags;
#= Extract historical releases from cloned components
multi MAIN ('extract-releases', *@components) {
needs-setup('extract releases');

say 'Parsing components.json ...';
my $components = from-json(slurp 'components.json');

chdir $COMPONENTS_DIR;
@components ||= dir('.').sort;

for @components -> $component-name {
say "==> $component-name";
chdir "$COMPONENTS_DIR/$component-name";

my $bare = "$component-name.git";
unless $bare.IO.d {
say "No bare repository exists for component $component-name; can't extract releases.";
next;
}

my $tag_regex = $components{$component-name}<release_tags> || '.';
%*ENV<GIT_DIR> = $bare;
my $tag_list = open 'git tag', :p;
my @tags = grep / <{ $tag_regex }> /, $tag_list.lines;
%*ENV.delete('GIT_DIR');

# Work around Rakudo bug #115390 by splitting into two loops
for @tags -> $tag {
next if $tag.IO.d;
run < git clone -l >, $bare, $tag;
}
for @tags -> $tag {
chdir $tag; LEAVE chdir '..';
run < git checkout -q >, $tag; # > -- Dang syntax highlighting
}
}

say 'Extraction complete.';
}

#= Build checked out component trees
multi MAIN ('build', *@components) {
needs-setup('build components');

chdir $COMPONENTS_DIR;
@components ||= dir('.').sort;


for @components -> $component-name {
say "==> $component-name";
chdir "$COMPONENTS_DIR/$component-name";

my $bare = "$component-name.git";
my @checkouts = dir('.', test => none('.', '..', $bare)).sort;
.say for @checkouts;
}
}

#= Clean up generated files and directories
Expand Down

0 comments on commit 21065ad

Please sign in to comment.