searchall: account for broken lines
http://cygwin.com/ml/cygwin/2014-11/msg00278.html
This commit is contained in:
parent
e9bea37b95
commit
9b5de3f26c
20
apt-cyg
20
apt-cyg
|
@ -339,14 +339,18 @@ function apt-searchall {
|
|||
printf -v qs 'text=1&arch=%s&grep=%s' $ARCH "$pkg"
|
||||
wget -O matches cygwin.com/cgi-bin2/package-grep.cgi?"$qs"
|
||||
awk '
|
||||
NR == 1 {next}
|
||||
/-doc-/ {next}
|
||||
/-debuginfo-/ {next}
|
||||
/-devel-/ && pkg~/\.exe$/ {next}
|
||||
/-src\t$/ {next}
|
||||
mc[$1]++ {next}
|
||||
$0 = $1
|
||||
' FS=-[[:digit:]] pkg="$pkg" matches
|
||||
{
|
||||
if (NR == 1)
|
||||
next
|
||||
if (mc[$1]++)
|
||||
next
|
||||
if (/-debuginfo-/)
|
||||
next
|
||||
if (/^ /)
|
||||
next
|
||||
print $1
|
||||
}
|
||||
' FS=-[[:digit:]] matches
|
||||
done
|
||||
}
|
||||
|
||||
|
|
14
apt-msys2
14
apt-msys2
|
@ -21,7 +21,7 @@
|
|||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
usage () {
|
||||
function usage {
|
||||
local rw=(
|
||||
'apt-msys2 [command] [packages]'
|
||||
''
|
||||
|
@ -33,14 +33,14 @@ usage () {
|
|||
printf '%s\n' "${rw[@]}"
|
||||
}
|
||||
|
||||
urlencode () {
|
||||
function urlencode {
|
||||
sed '
|
||||
s / %2f g
|
||||
s : %3a g
|
||||
' <<< "$1"
|
||||
}
|
||||
|
||||
findworkspace () {
|
||||
function findworkspace {
|
||||
mirror=http://downloads.sourceforge.net/project/msys2
|
||||
repo=REPOS/MINGW/$ARCH
|
||||
local mirrordir=/var/cache/$(urlencode $mirror)/$repo
|
||||
|
@ -48,13 +48,13 @@ findworkspace () {
|
|||
cd $mirrordir
|
||||
}
|
||||
|
||||
getdb () {
|
||||
function getdb {
|
||||
[ -e mingw64.files.tar.gz ] && return
|
||||
wget $mirror/$repo/mingw64.files.tar.gz
|
||||
tar --no-an -Oxf mingw64.files.tar.gz desc files > mingw64.lst
|
||||
}
|
||||
|
||||
apt-listfiles () {
|
||||
function apt-listfiles {
|
||||
findworkspace
|
||||
getdb
|
||||
local pkg
|
||||
|
@ -69,7 +69,7 @@ apt-listfiles () {
|
|||
head -c-1
|
||||
}
|
||||
|
||||
apt-install () {
|
||||
function apt-install {
|
||||
findworkspace
|
||||
getdb
|
||||
local pkg file eu oe rw
|
||||
|
@ -95,7 +95,7 @@ apt-install () {
|
|||
done
|
||||
}
|
||||
|
||||
apt-search () {
|
||||
function apt-search {
|
||||
findworkspace
|
||||
getdb
|
||||
for pkg in ${packages[*]}
|
||||
|
|
Loading…
Reference in New Issue