- inherit group tag from the main package (#470714)

- ignore BuildArch tags for anyarch actions (#442105)
- don't check package BuildRequires when doing --rmsource (#452477)
- don't fail because of missing sources when only spec removal is requested
    (#472427)
This commit is contained in:
Jindrich Novy 2009-02-16 17:31:31 +00:00
parent 0d875cb9bb
commit 84fa912e75
3 changed files with 171 additions and 1 deletions

View File

@ -0,0 +1,119 @@
diff -up rpm-4.6.0/build/build.c.anyarch-actions-fix rpm-4.6.0/build/build.c
--- rpm-4.6.0/build/build.c.anyarch-actions-fix 2008-12-05 12:49:22.000000000 +0100
+++ rpm-4.6.0/build/build.c 2009-02-16 13:19:43.000000000 +0100
@@ -15,21 +15,18 @@ static int _build_debug = 0;
/**
*/
-static void doRmSource(rpmSpec spec)
+rpmRC doRmSource(rpmSpec spec)
{
struct Source *p;
Package pkg;
- int rc;
+ int rc = 0;
-#if 0
- rc = unlink(spec->specFile);
-#endif
-
for (p = spec->sources; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
rc = unlink(fn);
fn = _free(fn);
+ if (rc) goto exit;
}
}
@@ -39,9 +36,12 @@ static void doRmSource(rpmSpec spec)
char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
rc = unlink(fn);
fn = _free(fn);
+ if (rc) goto exit;
}
}
}
+exit:
+ return !rc ? RPMRC_OK : RPMRC_FAIL;
}
/*
diff -up rpm-4.6.0/build.c.anyarch-actions-fix rpm-4.6.0/build.c
--- rpm-4.6.0/build.c.anyarch-actions-fix 2008-12-05 12:49:16.000000000 +0100
+++ rpm-4.6.0/build.c 2009-02-16 13:19:43.000000000 +0100
@@ -240,6 +240,12 @@ static int buildForTarget(rpmts ts, cons
goto exit;
}
+ /* Don't parse spec if only its removal is requested */
+ if (ba->buildAmount == RPMBUILD_RMSPEC) {
+ rc = unlink(specFile);
+ goto exit;
+ }
+
/* Parse the spec file */
#define _anyarch(_f) \
(((_f)&(RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL|RPMBUILD_PACKAGEBINARY)) == 0)
@@ -253,6 +259,13 @@ static int buildForTarget(rpmts ts, cons
goto exit;
}
+ if ( ba->buildAmount&RPMBUILD_RMSOURCE && !(ba->buildAmount&~(RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)) ) {
+ rc = doRmSource(spec);
+ if ( rc == RPMRC_OK && ba->buildAmount&RPMBUILD_RMSPEC )
+ rc = unlink(specFile);
+ goto exit;
+ }
+
/* Assemble source header from parsed components */
initSourceHeader(spec);
diff -up rpm-4.6.0/build/parsePreamble.c.anyarch-actions-fix rpm-4.6.0/build/parsePreamble.c
--- rpm-4.6.0/build/parsePreamble.c.anyarch-actions-fix 2009-02-16 13:19:43.000000000 +0100
+++ rpm-4.6.0/build/parsePreamble.c 2009-02-16 13:19:43.000000000 +0100
@@ -859,8 +859,14 @@ int parsePreamble(rpmSpec spec, int init
goto exit;
}
if (spec->BANames && !spec->recursing) {
- res = PART_BUILDARCHITECTURES;
- goto exit;
+ /* Ignore BuildArch tags for anyarch actions */
+ if (spec->anyarch) {
+ spec->BANames = _free(spec->BANames);
+ spec->BACount = 0;
+ } else {
+ res = PART_BUILDARCHITECTURES;
+ goto exit;
+ }
}
}
if ((rc =
@@ -895,8 +901,8 @@ int parsePreamble(rpmSpec spec, int init
addMacro(spec->macros, "buildroot", NULL, spec->buildRoot, RMIL_SPEC);
}
- /* XXX Skip valid arch check if not building binary package */
- if (!spec->anyarch && checkForValidArchitectures(spec)) {
+ /* This check is harmless as BuildArch tags are ignored in case of anyarch != 0 */
+ if (checkForValidArchitectures(spec)) {
goto exit;
}
diff -up rpm-4.6.0/build/rpmbuild.h.anyarch-actions-fix rpm-4.6.0/build/rpmbuild.h
--- rpm-4.6.0/build/rpmbuild.h.anyarch-actions-fix 2008-12-05 12:49:22.000000000 +0100
+++ rpm-4.6.0/build/rpmbuild.h 2009-02-16 13:19:43.000000000 +0100
@@ -273,6 +273,13 @@ int parseExpressionBoolean(rpmSpec spec,
char * parseExpressionString(rpmSpec spec, const char * expr);
/** \ingroup rpmbuild
+ * Remove all sources assigned to spec file.
+ *
+ * @param spec spec file control structure
+ * @return RPMRC_OK on success
+ */
+rpmRC doRmSource(rpmSpec spec);
+/** \ingroup rpmbuild
* Run a build script, assembled from spec file scriptlet section.
*
* @param spec spec file control structure

View File

@ -0,0 +1,40 @@
diff -up rpm-4.6.0/build/parsePreamble.c.inherit-group rpm-4.6.0/build/parsePreamble.c
--- rpm-4.6.0/build/parsePreamble.c.inherit-group 2008-12-05 12:49:44.000000000 +0100
+++ rpm-4.6.0/build/parsePreamble.c 2009-02-16 12:43:41.000000000 +0100
@@ -900,20 +900,30 @@ int parsePreamble(rpmSpec spec, int init
goto exit;
}
- if (pkg == spec->packages)
+ /* It is the main package */
+ if (pkg == spec->packages) {
fillOutMainPackage(pkg->header);
+ /* Define group tag to something when group is undefined in main package*/
+ if (!headerIsEntry(pkg->header, RPMTAG_GROUP)) {
+ headerPutString(pkg->header, RPMTAG_GROUP, "Unspecified");
+ }
+ }
if (checkForDuplicates(pkg->header, NVR)) {
goto exit;
}
- if (pkg != spec->packages)
+ if (pkg != spec->packages) {
headerCopyTags(spec->packages->header, pkg->header,
(rpmTag *)copyTagsDuringParse);
-
- /* Many things expect group to always exist, put something in there... */
- if (!headerIsEntry(pkg->header, RPMTAG_GROUP)) {
- headerPutString(pkg->header, RPMTAG_GROUP, "Unspecified");
+ /* inherit group tag from the main package if unspecified */
+ if (!headerIsEntry(pkg->header, RPMTAG_GROUP)) {
+ struct rpmtd_s td;
+
+ headerGet(spec->packages->header, RPMTAG_GROUP, &td, HEADERGET_DEFAULT);
+ headerPut(pkg->header, &td, HEADERPUT_DEFAULT);
+ rpmtdFreeData(&td);
+ }
}
if (checkForRequired(pkg->header, NVR)) {

View File

@ -18,7 +18,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: 3%{?dist}
Release: 4%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@ -37,6 +37,8 @@ Patch3: rpm-4.6.0-fedora-specspo.patch
# Patches already in upstream
Patch200: rpm-4.6.0-rc1-defaultdocdir.patch
Patch201: rpm-4.6.0-inherit-group.patch
Patch202: rpm-4.6.0-anyarch-actions-fix.patch
# These are not yet upstream
Patch300: rpm-4.6.0-extra-provides.patch
@ -172,6 +174,8 @@ that will manipulate RPM packages and databases.
# upstream but not on 4.6.x branch yet, oops
%patch200 -p1 -b .defaultdocdir
%patch201 -p1 -b .inherit-group
%patch202 -p1 -b .anyarch-actions-fix
%patch300 -p1 -b .extra-prov
@ -373,6 +377,13 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Mon Feb 16 2009 Jindrich Novy <jnovy@redhat.com> - 4.6.0-4
- inherit group tag from the main package (#470714)
- ignore BuildArch tags for anyarch actions (#442105)
- don't check package BuildRequires when doing --rmsource (#452477)
- don't fail because of missing sources when only spec removal
is requested (#472427)
* Mon Feb 16 2009 Panu Matilainen <pmatilai@redhat.com> - 4.6.0-3
- updated fontconfig provide script - fc-query does all the hard work now