aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gentoolkit-dev/src/eviewcvs')
-rw-r--r--gentoolkit-dev/src/eviewcvs/AUTHORS1
-rw-r--r--gentoolkit-dev/src/eviewcvs/Makefile25
-rw-r--r--gentoolkit-dev/src/eviewcvs/README11
-rwxr-xr-xgentoolkit-dev/src/eviewcvs/eviewcvs95
-rw-r--r--gentoolkit-dev/src/eviewcvs/eviewcvs.pod48
5 files changed, 180 insertions, 0 deletions
diff --git a/gentoolkit-dev/src/eviewcvs/AUTHORS b/gentoolkit-dev/src/eviewcvs/AUTHORS
new file mode 100644
index 0000000..36d5bfd
--- /dev/null
+++ b/gentoolkit-dev/src/eviewcvs/AUTHORS
@@ -0,0 +1 @@
+Aron Griffis <agriffis@gentoo.org>
diff --git a/gentoolkit-dev/src/eviewcvs/Makefile b/gentoolkit-dev/src/eviewcvs/Makefile
new file mode 100644
index 0000000..7ab81c6
--- /dev/null
+++ b/gentoolkit-dev/src/eviewcvs/Makefile
@@ -0,0 +1,25 @@
+# Copyright 2005 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+#
+# $Header$
+
+include ../../makedefs.mak
+
+%.1 : %.pod
+ pod2man $< > $@
+
+.PHONY: all
+all: eviewcvs.1
+
+dist: eviewcvs.1
+ mkdir -p ../../$(distdir)/src/eviewcvs/
+ cp Makefile AUTHORS README eviewcvs eviewcvs.pod eviewcvs.1 ../../$(distdir)/src/eviewcvs/
+
+install: all
+ install -m 0755 eviewcvs $(bindir)/
+ install -d $(docdir)/eviewcvs
+ install -m 0644 AUTHORS README $(docdir)/eviewcvs/
+ install -m 0644 eviewcvs.1 $(mandir)/
+
+clean:
+ $(RM) eviewcvs.1
diff --git a/gentoolkit-dev/src/eviewcvs/README b/gentoolkit-dev/src/eviewcvs/README
new file mode 100644
index 0000000..c7258d7
--- /dev/null
+++ b/gentoolkit-dev/src/eviewcvs/README
@@ -0,0 +1,11 @@
+Most of the documentation is contained in the man-page, which you can
+read directly (using GNU man) by doing
+
+ man ./eviewcvs.1
+
+To rebuild the man-page from pod source, do
+
+ pod2man --name=eviewcvs --center='Gentoolkit' \
+ eviewcvs.pod eviewcvs.1
+
+03 Nov 2004 agriffis
diff --git a/gentoolkit-dev/src/eviewcvs/eviewcvs b/gentoolkit-dev/src/eviewcvs/eviewcvs
new file mode 100755
index 0000000..280ec0b
--- /dev/null
+++ b/gentoolkit-dev/src/eviewcvs/eviewcvs
@@ -0,0 +1,95 @@
+#!/bin/bash
+# $Id$
+#
+# Copyright 2005, Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Written by Aron Griffis <agriffis@gentoo.org>
+#
+# eviewcvs - generate viewcvs urls for some files
+#
+
+if [[ -t 1 ]]; then
+ blue=""
+ cyan=""
+ green=""
+ red=""
+ off=""
+else
+ unset blue cyan green red off
+fi
+
+startdir="$PWD"
+url="http://sources.gentoo.org/viewcvs.py"
+unset diffs
+declare -a hdr orev
+
+chdir() {
+ cd "$1" || return
+
+ # Figure out where we are, hopefully
+ unset cwd root
+ if [[ -f CVS/Repository ]]; then
+ cwd=$(<CVS/Repository)
+ elif [[ -f .svn/entries ]]; then
+ cwd=$(grep -om1 'url=.*' .svn/entries)
+ cwd=${cwd#*/var/svnroot/}
+ cwd=${cwd%\"*}
+ fi
+}
+
+# Default to all files in directory
+[[ -n $* ]] || set -- *
+
+for f in "$@"; do
+ [[ -f $f ]] || continue
+
+ # Determine the directory settings
+ if [[ $f == */* ]]; then
+ chdir ${f%/*}
+ f=${f##*/}
+ else
+ chdir ${startdir}
+ fi
+
+ # Default to the directory settings
+ fwd=$cwd
+
+ # Get the header for this file, from which we can extract the root,
+ # directory and revision
+ hdr=( $(egrep -m1 -o '\$(Header|Id):[^$]*\$' "$f") )
+ frev=${hdr[2]}
+ case ${hdr[*]} in
+ \$Header:\ /var/cvsroot/*/*\ \$*)
+ fwd=${hdr[1]} # /var/cvsroot/gentoo-src/keychain/keychain.sh,v
+ fwd=${fwd#/var/cvsroot/} # gentoo-src/keychain/keychain.sh,v
+ fwd=${fwd%/*} # gentoo-src/keychain
+ ;;
+ '')
+ if [[ -d CVS ]]; then
+ frev=$(cvs log "$f" 2>/dev/null | awk '/^head:/{print $2}')
+ elif [[ -d .svn ]]; then
+ frev=$(svn info "$f" 2>/dev/null | awk '/^Revision:/{print $2}')
+ fi
+ ;;
+ esac
+ [[ -n ${frev} ]] || continue
+
+ # Here is the simple URL to view it
+ echo "${url}/${fwd:+$fwd/}${green}${f}${off}?rev=${frev}&view=markup"
+
+ # Also supply a diff URL if possible
+ if [[ ${frev##*.} -gt 1 ]]; then
+ orev=( ${frev//./ } ) # convert to array
+ (( orev[${#orev[@]}-1]-- )) # decrement the last element
+ orev=${orev[*]} # convert to string
+ orev=${orev// /.} # revert spaces to dots
+ diffs="${diffs:+$diffs
+}${url}/${fwd:+$fwd/}${blue}${f}${off}?r1=${orev}&r2=${frev}"
+ fi
+done
+
+if [[ -n ${diffs} ]]; then
+ echo "${diffs}"
+fi
+
+# vim:set expandtab sw=4 smarttab:
diff --git a/gentoolkit-dev/src/eviewcvs/eviewcvs.pod b/gentoolkit-dev/src/eviewcvs/eviewcvs.pod
new file mode 100644
index 0000000..b4403c8
--- /dev/null
+++ b/gentoolkit-dev/src/eviewcvs/eviewcvs.pod
@@ -0,0 +1,48 @@
+=head1 NAME
+
+eviewcvs - Gentoo: generate viewcvs URLs
+
+=head1 SYNOPSIS
+
+eviewcvs [ I<files...> ]
+
+=head1 DESCRIPTION
+
+This tool generates a list of viewcvs URLs based on the files listed, or all the
+files in the current directory if the file list is omitted. The first part of
+the output, hilighted in green, is the simple URLs to view the files. The
+second part of the output, hilighted in blue, is the URLs to view the diffs
+against the previous revision.
+
+=head1 OPTIONS
+
+Presently eviewcvs is simple enough that it supplies no options.
+Probably I'll add B<--help> and B<--version> in the future, but for
+now it's enough to track the gentoolkit version.
+
+=head1 EXAMPLES
+
+To generate viewcvs URLs for a given file:
+
+ $ eviewcvs package.mask
+ http://www.gentoo.org/cgi-bin/viewcvs.cgi/profiles/package.mask?rev=1.3716&content-type=text/vnd.viewcvs-markup
+ http://www.gentoo.org/cgi-bin/viewcvs.cgi/profiles/package.mask?r1=1.3715&r2=1.3716
+
+To generate viewcvs URLs for all files in a directory:
+
+ $ cd portage/net-misc/keychain
+ $ eviewcvs
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/ChangeLog?rev=1.54&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/Manifest?rev=1.86&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/keychain-2.6.1.ebuild?rev=1.3&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/keychain-2.6.2.ebuild?rev=1.1&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/metadata.xml?rev=1.3&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/ChangeLog?r1=1.53&r2=1.54
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/Manifest?r1=1.85&r2=1.86
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/keychain-2.6.1.ebuild?r1=1.2&r2=1.3
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/metadata.xml?r1=1.2&r2=1.3
+
+=head1 AUTHOR
+
+This tool was written by Aron Griffis <agriffis@gentoo.org>. Bugs
+found should be filed against me at http://bugs.gentoo.org/