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

Ian Beckwith ianb at erislabs.net
Tue Jun 14 03:39:05 UTC 2011


The following commit has been merged in the master branch:
commit 56aa00d1714250cd334e21357051e26e933ec002
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Tue Jun 14 04:21:36 2011 +0100

    rpmsearch: Fixed URLs, options and tests

diff --git a/ChangeLog b/ChangeLog
index 49ba8c3..477a39e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,11 @@
 2011-06-14  Ian Beckwith  <ianb at erislabs.net>
 
-	* musicbrainz: update to current URLs and options, add more
-	  tests.
-	* codesearch: fixed URLs and options.
-	  Has gone all ajaxy, so I've implemented the options
+	* musicbrainz, codesearch, rpmsearch: Fixed URLs, options and
+	  tests. The sites have all changed significantly which means
+	  both new options and no-longer-supported options.
+	  codesearch has gone all ajaxy, so I've implemented the options
 	  via the search string, e.g. adding " package:foo".
-	  Disabled the test, as it needs javascript.
+	  Disabled codesearch.test, as it now needs javascript.
 
 2011-06-13  Ian Beckwith  <ianb at erislabs.net>
 
diff --git a/elvi/rpmsearch b/elvi/rpmsearch
index d0769df..df34eb2 100755
--- a/elvi/rpmsearch
+++ b/elvi/rpmsearch
@@ -5,9 +5,8 @@
 
 w3_config_hook () {
     def   SURFRAW_rpmsearch_distro  all
-    def   SURFRAW_rpmsearch_version all
-    def   SURFRAW_rpmsearch_arch    all
-    def   SURFRAW_rpmsearch_by      rpmname
+    def   SURFRAW_rpmsearch_deptype ""
+    def   SURFRAW_rpmsearch_by      fuzzyname
 }
 
 w3_usage_hook () {
@@ -17,46 +16,38 @@ 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
+          fuzzyname       |      Fuzzy name match
+          rpmname         |      RPM name
+          dep             |      Dependency Match
+          file            |      Search by File
+                                Default: $SURFRAW_rpmsearch_by
+                                Environment: SURFRAW_rpmsearch_by
+  -dep=                         Dependency match type (implies -search=dep)
+          provides        |      Provides
+          requires        |      Requires
+          conflict        |      Conflict
+          obsoletes       |      Obsoletes
+          trigger         |      Trigger
+          suggest         |      Suggest
+          enhanced        |      Enhanced
                                 Default: $SURFRAW_rpmsearch_by
                                 Environment: SURFRAW_rpmsearch_by
   -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
+          all             |      All (default)
+          Altlinux        |      Altlinux
+          Arklinux        |      Arklinux
+          Caosity         |      Caosity
+          CentOS          |      CentOS
+          Fedora          |      Fedora
+          Mageia          |      Mageia
+          Mandriva        |      Mandriva
+          Momonga         |      Momonga
+          OpenSuse        |      OpenSuse
+          PLD             |      PLD
+          ScientificLinux |      Scientific Linux
+          UnityLinux      |      Unity Linux
                                 Default: $SURFRAW_rpmsearch_distro
                                 Environment: SURFRAW_rpmsearch_distro
-  -arch=NAME                    Search in architecture NAME
-    all (default), alpha, athlon, i386, i486,
-    i586, i686, ia64, ppc, ppc64, sparc, sparc64,
-    sparcv9, x86_64
-                                Default: $SURFRAW_rpmsearch_arch
-                                Environment: SURFRAW_rpmsearch_arch
-  -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
-                                Default: $SURFRAW_rpmsearch_version
-                                Environment: SURFRAW_rpmsearch_version
 EOF
     w3_global_usage
 }
@@ -66,10 +57,25 @@ w3_parse_option_hook () {
     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" ;;
+    -de*=*)     case "$optarg" in
+		    [Pp]*) setopt SURFRAW_rpmsearch_deptype "P";;
+		    [Rr]*) setopt SURFRAW_rpmsearch_deptype "R";;
+		    [Cc]*) setopt SURFRAW_rpmsearch_deptype "C";;
+		    [Oo]*) setopt SURFRAW_rpmsearch_deptype "O";;
+		    [Tt]*) setopt SURFRAW_rpmsearch_deptype "T";;
+		    [Ss]*) setopt SURFRAW_rpmsearch_deptype "S";;
+		    [Ee]*) setopt SURFRAW_rpmsearch_deptype "E";;
+		    *)     err "unknown dep type";;
+		esac
+		setopt SURFRAW_rpmsearch_by bydep ;;
+    -sear*=*)   case "$optarg" in
+                    fu*)      setopt SURFRAW_rpmsearch_by fuzzyname;;
+		    byn*|r*)  setopt SURFRAW_rpmsearch_by byname;;
+		    bydep|d*) setopt SURFRAW_rpmsearch_by bydep;;
+		    byf|fi*)  setopt SURFRAW_rpmsearch_by byfile;;
+		    *)        err "unknown search type" ;;
+		esac ;;
+
     *) return 1 ;;
     esac
     return 0
@@ -80,25 +86,14 @@ 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"
+    w3_browse_url "http://sophie.zarb.org/search"
 else
     escaped_args=`w3_url_of_arg $w3_args`
 
-    if [ "$SURFRAW_rpmsearch_distro" = all ]
-    then
+    if [ "$SURFRAW_rpmsearch_distro" = all ]; then
 	SURFRAW_rpmsearch_distro=""
+    elif [ "$SURFRAW_rpmsearch_distro" = ScientificLinux ]; then
+	SURFRAW_rpmsearch_distro="Scientific+Linux"
     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}"
-
+    w3_browse_url "http://sophie.zarb.org/search?distribution=${SURFRAW_rpmsearch_distro}&search=${escaped_args}&type=${SURFRAW_rpmsearch_by}&deptype=${SURFRAW_rpmsearch_deptype}"
 fi
diff --git a/test/rpmsearch.test b/test/rpmsearch.test
index 08b2439..a87723b 100644
--- a/test/rpmsearch.test
+++ b/test/rpmsearch.test
@@ -1,2 +1,2 @@
 rpmsearch surfraw
-surfraw-.*\.noarch\.rpm
+surfraw-.*\.noarch

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



More information about the Surfraw-commits mailing list