Re: pkg equivalent of "pkg_info -R"

看板FB_questions作者時間11年前 (2014/03/08 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串8/11 (看更多)
On 03/07/14 11:15, Andrea Venturoli wrote: > On 03/07/14 07:54, Matthew Seaman wrote: > >> Yes, being able to generate the entire dependency tree would be a >> desirable option. > > Exactly. > > In the example I gave, the rationale was, after the vulnerabiliy in > gnutls, getting a list of services which needed restarting. > >> It's not particularly difficult, but it does require >> implementing recursive behaviour for such lookups. That just needs >> someone to step up and code it... > > I was just surprised that some funcionality I very often use was gone. > Perhaps I'm doing things in a peculiar ways? > Are there so few people doing this, that it could be overlooked? > > Of course, getting back to the previous example, listing the binaries > which are linked against gnutls might be another route... > >> Until then, you'ld have to write a shell wrapper around pkg query to >> achieve the same effect. > > Ok. > I'd just hate do duplicate work... > > bye > av. Okay, you got a python solution but here's my bourne shell version (I dislike python :-) -scott #!/bin/sh # Show ALL ports required for a given port. ################################################################################ WORK=`pkg info -r $1 | grep -v ":"` while [ "X$WORK" != "X" ]; do for word in $WORK; do if [ "X$NEW" = "X" ]; then NEW=$word else NEW="$NEW $word" fi CHECK=`pkg info -r $word | grep -v ":"` for new in $CHECK; do testN=`echo "$NEW" | grep -w $new` testW=`echo "$WORK" | grep -w $new` if [ "X$testN" = "X" ] && [ "X$testW" = "X" ]; then WORK="$WORK $new" fi done WC=`echo $WORK | wc -w | cut -w -f 2` if [ $WC = 1 ]; then WORK="" else WORK=`echo $WORK | cut -d ' ' -f 2-$WC` fi done done ## PRINT ALL RESULTS ON ONE (LONG) LINE #echo $NEW ## OR THE RESULTS, ONE ENTRY PER LINE (easier to sort) for X in $NEW; do echo $X done _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
文章代碼(AID): #1J6WbWvc (FB_questions)
討論串 (同標題文章)
文章代碼(AID): #1J6WbWvc (FB_questions)