version.sh: A script for recording version info of a Gentoo system
authorW. Trevor King <wking@tremily.us>
Thu, 17 Jan 2013 16:19:00 +0000 (11:19 -0500)
committerW. Trevor King <wking@tremily.us>
Fri, 10 May 2013 15:31:07 +0000 (11:31 -0400)
You can get a reasonable way towards this with:

  $ equery list '*'

but that doesn't give you revision granularity for live ebuilds (where
ebuild version 9999 could be anything :p).  Since most of my
experimental stack is live, I wrote up this script.

notes/version.sh [new file with mode: 0755]

diff --git a/notes/version.sh b/notes/version.sh
new file mode 100755 (executable)
index 0000000..8d363ac
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+if [ "$1" = '-s' ]; then
+       filename=$(date +'%Y-%m-%dT%H-%M-%S-software-versions')
+       exec >"versions/$filename"
+fi
+
+echo "Live Git packages"
+echo
+for package in /usr/src/linux.git/.git /usr/portage/distfiles/egit-src/*; do
+       name=$(basename "$package")
+       if [ "$name" = '.git' ]; then
+               name=$(basename $(dirname "$package"))
+       fi
+       echo -en "$name\t"
+       GIT_DIR="$package" git --no-pager log -n1 --oneline
+done
+
+echo
+echo "Live Subversion packages"
+echo
+for package in /usr/portage/distfiles/svn-src/*; do
+       name=$(basename "$package")
+       echo -en "$name\t"
+       svn info "$package"/trunk
+done
+
+echo
+echo "Dead packages"
+echo
+for package in /var/db/pkg/*/*; do
+       name_version=$(basename "$package")
+       category=$(basename $(dirname "$package"))
+       echo "=$category/${name_version}"
+done