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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
#!/bin/sh
# elvis: finkpkg -- Search Fink packages (pdb.finkproject.org)
# ianb@erislabs.net 20091111
. surfraw || exit 1
w3_config_hook () {
def SURFRAW_finkpkg_pkgname ""
def SURFRAW_finkpkg_maintainer ""
def SURFRAW_finkpkg_distro default
def SURFRAW_finkpkg_arch any
def SURFRAW_finkpkg_tree any
def SURFRAW_finkpkg_section any
defyn SURFRAW_finkpkg_exact no
defyn SURFRAW_finkpkg_nomaint no
defyn SURFRAW_finkpkg_nochildren no
defyn SURFRAW_finkpkg_noshlibsdev no
}
w3_usage_hook () {
cat <<EOF
Usage: $w3_argv0 [options] [search words]...
Description:
Search Fink packages (pdb.finkproject.org)
Local options:
-pkg=NAME Search by packagename for NAME
-maintainer=NAME Search by maintainer for NAME
-dist=DIST Specify distribution DIST
default | Supported [10.5 & 10.6] (default)
any | Any
10.4 | 10.4
10.5 | 10.5
10.6 | 10.6
Default: $SURFRAW_finkpkg_distro
Environment: SURFRAW_finkpkg_distro
-arch=ARCH Search in arch ARCH
any | Any (default)
i386 | i386
x86_64 | X86_64 (aka AMD64)
powerpc | powerpc
Default: $SURFRAW_finkpkg_arch
Environment: SURFRAW_finkpkg_arch
-tree=TREE Search in tree TREE
any | Any (default)
unstable | Unstable
stable | Stable
bindist | Binary Distribution
testing | Packages that need testing
Default: $SURFRAW_finkpkg_tree
Environment: SURFRAW_finkpkg_tree
-section=SEC Search in section SEC
any | Any (default)
base | Core packages
crypto | Cryptographic software (subject to national regulations)
database | SQL and other database software
devel | Software for software development
editors | Text editors
games | Games and other fun stuff
gnome | The GNOME desktop environment (version 2.26)
graphics | Graphics applications and libraries
kde | K Desktop Environment (version 3.5.10 and 4.2.4)
languages | Programming languages (compilers, interpreters)
libs | General purpose libraries
libs/perlmods | Perl libraries
libs/pythonmods | Python libraries
libs/rubymods | Ruby libraries
net | Network-related applications and libraries
sci | Scientific applications
shells | Shells (command line interpreters)
sound | Audio software
text | Text-processing software
utils | Utilities that do not fit elsewhere
web | Web-related software
x11 | General X11 packages - toolkits and utilities
x11-system | X Window System core packages
x11-wm | Window managers for the X Window System
Default: $SURFRAW_finkpkg_section
Environment: SURFRAW_finkpkg_section
-exact Exact package matches only
Default: $SURFRAW_finkpkg_exact
Environment: SURFRAW_finkpkg_exact
-nomaint Find packages with no maintainer
Default: $SURFRAW_finkpkg_nomaint
Environment: SURFRAW_finkpkg_nomaint
-nochildren Exclude packages with parent
(includes most "-dev", "-shlibs", ... splitoffs)
Default: $SURFRAW_finkpkg_nochildren
Environment: SURFRAW_finkpkg_nochildren
-noshlibsdev Exclude -shlibs, -dev, -bin, -common, -doc packages
Default: $SURFRAW_finkpkg_noshlibsdev
Environment: SURFRAW_finkpkg_noshlibsdev
EOF
w3_global_usage
}
w3_parse_option_hook () {
opt="$1"
optarg="$2"
case "$opt" in
-pkg*=*) setopt SURFRAW_finkpkg_pkgname $optarg ;;
-maint*=*) setopt SURFRAW_finkpkg_maintainer $optarg ;;
-dist*=*) setopt SURFRAW_finkpkg_distro $optarg ;;
-arch=*) setopt SURFRAW_finkpkg_arch $optarg ;;
-tree*=*) setopt SURFRAW_finkpkg_tree $optarg ;;
-sec*=*) setopt SURFRAW_finkpkg_section $optarg ;;
-ex*) setoptyn SURFRAW_finkpkg_exact yes ;;
-nomaint*) setoptyn SURFRAW_finkpkg_nomaint yes ;;
-noch*) setoptyn SURFRAW_finkpkg_nochildren yes ;;
-noshlib*) setoptyn SURFRAW_finkpkg_noshlibsdev yes ;;
*) return 1 ;;
esac
return 0
}
w3_config
w3_parse_args "$@"
# w3_args now contains a list of arguments
escaped_args=$(w3_url_of_arg $w3_args)
url="http://pdb.finkproject.org/pdb/browse.php"
if [ -z "$escaped_args" ] && [ -z "$SURFRAW_finkpkg_pkgname" ] && [ -z "$SURFRAW_finkpkg_maintainer" ]
then
w3_browse_url "$url"
else
if [ "$SURFRAW_finkpkg_arch" = any ]
then
SURFRAW_finkpkg_arch=""
fi
if [ "$SURFRAW_finkpkg_section" = any ]
then
SURFRAW_finkpkg_section=""
fi
url="${url}?dist_name=${SURFRAW_finkpkg_distro}"
url="${url}&architecture=${SURFRAW_finkpkg_arch}"
url="${url}&tree=${SURFRAW_finkpkg_tree}"
url="${url}&sec=${SURFRAW_finkpkg_section}"
if [ -n "$escaped_args" ]
then
url="${url}&summary=${escaped_args}"
fi
if [ -n "$SURFRAW_finkpkg_pkgname" ]
then
url="${url}&name=${SURFRAW_finkpkg_pkgname}"
fi
if [ -n "$SURFRAW_finkpkg_maintainer" ]
then
url="${url}&maintainer=${SURFRAW_finkpkg_maintainer}"
fi
if ifyes SURFRAW_finkpkg_exact
then
url="${url}&name_exact=on"
fi
if ifyes SURFRAW_finkpkg_nomaint
then
url="$url&nomaintainer=on"
fi
if ifyes SURFRAW_finkpkg_nochildren
then
url="$url&nochildren=on"
fi
if ifyes SURFRAW_finkpkg_noshlibsdev
then
url="$url&noshlibsdev=on"
fi
w3_browse_url "$url"
fi
|