[packagers] Snippet to parse SRPM filename
Dag Wieers
dag at wieers.com
Wed Aug 8 12:15:18 CEST 2007
On Tue, 7 Aug 2007, Who Knows wrote:
> Anyone have a bullet proof script or regex to separate an SRPM into its
> package, version, release, disttag components?
>
> 98% is easy, but those other 2% of what I assume are non-standard seem tricky.
>
> Of course when I say non-standard, I am not referring to the rpmforge rpms. :)
>
> I am actually parsing the original dist/extras srpms names.
I do not understand the question. Are you parsing the SPEC file or are you
parsing the filename ?
For the filename, what I usually do is this:
rpm="test-devel-1.2.3-4.i386.rpm"
name="${rpm%-*-*}"
rest1="${rpm#*-*-}
version="${rest1%-*}"
rest2="${rest1#*-}"
release="${rest2%.*.*}"
rest3="${rest2#*.}"
arch="${rest3%.*}"
That works consistenly.
-- dag wieers, dag at wieers.com, http://dag.wieers.com/ --
[Any errors in spelling, tact or fact are transmission errors]
More information about the packagers
mailing list