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.
--
mount -t life -o ro /dev/dna /genetic/research