[Reproducible-commits] [misc] 01/01: added script to determine age of notes

Reiner Herrmann reiner at reiner-h.de
Sun Nov 29 10:58:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

deki-guest pushed a commit to branch master
in repository misc.

commit b012c16d7349a30b3c906851c171670abbced407
Author: Reiner Herrmann <reiner at reiner-h.de>
Date:   Sun Nov 29 11:56:44 2015 +0100

    added script to determine age of notes
---
 list-notes-age.pl | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/list-notes-age.pl b/list-notes-age.pl
new file mode 100755
index 0000000..9c6605f
--- /dev/null
+++ b/list-notes-age.pl
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+#
+# Print packages from the notes with the date
+# of their last modification.
+# Can be used to find oldest notes, e.g.
+# list-notes-age.pl | sort -r
+#
+
+use strict;
+use warnings;
+
+use POSIX qw(strftime);
+
+my $file = "packages.yml";
+my $packages = {};
+my $pkg;
+
+die "Can't find $file." unless(-e $file);
+
+open FH, "git blame -t $file|" or die "$!";
+while(<FH>) {
+    if (m/[\da-f]+ .*\s+(\d{10}) [\d\-\+]+\s+\d+\) (.*)/) {
+        my $timestamp = $1;
+        my $line = $2;
+        if ($line =~ m/^([^ \t].*):/) {
+            $pkg = $1;
+        }
+
+        if (!exists($packages->{$pkg}) or $packages->{$pkg} < $timestamp) {
+            $packages->{$pkg} = $timestamp;
+        }
+    }
+}
+close FH;
+
+foreach (sort keys %$packages) {
+    my $date = strftime("%F", gmtime($packages->{$_}));
+    print "$date  $_\n";
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/misc.git



More information about the Reproducible-commits mailing list