FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 02-04-2008, 08:59 PM
Ryan Hill
 
Default I want to steal your tools

Ryan Hill wrote:

Can someone provide a tool that given a package name simply prints the
category or cat/pkg, or if ambiguous, prints the multiple cat/pkgs or
returns an error code? I don't care what it's written in as long as
it's relatively quick. I'm sick of depending on udept (which is an
incredible tool but a lot heavy for a simple shell script) just to get a
simple category.


After getting a couple suggestions, I guess I forgot some requirements.

a) package-manager agnostic
b) using only tools in the system set + maybe gentoolkit and portage-utils

I want something that anybody can use in their scripts without having to install
paludis, or eix, or udept, or etc. Bonus points for actually integrating this
feature into gentoolkit or portage-utils.



--
fonts, by design, by neglect
gcc-porting, for a fact or just for effect
wxwindows @ gentoo EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662
 
Old 02-04-2008, 09:05 PM
Ciaran McCreesh
 
Default I want to steal your tools

On Mon, 04 Feb 2008 15:59:26 -0600
Ryan Hill <dirtyepic@gentoo.org> wrote:
> I want something that anybody can use in their scripts without having
> to install paludis

What's the difference between installing Paludis and installing Perl in
order to use a tool?

--
Ciaran McCreesh
 
Old 02-04-2008, 09:29 PM
Vlastimil Babka
 
Default I want to steal your tools

Ciaran McCreesh wrote:

On Mon, 04 Feb 2008 15:59:26 -0600
Ryan Hill <dirtyepic@gentoo.org> wrote:

I want something that anybody can use in their scripts without having
to install paludis


What's the difference between installing Paludis and installing Perl in
order to use a tool?


About 10 minutes (YMMV)

Mon Nov 19 22:26:38 2007 >>> dev-lang/perl-5.8.8-r4
merge time: 6 minutes and 10 seconds.

Wed Nov 7 12:46:01 2007 >>> sys-apps/paludis-0.24.6
merge time: 16 minutes and 25 seconds.

--
Vlastimil Babka (Caster)
Gentoo/Java
 
Old 02-04-2008, 09:42 PM
Ryan Hill
 
Default I want to steal your tools

Ciaran McCreesh wrote:

On Mon, 04 Feb 2008 15:59:26 -0600 Ryan Hill <dirtyepic@gentoo.org> wrote:

I want something that anybody can use in their scripts without having to
install paludis


What's the difference between installing Paludis and installing Perl in order
to use a tool?


Ha. Nice edit. What I actually said was:


I want something that anybody can use in their scripts without having to
install paludis, or eix, or udept, or etc.


Well, perl is already installed on my and everyone else's system. Paludis was
one example, but I would like it to work without having to install anything
extra at all. Otherwise I'd continue to use udept.


So, do you have such a solution or did you just pop up because someone said Paludis?


--
fonts, by design, by neglect
gcc-porting, for a fact or just for effect
wxwindows @ gentoo EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662
 
Old 02-04-2008, 09:53 PM
Thomas de Grenier de Latour
 
Default I want to steal your tools

On 2008/02/04, Ryan Hill <dirtyepic@gentoo.org> wrote:
>
> Can someone provide a tool that given a package name simply prints
> the category or cat/pkg, or if ambiguous, prints the multiple
> cat/pkgs or returns an error code? I don't care what it's written in
> as long as it's relatively quick.

As long as you're only interrested in stuffs from the Portage tree,
and not overlays, and you have portage-utils installed along with its
post-sync hook, you can use one of this function:

find_cat1() {
qsearch -CsN "^${1}$"
}

find_cat2() {
sed -n "|/${1}/|s:/[^/]*$:" "${PORTDIR}"/.ebuild.x
| uniq
}

Note that find_cat1() is case-insensitive, probably not what you want.

And without portage-utils' ebuilds cache, this works too:

find_cat3() {
pushd "${PORTDIR}" >/dev/null
ls -1d $(sed "s:$:/${1}:" profiles/categories) 2>/dev/null
popd >/dev/null
}

Here are some benchs (real time, with 1 run from cold I/O cache, and
then 100 runs also from cold I/O cache, with "fuse" as argument):

* find_cat1:
- 0m0.972s
- 0m25.967s
(No real advantage... that's not the primary target of this applet.)

* find_cat2:
- 0m0.237s
- 0m3.746s
(Acceptable in both cases.)

* find_cat3:
- 0m2.319s
- 0m2.607s
(Really slow on first run, but really fast once the tree as been
walked. May be a good choice in some contexts.)

--
TGL.
--
gentoo-dev@lists.gentoo.org mailing list
 
Old 02-04-2008, 10:03 PM
Ryan Hill
 
Default I want to steal your tools

Thomas de Grenier de Latour wrote:

On 2008/02/04, Ryan Hill <dirtyepic@gentoo.org> wrote:

Can someone provide a tool that given a package name simply prints
the category or cat/pkg, or if ambiguous, prints the multiple
cat/pkgs or returns an error code? I don't care what it's written in
as long as it's relatively quick.


As long as you're only interrested in stuffs from the Portage tree,
and not overlays, and you have portage-utils installed along with its
post-sync hook, you can use one of this function:

find_cat1() {
qsearch -CsN "^${1}$"
}

find_cat2() {
sed -n "|/${1}/|s:/[^/]*$:" "${PORTDIR}"/.ebuild.x
| uniq
}

Note that find_cat1() is case-insensitive, probably not what you want.

And without portage-utils' ebuilds cache, this works too:

find_cat3() {
pushd "${PORTDIR}" >/dev/null
ls -1d $(sed "s:$:/${1}:" profiles/categories) 2>/dev/null
popd >/dev/null
}

Here are some benchs (real time, with 1 run from cold I/O cache, and
then 100 runs also from cold I/O cache, with "fuse" as argument):


* find_cat1:
- 0m0.972s
- 0m25.967s
(No real advantage... that's not the primary target of this applet.)

* find_cat2:
- 0m0.237s
- 0m3.746s
(Acceptable in both cases.)

* find_cat3:
- 0m2.319s
- 0m2.607s
(Really slow on first run, but really fast once the tree as been
walked. May be a good choice in some contexts.)


Perfect! I'll tinker with these and see what I come up with.

Thanks.


--
fonts, by design, by neglect
gcc-porting, for a fact or just for effect
wxwindows @ gentoo EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662
 
Old 02-05-2008, 12:50 AM
"Heath N. Caldwell"
 
Default I want to steal your tools

On 2008-02-04 14:51, Ryan Hill wrote:
> Can someone provide a tool that given a package name simply prints the
> category or cat/pkg, or if ambiguous, prints the multiple cat/pkgs or
> returns an error code? I don't care what it's written in as long as it's
> relatively quick. I'm sick of depending on udept (which is an incredible
> tool but a lot heavy for a simple shell script) just to get a simple
> category.

What about something like this:

--
#!/bin/bash

source /etc/make.globals
source /etc/make.conf

for i in ${PORTDIR} ${PORTDIR_OVERLAY}; do
(cd $i; a=(*/$1); [ -e ${a[0]} ] && ls -1 -d */$1)
done | sort | uniq
--

It's really fast, at least.

--
Heath Caldwell - hncaldwell@csupomona.edu
Operating Systems Analyst - California State Polytechnic University, Pomona
 
Old 02-05-2008, 02:21 AM
Ryan Hill
 
Default I want to steal your tools

Heath N. Caldwell wrote:

On 2008-02-04 14:51, Ryan Hill wrote:
Can someone provide a tool that given a package name simply prints the
category or cat/pkg, or if ambiguous, prints the multiple cat/pkgs or
returns an error code? I don't care what it's written in as long as it's
relatively quick. I'm sick of depending on udept (which is an incredible
tool but a lot heavy for a simple shell script) just to get a simple
category.


What about something like this:

--
#!/bin/bash

source /etc/make.globals
source /etc/make.conf

for i in ${PORTDIR} ${PORTDIR_OVERLAY}; do
(cd $i; a=(*/$1); [ -e ${a[0]} ] && ls -1 -d */$1)
done | sort | uniq
--

It's really fast, at least.


Also very good, thanks. Instead of sourcing, we can instead use

$ portageq envvar PORTDIR
$ portageq portdir_overlay

How do paludis and pkgcore make this info available?


--
fonts, by design, by neglect
gcc-porting, for a fact or just for effect
wxwindows @ gentoo EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662
 
Old 02-05-2008, 04:06 AM
Jeroen Roovers
 
Default I want to steal your tools

On Mon, 04 Feb 2008 21:21:14 -0600
Ryan Hill <dirtyepic@gentoo.org> wrote:

> Also very good, thanks. Instead of sourcing, we can instead use
>
> $ portageq envvar PORTDIR

Or simply `portageq portdir'...

> $ portageq portdir_overlay

I remember reading you wanted a program that did the job *fast*.

Calling portageq takes around 2 (VIA EPIA M10000) to 3 (HP
Visualize C3650) or more seconds to return on (some|older) systems.


Kind regards,
JeR
--
gentoo-dev@lists.gentoo.org mailing list
 
Old 02-05-2008, 12:28 PM
"Santiago M. Mola"
 
Default I want to steal your tools

On Feb 5, 2008 4:21 AM, Ryan Hill <dirtyepic@gentoo.org> wrote:
> Heath N. Caldwell wrote:
> > On 2008-02-04 14:51, Ryan Hill wrote:
> >> Can someone provide a tool that given a package name simply prints the
> >> category or cat/pkg, or if ambiguous, prints the multiple cat/pkgs or
> >> returns an error code? I don't care what it's written in as long as it's
> >> relatively quick. I'm sick of depending on udept (which is an incredible
> >> tool but a lot heavy for a simple shell script) just to get a simple
> >> category.
> >
> > What about something like this:
> >
> > --
> > #!/bin/bash
> >
> > source /etc/make.globals
> > source /etc/make.conf
> >
> > for i in ${PORTDIR} ${PORTDIR_OVERLAY}; do
> > (cd $i; a=(*/$1); [ -e ${a[0]} ] && ls -1 -d */$1)
> > done | sort | uniq
> > --
> >
> > It's really fast, at least.
>
> Also very good, thanks. Instead of sourcing, we can instead use
>
> $ portageq envvar PORTDIR
> $ portageq portdir_overlay
>
> How do paludis and pkgcore make this info available?

You can get PORTDIR with:
paludis --configuration-variable gentoo location

AFAIK, PORTDIR_OVERLAY is more tricky:
for r in $(paludis --list-repositories | sed -e "s/^* //g") ; do
if [[ $(paludis --configuration-variable ${r} format) = "ebuild" ]] ; then
paludis --configuration-variable ${r} location
fi
done


--
Santiago M. Mola
Jabber ID: cooldwind@gmail.com
--
gentoo-dev@lists.gentoo.org mailing list
 

Thread Tools




All times are GMT. The time now is 11:18 AM.

VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org