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

Ian Beckwith ianb at erislabs.net
Thu Nov 12 16:20:16 UTC 2009


The following commit has been merged in the master branch:
commit ad16c75d92784ddecf6758c56f3dd762ddcb4386
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Thu Nov 12 16:11:43 2009 +0000

    new elvi: rpmsearch: search various rpm-based distros

diff --git a/README b/README
index f90062c..bccc600 100644
--- a/README
+++ b/README
@@ -224,6 +224,7 @@ pubmed          -- Search medical/molbio databases (www.ncbi.nlm.nih.gov)
 rae             -- Busca en el diccionario de la Real Academia de la Lengua Española (Spanish Dictionary)
 rfc             -- Search RFCs (internet standards documents)
 rhyme           -- Search for rhymes et al using Lycos Rhyme (rhyme.lycos.com)
+rpmsearch       -- Search for RPMs in various distros
 scholar         -- Search Google Scholar (scholar.google.com)
 scicom          -- Search Scientific Commons
 scpan           -- Search the Comprehensive Perl Archive Network (search.cpan.org)
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index b28b59c..c5fb2d5 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -77,6 +77,7 @@ dist_elvi_SCRIPTS	= \
 		  rae \
 		  rfc \
 		  rhyme \
+		  rpmsearch \
 		  scholar \
 		  scicom \
 		  slashdot \
diff --git a/elvi/Makefile.in b/elvi/Makefile.in
index 8dfdb41..6660253 100644
--- a/elvi/Makefile.in
+++ b/elvi/Makefile.in
@@ -52,8 +52,8 @@ am__dist_elvi_SCRIPTS_DIST = W acronym alioth altavista amazon archpkg \
 	gcache genbugs genpkg genportage gutenberg google happypenguin \
 	imdb ixquick javasun scpan slinuxdoc l1sp lastfm leodict lsm \
 	macportspkg mathworld mininova musicbrainz netbsd ntrs openbsd \
-	piratebay pgpkeys port pubmed rae rfc rhyme scholar scicom \
-	slashdot sourceforge springer stockquote sunonesearch \
+	piratebay pgpkeys port pubmed rae rfc rhyme rpmsearch scholar \
+	scicom slashdot sourceforge springer stockquote sunonesearch \
 	thesaurus translate urban w3css w3html w3link w3rdf wayback \
 	webster wetandwild wikipedia woffle yahoo youtube yubnub \
 	opensearch
@@ -171,10 +171,11 @@ dist_elvi_SCRIPTS = W acronym alioth altavista amazon archpkg arxiv \
 	genportage gutenberg google happypenguin imdb ixquick javasun \
 	scpan slinuxdoc l1sp lastfm leodict lsm macportspkg mathworld \
 	mininova 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 youtube yubnub $(am__append_1)
+	port pubmed rae rfc rhyme rpmsearch scholar scicom slashdot \
+	sourceforge springer stockquote sunonesearch thesaurus \
+	translate urban w3css w3html w3link w3rdf wayback webster \
+	wetandwild wikipedia woffle yahoo youtube yubnub \
+	$(am__append_1)
 all: all-am
 
 .SUFFIXES:
diff --git a/elvi/rpmsearch b/elvi/rpmsearch
new file mode 100755
index 0000000..91ef786
--- /dev/null
+++ b/elvi/rpmsearch
@@ -0,0 +1,96 @@
+#!/bin/sh
+# elvis: rpmsearch	-- Search for RPMs in various distros
+# ianb at erislabs.net 20091112
+. surfraw || exit 1
+
+w3_config_hook () {
+    def   SURFRAW_rpmsearch_distro  all
+    def   SURFRAW_rpmsearch_version all
+    def   SURFRAW_rpmsearch_arch    all
+    def   SURFRAW_rpmsearch_by      rpmname
+}
+
+w3_usage_hook () {
+    cat <<EOF
+Usage: $w3_argv0 [options] [search words]...
+Description:
+  Search for RPMs in various distros
+Local options:
+  -search=TYPE                  Search by TYPE
+          rpmname       |        RPM name (default)
+          fuzzyname     |        Fuzzy name match
+          provide       |        Provides
+          require       |        Requires
+          conflict      |        Conflicts
+          obsolete      |        Obsoletes
+          trigger       |        Triggers
+  -distro=NAME                  Search in distribution NAME
+          all           |        All (default)
+          Altlinux      |        Altlinux
+          Arklinux      |        Arklinux
+          Caosity       |        Caosity
+          CentOS        |        CentOS
+          Fedora        |        Fedora
+          Mandriva      |        Mandriva
+          Momonga       |        Momonga
+          OpenSuse      |        OpenSuse
+          PLD           |        PLD
+          Scientific    |        Scientific
+  -arch=NAME                    Search in architecture NAME
+    all (default), alpha, athlon, i386, i486,
+    i586, i686, ia64, ppc, ppc64, sparc, sparc64,
+    sparcv9, x86_64
+  -version=VER                  Search in distro version VER
+    all (default), 10, 10.0, 10.0-community, 10.1,
+    10.1-community, 10.2, 10.2-community, 10.3, 11,
+    11.0, 11.1, 2, 2006.0, 2006.0-community,
+    2007.0, 2007.1, 2008.0, 2008.1, 2009.0, 2009.1,
+    2010.0, 3, 4, 40, 4.0, 4.1, 46, 5, 50, 51,
+    5.1, 52, 5.2, 6, 7, 7.0, 7.1, 7.2, 8, 8.0, 8.1,
+    8.2, 9, 9.0, 9.1, 9.2, ac, community, cooker,
+    cs4.0, current, devel, development, factory, th
+EOF
+    w3_global_usage
+}
+
+w3_parse_option_hook () {
+    opt="$1"
+    optarg="$2"
+    case "$opt" in
+    -dist*=*)   setopt   SURFRAW_rpmsearch_distro  "$optarg" ;;
+    -ver*=*)    setopt   SURFRAW_rpmsearch_version "$optarg" ;;
+    -arch*=*)   setopt   SURFRAW_rpmsearch_arch    "$optarg" ;;
+    -ver*=*)    setopt   SURFRAW_rpmsearch_version "$optarg" ;;
+    -sear*=*)   setopt   SURFRAW_rpmsearch_by      "$optarg" ;;
+    *) return 1 ;;
+    esac
+    return 0
+}
+
+w3_config
+w3_parse_args "$@"
+# w3_args now contains a list of arguments
+
+if test -z "$w3_args"; then
+    w3_browse_url "http://sophie.zarb.org/rpmfind"
+else
+    escaped_args=`w3_url_of_arg $w3_args`
+
+    if [ "$SURFRAW_rpmsearch_distro" = all ]
+    then
+	SURFRAW_rpmsearch_distro=""
+    fi
+
+    if [ "$SURFRAW_rpmsearch_version" = all ]
+    then
+	SURFRAW_rpmsearch_version=""
+    fi
+
+    if [ "$SURFRAW_rpmsearch_arch" = all ]
+    then
+	SURFRAW_rpmsearch_arch=""
+    fi
+
+    w3_browse_url "http://sophie.zarb.org/rpmfind?distrib=${SURFRAW_rpmsearch_distro}&version=${SURFRAW_rpmsearch_version}&arch=${SURFRAW_rpmsearch_arch}&search=${escaped_args}&st=${SURFRAW_rpmsearch_by}"
+
+fi
diff --git a/links.IN b/links.IN
index e1d4d7b..931b74a 100644
--- a/links.IN
+++ b/links.IN
@@ -71,6 +71,7 @@ elvi.1sr.gz @mandir@/man1/pubmed.1sr.gz
 elvi.1sr.gz @mandir@/man1/rae.1sr.gz
 elvi.1sr.gz @mandir@/man1/rfc.1sr.gz
 elvi.1sr.gz @mandir@/man1/rhyme.1sr.gz
+elvi.1sr.gz @mandir@/man1/rpmsearch.1sr.gz
 elvi.1sr.gz @mandir@/man1/scholar.1sr.gz
 elvi.1sr.gz @mandir@/man1/scicom.1sr.gz
 elvi.1sr.gz @mandir@/man1/scpan.1sr.gz
diff --git a/test/rpmsearch.test b/test/rpmsearch.test
new file mode 100644
index 0000000..08b2439
--- /dev/null
+++ b/test/rpmsearch.test
@@ -0,0 +1,2 @@
+rpmsearch surfraw
+surfraw-.*\.noarch\.rpm

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



More information about the Surfraw-commits mailing list