update-dockapps.pl: Handle earlier versions of dockapps with alternate names.

Some dockapps earlier versions of dockapps, e.g. the recently added wmacpi-ng,
may have different names than the directories they appear in.  This patch adds
the ability to handle this situation by keeping track of the directory for
getting git information and skipping these dockapps when creating the "+date"
versions.
This commit is contained in:
Doug Torrance 2014-08-22 11:50:21 -05:00 committed by Carlos R. Mafra
parent db658544cf
commit c4d9e36efd

View file

@ -56,6 +56,13 @@ my $r = Git::Repository->new();
my @tags = $r->run("tag"); my @tags = $r->run("tag");
my %dockapps; my %dockapps;
# If any earlier versions of a dockapp had an alternate name, e.g. a name change
# or a fork which has since been blessed, add it to this hash as 'alt' =>
# 'main'. The alternate should still have its own entry in dockapps.db.in.
my %alts = (
'wmacpi-ng' => 'wmacpi'
);
foreach my $tag (@tags) { foreach my $tag (@tags) {
$tag =~ /([\w\-+.]+)-([\w.]+)/; $tag =~ /([\w\-+.]+)-([\w.]+)/;
my $dockapp = $1; my $dockapp = $1;
@ -69,11 +76,18 @@ foreach my $tag (@tags) {
if (!$ls) { if (!$ls) {
$ls = $r->run("ls-tree", $tag, "$dockapp" . "_$version"); $ls = $r->run("ls-tree", $tag, "$dockapp" . "_$version");
} }
#for alts
if (!$ls) {
$ls = $r->run("ls-tree", $tag, $alts{$dockapp});
}
my $sha1 = (split(/\s/, $ls))[2]; my $sha1 = (split(/\s/, $ls))[2];
$dockapps{$dockapp}{$version} = $sha1; $dockapps{$dockapp}{$version} = $sha1;
} }
foreach my $dockapp (keys %dockapps) { foreach my $dockapp (keys %dockapps) {
if (grep {$_ eq $dockapp} keys %alts) {
next;
}
my $latest_version = (sort by_version keys $dockapps{$dockapp})[-1]; my $latest_version = (sort by_version keys $dockapps{$dockapp})[-1];
if ($r->run("diff", "$dockapp-$latest_version", "HEAD", $dockapp)) { if ($r->run("diff", "$dockapp-$latest_version", "HEAD", $dockapp)) {
my $commit = $r->run("log", "-1", my $commit = $r->run("log", "-1",