From 57eb6631911258c7687c2b3e75c2a50e3a92770e Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 25 Jun 2018 16:26:16 -0400 Subject: sbosrcarch: check/status commands now write STATUS file in archive root --- sbosrcarch | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file 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 <