문제

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
도움이 되었습니까?

해결책

simple:

$ rpmbuild --undefine dist -bs foo.spec

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top