Skip to content

Commit dd52a27

Browse files
committed
Add META.info -> META6.json swapping script
If future generations would want to repurpose it or something
1 parent 538ddf2 commit dd52a27

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tools/meta.p6

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
use WWW;
2+
constant REPO = 'https://github.com/perl6/ecosystem/';
3+
constant REPO-DIR = 'repo'.IO;
4+
constant META-FILE = REPO-DIR.add: 'META.list';
5+
6+
REPO-DIR.e or run <git clone >, REPO, REPO-DIR.absolute;
7+
chdir REPO-DIR;
8+
9+
loop {
10+
DateTime.now.say;
11+
run <git pull>;
12+
13+
my @metas = META-FILE.lines;
14+
my $changed = 0;
15+
for @metas {
16+
next unless .ends-with: 'META.info';
17+
my $new = .substr(0, * - chars '/META.info') ~ '/META6.json';
18+
say "Trying to fetch $new";
19+
get($new) and ++$changed and $_ = $new and say "\t$new is good!";
20+
}
21+
22+
if $changed {
23+
META-FILE.spurt: (|@metas, '').join: "\n";
24+
run <git commit>,
25+
'-m', '[automated commit] META.info→META6.json ('
26+
~ $changed ~ ' URLs)',
27+
META-FILE.absolute;
28+
29+
run <git pull --rebase>;
30+
run <git push>;
31+
}
32+
else {
33+
say "No dists changed";
34+
}
35+
say "Sleeping for half an hour";
36+
sleep 60*30;
37+
}
38+
39+
=finish
40+
41+
Checks the ecosystem dist URLs to META.info files to see whether
42+
META6.json alternative is available. If yes, swaps to META6.json
43+
and commits the change to the repo.
44+
45+
Creates directory `repo` in current directory and clones repo there.
46+
Performs the check every 30 minutes. Requires cached github
47+
credentials that have commit bit to ecosystem repo.

0 commit comments

Comments
 (0)