Pergunta

I'm trying to work out my build process for RPMs.

When I produce source RPMs, it's including %{dist} in the file name. I would prefer that it only do that for the binary RPMs, since the source RPMs are not distribution specific.

The dist macro is defined in /etc/rpm/macros.dist. How would I undefine it while building source RPMs?

foo.spec:

Name:    foo
Version: 0.1
Release: 1%{?dist}
# etc...

Build command:

$ rpmbuild -bs foo.spec
$ ls ../SRPMS
$ foo-0.1-1.el6.src.rpm
Foi útil?

Solução

simple:

$ rpmbuild --undefine dist -bs foo.spec

Outras dicas

I don't believe there's a way to conditionally check for what kind of package you are building, but you could try defining a macro at the command line only when building source packages. You would then conditionally checking for the macro at the top of your spec file:

$ rpmbuild -bs --define "mymacro 1" mypackage.spec

mypackage.spec:

%if 0%{?mymacro}
%undefine dist
%endif

To build a binary package, just omit the --define "mymacro 1":

$ rpmbuild -bb mypackage.spec
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top