summaryrefslogtreecommitdiff
path: root/Porting/make_snapshot.pl
diff options
context:
space:
mode:
authorYves Orton <demerphq@gemini.(none)>2009-07-28 13:02:00 +0200
committerYves Orton <demerphq@gemini.(none)>2009-07-28 13:02:00 +0200
commitfe4f778754e1e2a5e05eddcd123ab68c16b18ab9 (patch)
treea7b88458edd3cbd2a9d4d9d22da0f03aac77cd0b /Porting/make_snapshot.pl
parenta23cb041bc3354bdcb49e0dd42a3683d9850d471 (diff)
downloadperl-fe4f778754e1e2a5e05eddcd123ab68c16b18ab9.tar.gz
changes required to Make It Work on the perl gitweb host
Diffstat (limited to 'Porting/make_snapshot.pl')
-rwxr-xr-xPorting/make_snapshot.pl40
1 files changed, 25 insertions, 15 deletions
diff --git a/Porting/make_snapshot.pl b/Porting/make_snapshot.pl
index 6ff3c93858..cab61b17b2 100755
--- a/Porting/make_snapshot.pl
+++ b/Porting/make_snapshot.pl
@@ -4,23 +4,33 @@ use warnings;
use File::Path;
use Cwd;
+# This is a quick and dirty snapshot generator for the perl5.git.perl.org web page
+# to use to generate the snapshot files. Yes it is ugly and contains hard coded crap
+# and could use some love. But for this todo I am out of time now. -- Yves
+
+$ENV{PATH}="/usr/local/bin:/bin/";
+
use POSIX qw(strftime);
sub isotime { strftime "%Y-%m-%d.%H:%M:%S",gmtime(shift||time) }
my ($abbr,$sha1,$tstamp);
$sha1= shift || "HEAD";
-my $zip_root= $ENV{PERL_SNAPSHOT_ZIP_ROOT} || "/gitcommon/branches/snapshot";
+my $zip_root= $ENV{PERL_SNAPSHOT_ZIP_ROOT} || "/gitcommon/snapshot/tgz";
my $gitdir= shift || `git rev-parse --git-dir`
or die "Not a git repo!\n";
-chomp $gitdir;
+chomp( $gitdir,$sha1);
my $workdir= $gitdir;
+my $is_bare;
if ( $workdir =~ s!/\.git\z!! ) {
- chdir $workdir
+
+ chdir $workdir
or die "Failed to chdir to $workdir\n";
} else {
+ $is_bare= 1;
chdir $workdir
or die "Failed to chdir to bare repo $workdir\n";
}
+#'die $workdir;
($sha1, $abbr,$tstamp)= split /\s+/, `git log --pretty='format:%H %h %ct' -1 $sha1`
or die "Failed to parse '$sha1'\n";
@@ -30,25 +40,25 @@ chomp($sha1,$abbr,$tstamp);
my $path= join "/", $zip_root, substr($sha1,0,2), substr($sha1,0,4);
my $tar_file= "$sha1.tar.$$";
-my $gz_file= "$sha1.tgz";
+my $gz_file= "$sha1.tar.gz";
my $prefix= "perl-$abbr/";
if (!-e "$path/$gz_file") {
mkpath $path if !-d $path;
system("git archive --format=tar --prefix=$prefix $sha1 > $path/$tar_file");
- my @branches=(
- 'origin/blead',
- 'origin/maint-5.10',
- 'origin/maint-5.8',
- 'origin/maint-5.8-dor',
- 'origin/maint-5.6',
- 'origin/maint-5.005',
- 'origin/maint-5.004',
+ my @branches=map { $is_bare ? $_ : "origin/$_" } (
+ 'blead',
+ 'maint-5.10',
+ 'maint-5.8',
+ 'maint-5.8-dor',
+ 'maint-5.6',
+ 'maint-5.005',
+ 'maint-5.004',
);
my $branch;
foreach my $b (@branches) {
- $branch= $b and last
+ $branch= $b and last
if `git log --pretty='format:%H' $b | grep $sha1`;
}
@@ -57,12 +67,12 @@ if (!-e "$path/$gz_file") {
chdir $path;
{
open my $fh,">","$path/$$.patch" or die "Failed to open $$.patch for writing\n";
- print $fh join(" ", $branch, $tstamp, $sha1, $describe) . "\n";
+ print $fh join(" ", $branch, isotime($tstamp), $sha1, $describe) . "\n";
close $fh;
}
system("tar -f $tar_file --transform='s,^$$,$prefix,g' --owner=root --group=root --mode=664 --append $$.patch");
system("gzip -S .gz -9 $tar_file");
rename "$tar_file.gz", "$gz_file";
}
-print "$path/$gz_file", -t STDOUT ? "\n" :"";
+print "ok\tperl-$abbr.tar.gz\t$path/$gz_file", -t STDOUT ? "\n" :"";