dslreports logo
 
    All Forums Hot Topics Gallery
spc
Search similar:


uniqs
1619

Chewbakka
join:2004-12-19

Chewbakka

Member

FreeBSD defining portmaster alias

Hi,

After dealing with the hassle of database inconsistency over and over again, i decided to throw portupgrade out and use portmaster instead.

However the portupgrade had a tool i really liked, portversion -vl "
portmaster -L | egrep -B1 '(ew|ort) version|Aborting|installed|dependencies|IGNORE|marked|Reason:|MOVED|deleted' | grep -v '^--'  
 

I tried the usual alias portmaster -L=""

But it doesn't seem to work. I use zsh btw.
Any suggestions?
Chewbakka

Chewbakka

Member

Problem solved.
pablo
MVM
join:2003-06-23

1 recommendation

pablo

MVM

Ideally, you should post how the issue was resolved so if someone else encounters the issue, they have a solution.

Cheers,
-pablo

Chewbakka
join:2004-12-19

1 recommendation

Chewbakka

Member

A simple zsh function did the trick

function port_master() {
 
if [[ "$1" == '-L' ]];
 
then
portmaster -L | egrep -B1 '(ew|ort) version|Aborting|installed|dependencies|IGNORE|marked|Reason:|MOVED|deleted|exist|update' |grep -v '^--'
 
else
portmaster "$@"
 
fi
}
alias portmaster=port_master
 
 

koitsu
MVM
join:2002-07-16
Mountain View, CA
Humax BGW320-500

koitsu to Chewbakka

MVM

to Chewbakka
I'm surprised that grep -v line even works, given that there's hyphens in the match string which could be parsed as flags. Usually using -- inhibits that behaviour. Additionally when using regex-like things it's probably best to use egrep. So:

egrep -v -- "^--"
 

Unless zsh has its own internal built-in for grep. I'm also surprised zsh is smart enough to work out the recursion situation in your function vs. your alias. (alias is named "portmaster", function calls "portmaster", which could be the alias itself, rather than /usr/local/sbin/portmaster for example). Interesting.

Congratulations on getting rid of portupgrade and the utter mess that it is. I keep telling people to avoid use of it solely for the database inconsistency ordeal (pkg db vs. portupgrade's db), but nobody ever listens until months/years down the road when they encounter it and go "hurrrr hurrrrrrrr hurrrrr it must have been something else, portupgrade is awesome". No it's not awesome, it needs to be nuked from orbit.

Finally, if you want some features in portmaster (e.g. something that might avoid the need for said function in zsh, such as a flag that does exactly what you need), do not hesitate to mail Doug Barton about it! He's *incredibly* receptive to changes and feature requests relating to portmaster. Don't fear him. :-)