aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2018-06-25 16:26:16 -0400
committerB. Watson <yalhcru@gmail.com>2018-06-25 16:26:16 -0400
commit57eb6631911258c7687c2b3e75c2a50e3a92770e (patch)
tree5d9000e5dd064c1bc54d39fbf9af7c4eacea2220
parenta3d0081d2236b83428923da2aee03124ecde552b (diff)
downloadsbostuff-57eb6631911258c7687c2b3e75c2a50e3a92770e.tar.gz
sbosrcarch: check/status commands now write STATUS file in archive root
-rwxr-xr-xsbosrcarch44
1 files changed, 39 insertions, 5 deletions
diff --git a/sbosrcarch b/sbosrcarch
index 0a1c88d..68b5c4d 100755
--- a/sbosrcarch
+++ b/sbosrcarch
@@ -1699,6 +1699,38 @@ sub check_info_wanted {
$allmd5sums{$_}++ for values %$dls;
}
+# write status results to STATUS file in the root of the archive
+# dir. if there's an old STATUS, it gets renamed to STATUS.old.
+# errors will be silently ignored (e.g. permission denied).
+sub write_status_file {
+ my $content = shift;
+
+ init_git();
+ open my $fh, "git log --date=format:%Y%m%d --pretty=format:'%h %ci: %an, %s' -n1|" or die "$!";
+ my $logline = <$fh>;
+ close $fh;
+
+ chdir($archivedir) or die "$archivedir: $!";
+ rename("STATUS", "STATUS.old"); # ignore errors
+ open($fh, '>', "STATUS") or return;
+
+ chomp(my $timestamp = `date '+%Y-%m-%d %H:%M:%S %z'`);
+
+ print $fh <<EOF;
+Status report for sbosrcarch archive
+------------------------------------
+
+This report was generated on $timestamp.
+
+Last SBo git commit was:
+$logline
+
+$content
+EOF
+
+ close $fh;
+}
+
sub check_mode {
$quickcheck = shift; # 1 = don't md5sum stuff
shift @ARGV;
@@ -1740,7 +1772,7 @@ sub check_mode {
my $md5_missingfiles = $md5_totalfiles - $md5_filecount;
my $md5_filecoverage = sprintf("%.2f", $md5_filecount * 100 / $md5_totalfiles);
- print <<EOF;
+ my $output = <<EOF;
--- by-name status:
Total source files: $totalfiles
@@ -1758,13 +1790,13 @@ SlackBuild coverage: $coverage%
EOF
if(@missingfilebuilds) {
- print "Following SlackBuilds are missing by-name files:\n";
- print " $_\n" for sort { $a cmp $b } @missingfilebuilds;
+ $output .= "Following SlackBuilds are missing by-name files:\n";
+ $output .= " $_\n" for sort { $a cmp $b } @missingfilebuilds;
} else {
- print "All SlackBuild download files present in by-name.\n";
+ $output .= "All SlackBuild download files present in by-name.\n";
}
- print <<EOF;
+ $output .= <<EOF;
--- by-md5 status:
Total source files: $md5_totalfiles
@@ -1774,6 +1806,8 @@ Extraneous files: $extraneous_bymd5
File coverage: $md5_filecoverage%
EOF
+ print $output;
+ write_status_file($output);
exit 0;
}