[Surfraw-commits] [SCM] surfraw - a fast unix command line interface to WWW branch, master, updated. surfraw_2-2-5_1-5-g18201e4

Ian Beckwith ianb at erislabs.net
Tue Jul 21 03:24:47 UTC 2009


The following commit has been merged in the master branch:
commit 2569e6f6d8d1f350b9bedbcd0d77a1484e1bd12b
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Tue Jul 21 04:21:56 2009 +0100

    new elvi: debvcsbrowse

diff --git a/ChangeLog b/ChangeLog
index b944ba7..3b2c15c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-21  Ian Beckwith  <ianb at erislabs.net>
+
+	* New elvi: debvcsbrowse.
+
 2009-06-28  Ian Beckwith  <ianb at erislabs.net>
 
 	* Bump version to 2.2.6.
diff --git a/NEWS b/NEWS
index f27179f..ad353ca 100644
--- a/NEWS
+++ b/NEWS
@@ -15,9 +15,10 @@
 
 				  N E W S
 
-Sun Jun 28 23:24:35 BST 2009  - surfraw 2.2.6
+Tue Jul 21 04:13:16 BST 2009  - surfraw 2.2.6
 
-  * Fix bookmarks with multiple matches
+  * New elvi: debvcsbrowse.
+  * Fix bookmarks with multiple matches.
 
 
 Wed May 13 02:30:21 BST 2009  - surfraw 2.2.5
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index 652d39f..f33fe49 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -28,6 +28,7 @@ dist_elvi_SCRIPTS	= \
 		  debpackages \
 		  debpts \
 		  debsec \
+		  debvcsbrowse \
 		  debwiki \
 		  deja \
 		  discogs \
diff --git a/elvi/Makefile.in b/elvi/Makefile.in
index 398bc99..bdd7164 100644
--- a/elvi/Makefile.in
+++ b/elvi/Makefile.in
@@ -43,15 +43,15 @@ CONFIG_CLEAN_FILES =
 am__dist_elvi_SCRIPTS_DIST = W alioth altavista amazon archpkg arxiv \
 	ask aur austlii bbcnews cddb cia cite cnn codesearch comlaw \
 	ctan currency cve debbugs debcontents deblists deblogs \
-	debpackages debpts debsec debwiki deja discogs dmoz ebay etym \
-	excite fast foldoc filesearching freebsd freedb freshmeat \
-	fsfdir genpkg genportage gutenberg ixquick google happypenguin \
-	imdb javasun scpan slinuxdoc lastfm leodict lsm musicbrainz \
-	netbsd ntrs openbsd piratebay pgpkeys port pubmed rae rfc \
-	rhyme scholar scicom slashdot sourceforge springer stockquote \
-	sunonesearch thesaurus translate urban w3css w3html w3link \
-	w3rdf wayback webster wetandwild wikipedia woffle yahoo yubnub \
-	opensearch
+	debpackages debpts debsec debvcsbrowse debwiki deja discogs \
+	dmoz ebay etym excite fast foldoc filesearching freebsd freedb \
+	freshmeat fsfdir genpkg genportage gutenberg ixquick google \
+	happypenguin imdb javasun scpan slinuxdoc lastfm leodict lsm \
+	musicbrainz netbsd ntrs openbsd piratebay pgpkeys port pubmed \
+	rae rfc rhyme scholar scicom slashdot sourceforge springer \
+	stockquote sunonesearch thesaurus translate urban w3css w3html \
+	w3link w3rdf wayback webster wetandwild wikipedia woffle yahoo \
+	yubnub opensearch
 am__installdirs = "$(DESTDIR)$(elvidir)"
 dist_elviSCRIPT_INSTALL = $(INSTALL_SCRIPT)
 SCRIPTS = $(dist_elvi_SCRIPTS)
@@ -139,14 +139,14 @@ elvidir = $(ELVIDIR)
 dist_elvi_SCRIPTS = W alioth altavista amazon archpkg arxiv ask aur \
 	austlii bbcnews cddb cia cite cnn codesearch comlaw ctan \
 	currency cve debbugs debcontents deblists deblogs debpackages \
-	debpts debsec debwiki deja discogs dmoz ebay etym excite fast \
-	foldoc filesearching freebsd freedb freshmeat fsfdir genpkg \
-	genportage gutenberg ixquick google happypenguin imdb javasun \
-	scpan slinuxdoc lastfm leodict lsm musicbrainz netbsd ntrs \
-	openbsd piratebay pgpkeys port pubmed rae rfc rhyme scholar \
-	scicom slashdot sourceforge springer stockquote sunonesearch \
-	thesaurus translate urban w3css w3html w3link w3rdf wayback \
-	webster wetandwild wikipedia woffle yahoo yubnub \
+	debpts debsec debvcsbrowse debwiki deja discogs dmoz ebay etym \
+	excite fast foldoc filesearching freebsd freedb freshmeat \
+	fsfdir genpkg genportage gutenberg ixquick google happypenguin \
+	imdb javasun scpan slinuxdoc lastfm leodict lsm musicbrainz \
+	netbsd ntrs openbsd piratebay pgpkeys port pubmed rae rfc \
+	rhyme scholar scicom slashdot sourceforge springer stockquote \
+	sunonesearch thesaurus translate urban w3css w3html w3link \
+	w3rdf wayback webster wetandwild wikipedia woffle yahoo yubnub \
 	$(am__append_1)
 all: all-am
 
diff --git a/elvi/debvcsbrowse b/elvi/debvcsbrowse
new file mode 100755
index 0000000..2be27cb
--- /dev/null
+++ b/elvi/debvcsbrowse
@@ -0,0 +1,76 @@
+#!/bin/sh
+# elvis: debvcsbrowse	-- Browse the VCS repository for a Debian package
+. surfraw || exit 1
+
+w3_usage_hook () {
+    cat <<EOF
+Usage: $w3_argv0 [package|file.dsc|controlfile]
+Description:
+  Browse the VCS repository for a Debian package
+EOF
+    w3_global_usage
+}
+
+extract_vcs_browser ()
+{
+    # sed /I is a gnu extension
+    grep -i '^vcs-browser:' | head -1 | \
+    	sed 's/^[Vv][Cc][Ss]-[Bb][Rr][Oo][Ww][Ss][Ee][Rr]: *//;'
+}
+
+do_control()
+{
+    if [ ! -f $1 ]
+    then
+	err $1": file not found"
+	return
+    fi
+    OUT="$(cat $1 | extract_vcs_browser)"
+    if [ -z "$OUT" ]
+    then
+	err $1": no Vcs-Browser field"
+    else
+	echo "$OUT"
+    fi
+}
+
+do_package()
+{
+    if [ ! -x "`which apt-cache`" ]
+    then
+	err "apt-cache not installed. Try finding the vcs via debpts instead"
+	return
+    fi
+    OUT="$(apt-cache showsrc $1)"
+    if [ -z "$OUT" ]
+    then
+	err $1": package not found"
+	return
+    fi
+    OUT="$(echo "$OUT" | extract_vcs_browser)"
+    if [ -z "$OUT" ]
+    then
+	err $1": no Vcs-Browser field"
+    else
+	echo "$OUT"
+    fi
+}
+
+w3_config
+w3_parse_args "$@"
+# w3_args now contains a list of arguments
+
+if test -z "$w3_args"; then
+    w3_usage_hook
+    exit
+fi
+
+case "$w3_args" in
+     *.dsc|*control) url="$(do_control "$w3_args")"  ;;
+     *)              url="$(do_package "$w3_args")"  ;;
+esac
+
+if [ -n "$url" ]
+then
+    w3_browse_url "$url"
+fi
diff --git a/links.IN b/links.IN
index 9070574..67f888a 100644
--- a/links.IN
+++ b/links.IN
@@ -24,6 +24,7 @@ elvi.1sr.gz @mandir@/man1/deblogs.1sr.gz
 elvi.1sr.gz @mandir@/man1/debpackages.1sr.gz
 elvi.1sr.gz @mandir@/man1/debpts.1sr.gz
 elvi.1sr.gz @mandir@/man1/debsec.1sr.gz
+elvi.1sr.gz @mandir@/man1/debvcsbrowse.1sr.gz
 elvi.1sr.gz @mandir@/man1/debwiki.1sr.gz
 elvi.1sr.gz @mandir@/man1/deja.1sr.gz
 elvi.1sr.gz @mandir@/man1/discogs.1sr.gz
diff --git a/surfraw.IN b/surfraw.IN
index 3137a46..880d3e0 100644
--- a/surfraw.IN
+++ b/surfraw.IN
@@ -34,11 +34,11 @@ w3_config () {
 }
 
 warn () {
-    echo "$w3_argv0 WARNING: ""$@"
+    echo "$w3_argv0 WARNING: ""$@" >&2
 }
 
 err () {
-    echo "$w3_argv0 ERROR: ""$@"
+    echo "$w3_argv0 ERROR: ""$@" >&2
     exit 1
 }
 
diff --git a/test/debvcsbrowse.test b/test/debvcsbrowse.test
new file mode 100644
index 0000000..9883709
--- /dev/null
+++ b/test/debvcsbrowse.test
@@ -0,0 +1,2 @@
+debvcsbrowse gnuit
+Savannah Git Hosting

-- 
surfraw -  a fast unix command line interface to WWW



More information about the Surfraw-commits mailing list