On Sun, 21 Oct 2007 11:44:46 +0100
Steve Long <[EMAIL PROTECTED]> wrote:

> Markus Rothe wrote:
> 
> > Attached are the scripts I use to commit packages stable/unstable.
> > Somewhere must be a bug!
> > 
> > 'name_split.cpp' splits a package name like sys-devel/gcc-4.1.2 into
> > category, package name and version number. It's done in c++ as
> > that's the only language I do more with than 'hello world'
> > programms. Not much more, just more. ;-)
> >
> You can do this quite easily with a shell function. Here's a slightly
> modded version of the one we use in update:
> # returns true if there was a version
> getPkgNameVer() {
>         case "$1" in
>         *-cvs[0-9]*)
>                 pName=${1%-cvs[0-9]*}
>                 pVer=${1#$pName-}
> ;;      *-[0-9]*)
>                 pName=${1%%-[0-9]*} # from first -N
>                 pVer=${1#$pName-}
> ;;      *)
>                 pName=$1
>                 pVer=
> ;;      esac
>         pCat=${pName%/*}; pN=${pName#*/}
>         [ "$pVer" ] && return 0
>         return 1
> }
> ..which leaves the results in globals pName (which includes cat)
> pVer, pCat and pN (no category.) It handles cvs ebuilds as well, and
> is in sh.

But like name_splitted.cpp is buggy as it assumes that a dash followed
by a digit starts the version part. See
  echo ${PORTDIR}/*-*/* | tr ' ' '\n' | grep '\-[[:digit:]]'
for some names that break the assumption.

And no clue what that cvs stuff is supposed to do, as there are no
packages using that naming pattern, and the (unused) cvs versioning
extension in portage-2.1 also uses a different pattern.

Marius

-- 
Public Key at http://www.genone.de/info/gpg-key.pub

In the beginning, there was nothing. And God said, 'Let there be
Light.' And there was still nothing, but you could see a bit better.

Attachment: signature.asc
Description: PGP signature

Reply via email to