Mailinglist Archive: opensuse-packaging (267 mails)

< Previous Next >
Re: [opensuse-packaging] How to detect package's version in specfile?

Quoting Marguerite Su <i@xxxxxxxxxxxxx>:

在 2012-11-1 下午11:37,"Guido Berhoerster" <gber@xxxxxxxxxxxx>写道:

> PS: Guido, is "s|\\..*$||" regression? I asked around on gtalk, but no
> one knows such regex style...can you explain it a little bit?

Not sure what you mean, it's just a BRE, the double backslash is
needed there because rpmbuild also interprets backslashes.

What is BRE?

I mean, the rpmquery gets a 16.0.1, and you used a pipe and sed s///
replacement to get 16.

But \..*$ doesn't looks like the regex we normally use, the
[0–9]\.[0-9]\. Stuff. So.I want to know how it works like regex. Eg I
want to cut 2.8.9 to 9, how can I do that in your way?

sed is flexible in which character. So Guide decided to usw | insead of /

so you could also write
"s/\\..*$//"

then, what does this sed mean:

as Guido already said, \\ is just for rpm to consume one, so we get a
'real' sed string of:
s/\..*$//, which in turn means:
\. => a literal dot (looking at 16.0.1, this matches the 'first' dot')
.* => any amount of characters of any type
$ => end of line.

so we match .0.1 in this
and using substitution, replaces this with [nothing]
resulting in '16' being left alone.

Hth,
Dominique


--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >
List Navigation