You are not logged in.

#1 2003-01-12 10:10:28

orelien
Forum Fellow
From: France
Registered: 2002-12-05
Posts: 220
Website

Generic characters handling

Maybe pacman could handle generic characters (like * or ?)  in package names with the "sync" option.

For example:
"pacman -S alsa*" would allow to install all packages with a name beginning with "alsa"
"pacman -S sdl*"
"pacman -S net-*"

It seems it already works with the "add" and "upgrade" options, but it does not work with the "remove" and "query" options.

Why not something like:
"pacman -Q sdl*" or "pacman -Q *sdl"
to find out every package installed with a name beginning with "sdl" or finishing with "sdl"

Why not allow this for "sync", "query" and "remove" operations?

Offline

#2 2005-03-07 18:10:11

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: Generic characters handling

Well, here's how I do it:

$ cat > pacman.like
#!/bin/bash

for package in `pacman -Sl | sed 's:[a-z]* *([a-z,A-Z,0-9]*) *.*:1:' | sort -u | grep '^$1'`; do
    pacman --noconfirm -S $package
done
^D <-- (Ctrl-D to exit 'cat')

CAUTION: Note the single-quote right after the "for package in " is a back-tick (the key to the left of "1/!" and "2/@") -- argh! just cut and paste...

Then:

$ chmod 755 pacman.like

Without the "--noconfirm" this is what you will get, for example (as root user):

# ./pacman.like 'xs'
Targets: xsane-0.96-1
Total Package Size:   1.5 MB
Proceed with upgrade? [Y/n] n

Targets: xscorch-0.2.0-1
Total Package Size:   0.3 MB
Proceed with upgrade? [Y/n] n

:: xscreensaver-4.20-1: is up to date.  Upgrade anyway? [Y/n] n

Targets: xskat-4.0-1
Total Package Size:   0.1 MB
Proceed with upgrade? [Y/n] n

Targets: xsmbrowser-3.4.0-1
Total Package Size:   0.1 MB
Proceed with upgrade? [Y/n] n

Targets: xsnow-1.42-1
Total Package Size:   0.1 MB
Proceed with upgrade? [Y/n] n

Targets: icu-3.0-2 mono-1.0.6-1 xsp-1.0.5-1
Total Package Size:   18.3 MB
Proceed with upgrade? [Y/n] n

(was condensed to save BB space)

Offline

#3 2005-03-07 18:49:39

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Generic characters handling

soloport wrote:

Well, here's how I do it:

$ cat > pacman.like
#!/bin/bash

for package in `pacman -Sl | sed 's:[a-z]* *([a-z,A-Z,0-9]*) *.*:1:' | sort -u | grep '^$1'`; do
    pacman --noconfirm -S $package
done
^D <-- (Ctrl-D to exit 'cat')

hmmm how about:

#!/bin/bash

packages=""
for package in `pacman -Sl | sed 's:[a-z]* *([a-z,A-Z,0-9]*) *.*:1:' | grep '^$1'`; do
   packages="$packages $package"
done

pacman -S $packages

a) I removed the sort call, as that doesn't matter, it just makes it slower
b) combined packages in one string to run pacman -S on, allowing one to confirm if they want

Offline

#4 2005-03-07 19:33:41

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: Generic characters handling

a) I removed the sort call, as that doesn't matter, it just makes it slower

Like it was so slow to begin with  lol

Also, did you test it?  The reason for the sort was pretty important.  Try just part of the code:

pacman -Sl | sed 's:[a-z]* *([a-z,A-Z,0-9]*) *.*:1:'

Did you notice all these?

xpdf
xpdf
xpdf
xpdf
xpdf
xpdf
xpdf
xpdf
xpdf
xpdf
xpdf
xpdf

("sort -u" creates a "unique" list...)

Nice option, though:

b) combined packages in one string to run pacman -S on, allowing one to confirm if they want

Offline

#5 2005-03-07 19:44:54

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Generic characters handling

soloport wrote:

Like it was so slow to begin with  lol

heh, I'm a glutton for that sort of stuff

soloport wrote:

("sort -u" creates a "unique" list...)

hmmm, `uniq` will do the same thing, without sorting the list...

Offline

#6 2005-03-07 20:28:11

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: Generic characters handling

phrakture wrote:

heh, I'm a glutton for that sort of stuff

Me, too -- from habbits formed writing interrupt-driven drivers :shock: (Very timing intensive.)

phrakture wrote:

hmmm, `uniq` will do the same thing, without sorting the list...

Yeah, but then it wouldn't run as slow...

tongue

Offline

Board footer

Powered by FluxBB