Hi,
When using Mike Harris' rpmbuild-nonroot setup (except for the no archs hack) I have a problem building rpm. See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=124364 .
rpmbuild -bp rpm.spec fails: error: File /data/rpmbuild-fc1/rpm-1.8.1/rpm-4.2.1.tar.gz: No such file or directory
It looks like the last "Version:" (popt's) is being used in the path expansion for %setup.
$ rpm --showrc | grep sourcedir RPM_SOURCE_DIR="%{u2p:%{_sourcedir}}" RPM_SOURCE_DIR="%{_sourcedir}" -14: _sourcedir %{_topdir}/%{name}-%{version} -14: _specdir %{_sourcedir}
The latest "Version:" tag in the spec file is the one for popt. It looks as if this value is substituted for %{version}. How can this be fixed?
Leonard.
On Wed, 2004-05-26 at 16:00, Leonard den Ottolander wrote:
Hi,
When using Mike Harris' rpmbuild-nonroot setup (except for the no archs hack) I have a problem building rpm. See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=124364 .
rpmbuild -bp rpm.spec fails: error: File /data/rpmbuild-fc1/rpm-1.8.1/rpm-4.2.1.tar.gz: No such file or directory
It looks like the last "Version:" (popt's) is being used in the path expansion for %setup.
$ rpm --showrc | grep sourcedir RPM_SOURCE_DIR="%{u2p:%{_sourcedir}}" RPM_SOURCE_DIR="%{_sourcedir}" -14: _sourcedir %{_topdir}/%{name}-%{version} -14: _specdir %{_sourcedir}
The latest "Version:" tag in the spec file is the one for popt. It looks as if this value is substituted for %{version}. How can this be fixed?
I guess this has to be fixed in RPM itself -- I think you should file it in Bugzilla (actually I stumbled over this a while ago but was too lazy to file it ;-).
Nils
Hi Nils,
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=124364 .
-14: _sourcedir %{_topdir}/%{name}-%{version}
The latest "Version:" tag in the spec file is the one for popt. It looks as if this value is substituted for %{version}. How can this be fixed?
I guess this has to be fixed in RPM itself -- I think you should file it in Bugzilla (actually I stumbled over this a while ago but was too lazy to file it ;-).
What do you think the above bugzilla reference is for? Sadly Jeff has already tagged this a WONTFIX. Too bad, as this setup with spec, source and patch files separated by package is very convenient.
Guess we will have to work around packages that define "Version:" tags for sub packages. Too bad :( .
Leonard.
Hi,
I wrote:
When using Mike Harris' rpmbuild-nonroot setup (except for the no archs hack) I have a problem building rpm. See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=124364 .
rpmbuild -bp rpm.spec fails: error: File /data/rpmbuild-fc1/rpm-1.8.1/rpm-4.2.1.tar.gz: No such file or directory
It looks like the last "Version:" (popt's) is being used in the path expansion for %setup.
I've come up with a patch that fixes the macros %{PACKAGE_VERSION} and %{PACKAGE_RELEASE} so one can use
%_sourcedir %{_topdir}/%{name}-%{PACKAGE_VERSION}
Fixing the preferred macros %{version} and %{release} via headerAddEntry() is much more intrusive, so I'm not sure if creating such a patch is worth the time spent (not even sure if inclusion would be considered as the above bug is a WONTFIX).
I hope this patch is of use to those who use the non root rpm build setup.
Inlining it here for reference, it's also attached to the above bug report. Note the line wraps.
--- rpm-4.2.1/build/parsePreamble.c.000 2002-12-21 18:26:43.000000000 +0100 +++ rpm-4.2.1/build/parsePreamble.c 2004-06-21 00:56:37.000000000 +0200 @@ -459,7 +459,7 @@ */ /*@-boundswrite@*/ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro, - const char *lang) + const char *lang, const int initialPackage) /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ /*@modifies spec->macros, spec->st, spec->buildRootURL, spec->sources, spec->numSources, spec->noSource, @@ -521,14 +521,16 @@ spec->lineNum, "version", spec->line); return RPMERR_BADSPEC; } - addMacro(spec->macros, "PACKAGE_VERSION", NULL, field, RMIL_OLDSPEC); + if (initialPackage) + addMacro(spec->macros, "PACKAGE_VERSION", NULL, field, RMIL_OLDSPEC); } else if (tag == RPMTAG_RELEASE) { if (strchr(field, '-') != NULL) { rpmError(RPMERR_BADSPEC, _("line %d: Illegal char '-' in %s: %s\n"), spec->lineNum, "release", spec->line); return RPMERR_BADSPEC; } - addMacro(spec->macros, "PACKAGE_RELEASE", NULL, field, RMIL_OLDSPEC-1); + if (initialPackage) + addMacro(spec->macros, "PACKAGE_RELEASE", NULL, field, RMIL_OLDSPEC-1); } (void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1); break; @@ -906,7 +908,7 @@ spec->lineNum, spec->line); return RPMERR_BADSPEC; } - if (handlePreambleTag(spec, pkg, tag, macro, lang)) + if (handlePreambleTag(spec, pkg, tag, macro, lang, initialPackage)) return RPMERR_BADSPEC; if (spec->BANames && !spec->recursing) return PART_BUILDARCHITECTURES;
Leonard.
Hi,
I wrote,
I've come up with a patch that fixes the macros %{PACKAGE_VERSION} and %{PACKAGE_RELEASE} so one can use
%_sourcedir %{_topdir}/%{name}-%{PACKAGE_VERSION}
Fixing the preferred macros %{version} and %{release} via headerAddEntry() is much more intrusive, so I'm not sure if creating such a patch is worth the time spent (not even sure if inclusion would be considered as the above bug is a WONTFIX).
The patch to fix the other macros was not as intrusive as I thought. The attached patch now distinguishes between PART_PREAMBLE and PART_PACKAGE (newly introduced). It sets initialPackage to 0 only after the first %package tag is found and sets the macros conditionally.
This patch seems to work as intended. You can now use %_sourcedir %{_topdir}/%{name}-%{version}
The only question remaining is if there are other macros apart from %{version} and %{release} that should not be overwritten when a next package is parsed.
Leonard.