[Reproducible-commits] [misc] 03/03: reports: more automation

Ximin Luo infinity0 at debian.org
Tue May 17 14:08:50 UTC 2016


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

infinity0 pushed a commit to branch master
in repository misc.

commit 4b4883d16fe1ea812cd73116f4e25ad6369390c5
Author: Ximin Luo <infinity0 at debian.org>
Date:   Tue May 17 16:08:39 2016 +0200

    reports: more automation
---
 reports/README              | 16 ++++++++--------
 reports/bin/get-latest-data |  7 +++++--
 reports/bin/history         | 38 ++++++++++++++++++++++++++++++++++++++
 reports/bin/review-issues   |  7 +++++++
 reports/bin/review-stats    | 12 +++++++++---
 5 files changed, 67 insertions(+), 13 deletions(-)

diff --git a/reports/README b/reports/README
index a251b20..c2620df 100644
--- a/reports/README
+++ b/reports/README
@@ -32,14 +32,12 @@ Process
    might give some false positive: packages might have been
    reproducible before, broken by a toolchain upload later fixed.
 
-   The get-latest-data script will have already fetched the changelogs
-   for these packages; you can find them in ./changelogs.
-
-   One can also look at the history of the tests by typing:
+   One look at the history of the tests by typing:
 
        $ bin/history ghc                # defaults to unstable
        $ bin/history ghc experimental
        $ FULL=yes bin/history ghc       # more details
+       $ bin/history -c ghc             # also show changelogs
 
 2. Look at all relevant bug reports that have been modified this week.
 
@@ -61,7 +59,6 @@ Process
 
    Make sure you get a recent copy of `notes.git`. Then:
 
-       $ . ../misc/reports/latest/variables
        $ ../misc/reports/bin/review-stats
 
    The UDD query to know who reported how many FTBFS follows:
@@ -79,12 +76,15 @@ Process
 
    Make sure you get a recent copy of `notes.git`. Then:
 
-       $ . ../misc/reports/latest/variables
-       $ git log --since @$RB_REPORT_WEEK_START --until @$RB_REPORT_WEEK_END --graph -p master -- issues.yml
+       $ ../misc/reports/bin/review-issues
 
 6. Manually reported:
 
-       $ ssh -t alioth.debian.org less /home/groups/reproducible/weekly-log.txt
+       $ less latest/weekly-log.txt
+
+   Make sure you only look at the entries for the previous week, and
+   don't accidentally include the current week. (The previous week is
+   probably the second section.)
 
 7. Git repositories and custom toolchain:
 
diff --git a/reports/bin/get-latest-data b/reports/bin/get-latest-data
index 6eaa7ea..8dd61ed 100755
--- a/reports/bin/get-latest-data
+++ b/reports/bin/get-latest-data
@@ -55,10 +55,10 @@ echo >&2 "- changelogs of newly-reproducible packages"
 mkdir -p changelogs
 rm -f changelogs-failed && touch changelogs-failed
 
-for url in $("$scriptdir/newly-reproducible" | sed -n -e 's,.*<,,;s,>.*,,p' | sort -u); do
+for url in $(REPRODUCIBLE_DB=reproducible.db "$scriptdir/newly-reproducible" | sed -n -e 's,.*<,,;s,>.*,,p' | sort -u); do
 	p=${url%/*}; p=${p##*/};
 	echo -n "  * $p"
-	$TORSOCKS wget -q -O changelogs/$p "$url" || ( echo $url >> changelogs-failed ; echo -n " failed." )
+	$TORSOCKS wget -q -O changelogs/$p "$url" || ( rm changelogs/$p; echo $url >> changelogs-failed ; echo -n " failed." )
 	echo
 done
 
@@ -86,6 +86,9 @@ echo "SELECT DISTINCT bugs.id FROM bugs_usertags, bugs WHERE email = 'reproducib
   | ssh alioth.debian.org psql service=udd -t \
   | awk '/[0-9]/ { print $1 }' > bugs
 
+echo >&2 "- weekly-log.txt (will ssh to alioth.debian.org)"
+scp -q alioth.debian.org:/home/groups/reproducible/weekly-log.txt .
+
 ### report failures
 
 if [ -s changelogs-failed ] ; then
diff --git a/reports/bin/history b/reports/bin/history
index 3defa65..6506791 100755
--- a/reports/bin/history
+++ b/reports/bin/history
@@ -7,6 +7,21 @@
 
 # Set `FULL=yes` in the environment to get full output.
 
+changelog=false
+less=false
+while getopts 'lc' opt; do
+    case $opt in
+        c)
+            changelog=true
+            less=true
+            ;;
+        l)
+            less=true
+            ;;
+    esac
+done
+shift `expr $OPTIND - 1`
+
 if [ -n "$1" ]; then
     PACKAGE=$1
 else
@@ -23,8 +38,11 @@ if [ -n "$3" ]; then
 fi
 
 DB="${DB:-latest/reproducible.db}"
+LOGS="$(dirname "$DB")/changelogs"
 SQLITE_OPTS="${SQLITE_OPTS:--column -header}"
 
+main() {
+
 if [ "$FULL" ]; then
     QUERY="SELECT * FROM stats_build WHERE name='$PACKAGE' $SUITE ORDER BY build_date"
     WIDTH="5 0 0 0 0 15 0 0 13"
@@ -41,4 +59,24 @@ QUERY="SELECT s.id as 'pkg id', s.name, s.version, s.suite, s.architecture as ar
 FROM sources AS s JOIN results AS r ON r.package_id=s.id WHERE s.name='$PACKAGE'"
 WIDTH="6 0 0 0 5 6 0 0 16 0 13"
 RESULT="$(sqlite3 $SQLITE_OPTS -cmd ".width $WIDTH" "$DB" "$QUERY" 2> /dev/null)"
+
 if [ ! -z "$RESULT" ] ; then echo "$RESULT" ; else echo "$PACKAGE has not been built yet" ; fi
+
+}
+
+if $less; then
+    main | less +G
+else
+    main
+fi
+
+if $changelog; then
+    if [ -f "$LOGS/$PACKAGE" ]; then
+        less $LOGS/$PACKAGE
+    elif grep -qF "/$PACKAGE/" "${LOGS}-failed"; then
+        { echo "failed to download $(grep -F "/$PACKAGE/" "${LOGS}-failed")";
+        echo "probably superseded by a newer version; you should check this yourself"; } | less
+    else
+        echo "no changelog for $PACKAGE found for this period" | less
+    fi
+fi
diff --git a/reports/bin/review-issues b/reports/bin/review-issues
new file mode 100755
index 0000000..a0be53a
--- /dev/null
+++ b/reports/bin/review-issues
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+test -d ".git" || { echo >&2 "run this from notes.git"; exit 1; }
+scriptdir="$(readlink -f "$(dirname "$0")")"
+test -n "$RB_REPORT_WEEK_END" || { . "$scriptdir/../latest/variables"; }
+
+git log --since "@$RB_REPORT_WEEK_START" --until "@$RB_REPORT_WEEK_END" --graph -p master -- issues.yml
diff --git a/reports/bin/review-stats b/reports/bin/review-stats
index 3bcf057..47f3c19 100755
--- a/reports/bin/review-stats
+++ b/reports/bin/review-stats
@@ -12,12 +12,18 @@ import yaml
 
 if len(sys.argv) == 1:
     # get packages.yml from git if $1 $2 not set
+    self_path = sys.argv[0]
+    if not os.path.isdir(".git"):
+        raise ValueError("either run this in notes.git, or give $1 $2")
+    load_variables = ""
     if "RB_REPORT_WEEK_START" not in os.environ or "RB_REPORT_WEEK_END" not in os.environ:
-        raise ValueError("RB_REPORT_WEEK_{START,END} not set")
-    sys.exit(subprocess.check_call(["bash", "-c", """%s \
+        variables_path = os.path.join(os.path.dirname(self_path), "../latest/variables")
+        load_variables = ". %s; " % variables_path
+        print("RB_REPORT_WEEK_{START,END} not set, loading from %s" % variables_path, file=sys.stderr)
+    sys.exit(subprocess.check_call(["bash", "-c", """%s%s \
         <(git show $(git rev-list -n1 --until @$RB_REPORT_WEEK_START master):packages.yml) \
         <(git show $(git rev-list -n1 --until @$RB_REPORT_WEEK_END master):packages.yml)
-    """ % sys.argv[0]]))
+    """ % (load_variables, self_path)]))
 
 old = yaml.safe_load(open(sys.argv[1]))
 new = yaml.safe_load(open(sys.argv[2]))

-- 
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