File: debpackages

package info (click to toggle)
surfraw 2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,624 kB
  • sloc: sh: 7,977; perl: 824; makefile: 277
file content (148 lines) | stat: -rwxr-xr-x 4,590 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/sh
# $Id$
# elvis: debpackages	-- Search debian/ubuntu packages (packages.debian.org/packages.ubuntu.com)
. surfraw || exit 1

w3_config_hook () {
def   SURFRAW_debian_release  any
def   SURFRAW_debian_distro   any
def   SURFRAW_debian_search   pkg
defyn SURFRAW_debian_ubuntu   no
defyn SURFRAW_debian_subwords yes
defyn SURFRAW_debian_archive  no
}

w3_usage_hook () {
    cat <<EOF
Usage: $w3_argv0 [options] [search words]...
Description:
  Search debian/ubuntu packages (packages.debian.org/packages.ubuntu.com)
Local options:
  -a                            Search archived debian distributions
  -u                            Search ubuntu packages instead of debian
  -release=                     Specialized search on release
    Debian:
      any               |       all releases
      main              |       main release
      contrib           |       contrib
      non-free          |       packages not meeting DFSG
    Ubuntu (-u):
      any               |       all releases
      main              |
      restricted        |
      universe          |
      multiverse        |

                                Default: $SURFRAW_debian_release
                                Environment: SURFRAW_debian_release
  -distro=                      Specific distribution
    Debian:
      any               |       All distributions
      stable            |       Stable
      testing           |       Testing
      unstable          |       Unstable
      oldstable         |       Old Stable
      experimental      |       Experimental
    Archived Debian (-a):
      bo                |       1.3.1
      hamm              |       2.0
      slink             |       2.1
      potato            |       2.2
      woody             |       3.0
      sarge             |       3.1
      etch              |       4.0
    Ubuntu (-u):
      any               |       All distributions
      dapper            |
      dapper-updates    |
      dapper-backports  |
      hardy             |
      hardy-updates     |
      hardy-backports   |
      intrepid          |
      intrepid-updates  |
      intrepid-backports|
      jaunty            |
      jaunty-updates    |
      jaunty-backports  |
      karmic            |
      karmic-updates    |
      karmic-backports  |
      lucid             |
      lucid-updates     |
      lucid-backports   |
      maverick          |
      maverick-updates  |
      maverick-backports|
      natty             |
      natty-updates     |
      natty-backports
                                Default: $SURFRAW_debian_distro
                                Environment: SURFRAW_debian_distro
  -search=                      Field to search
          pkg           |       Package names only
          desc          |       Descriptions
          src           |       Source package names
  -nosub                        Don't allow subword matches (exact matches only)
EOF
    w3_global_usage
}

w3_parse_option_hook () {
    opt="$1"
    optarg="$2"
    case "$opt" in
	-release=*) setopt   SURFRAW_debian_release  $optarg ;;
	-distro=*)  setopt   SURFRAW_debian_distro   $optarg ;;
	-search=*)  setopt   SURFRAW_debian_search   $optarg ;;
	-a*)        setoptyn SURFRAW_debian_archive  yes     ;;
	-u*)        setoptyn SURFRAW_debian_ubuntu   yes     ;;
	-nos*)      setoptyn SURFRAW_debian_subwords no	     ;;
	*) return 1 ;;
    esac
    return 0
}

w3_config
w3_parse_args "$@"
# w3_args now contains a list of arguments

if   ifyes SURFRAW_debian_ubuntu
then
	searchpage="http://packages.ubuntu.com/"
	searchurl="http://packages.ubuntu.com/search"
elif ifyes SURFRAW_debian_archive
then
	searchpage="http://archive.debian.net/"
	searchurl="http://archive.debian.net/search"
else
	searchpage="https://packages.debian.org/#search_packages"
	searchurl="https://packages.debian.org/search"
fi

if test -z "$w3_args"; then
    w3_browse_url "$searchpage"
else
    escaped_args=`w3_url_of_arg $w3_args`
    if [ "${SURFRAW_debian_distro}" = "any" ]; then
	SURFRAW_debian_distro="all"
    fi
    if [ "${SURFRAW_debian_release}" = "any" ]; then
	SURFRAW_debian_release="all"
    fi
    url="$searchurl?keywords=${escaped_args}&suite=${SURFRAW_debian_distro}&section=${SURFRAW_debian_release}"

    case "$SURFRAW_debian_search" in
	pkg*)  url="$url&searchon=names"        ;;
	src*)  url="$url&searchon=sourcenames"  ;;
	desc*) url="$url&searchon=all"          ;;
	*)     err "Unknown search type"        ;;
    esac

    if ifno SURFRAW_debian_subwords
    then
	url="$url&exact=1"
    fi

    w3_browse_url "$url"
fi