[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: using rpmmacros to automatically update release



On 3/27/07, Sebastien BLAISOT <sblaisot pjdirect fr> wrote:
Jeff Johnson a écrit :

>> is there a way to define a macro saying something like
>> Release: %{release}.repo
>>
>
> That should work exactly as is.

In a spec file.


Humm, I think I'm doing something wrong.
I've put the above line in my ~/.rpmmacro file and... nothing.
release remains what is defined in the spec file.


Try in ~/.rpmmacros
  %release yadda

Or from command line
   --define 'release yadda'

what I want is simply rpmbuild --rebuild foo-1.0-1.src.rpm and obtain
foo-1.0-1.repo.arch.rpm and rpm -qp foo-1.0-1.repo.arch.rpm respond
foo-1.0-1.repo.rpm


See above.

>> i don't want to edit all spec files by hand and maintain a fork for
>> each package.
>>
>> alternatively, if there is no solution with an rpm macro, I will have
>> to script it. is there a way to know the name of the spec file from a
>> srp.rpm source package ?
>
> Generating a spec file is likely less hassle than using a macro imho.

generating a new spec file for each package I have to recompile and
*maintaining* it requires too much work from me...
I just want to use the src rpms as the integrators give them to me and
have a "rpm building chain" that automatically add what I need in the
release field.


No hassle is what you want, understood.

> This is likely easiest way to extract the name of the spec file:
>
>     $ rpm -qlp rpm-4.4.9-0.1.src.rpm | grep 'spec$'
>     rpm.spec

not if there is a file in the SOURCES that's named something.spec (by
example, the rpm package could include an example.spec file in its
source package that would be added in a doc directory as an example)


Yep.

> Note that "foo.spec" is just a convention even if widely used.
>
> The spec file is always in the same location iirc, so this is likely to
> work:
>
>     $ rpm -qlp rpm-4.4.9-0.1.src.rpm | tail -1
>     rpm.spec

humm, interresting.
are we sure that the spec file is always on last position ?


The position is deterministic iirc.

> There's also a file flag that marks a spec file in a src rpm iirc.

Humm, very interesting.
I'll look a bit further in that direction.


The flag is in RPMTAG_FILEFLAGS with value
   RPMFILE_SPECFILE    = (1 <<  5)

Testing whether the bit is on is left as an exercise ...

73 de Jeff


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]