RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/build/ files.c rpm/lib/ depends.c psm.c rp...

From: Jeff Johnson <jbj@rpm5.org>
Date: Sat 18 Aug 2007 - 23:32:31 CEST
Message-Id: <20070818213231.8A03C348458@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   18-Aug-2007 23:32:31
  Branch: HEAD                             Handle: 2007081822322803

  Modified files:
    rpm                     CHANGES
    rpm/build               files.c
    rpm/lib                 depends.c psm.c rpmfi.c rpmfi.h rpminstall.c
                            transaction.c
    rpm/rpmdb               hdrNVR.c rpmdb.c

  Log:
    - permit mixed binary/source installation transactions.

  Summary:
    Revision    Changes     Path
    1.1586      +1  -0      rpm/CHANGES
    1.261       +2  -1      rpm/build/files.c
    1.339       +10 -5      rpm/lib/depends.c
    2.220       +1  -0      rpm/lib/psm.c
    2.74        +56 -1      rpm/lib/rpmfi.c
    2.38        +11 -1      rpm/lib/rpmfi.h
    1.160       +6  -51     rpm/lib/rpminstall.c
    1.330       +9  -0      rpm/lib/transaction.c
    1.8         +6  -0      rpm/rpmdb/hdrNVR.c
    1.152       +8  -0      rpm/rpmdb/rpmdb.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1585 -r1.1586 CHANGES
  --- rpm/CHANGES	18 Aug 2007 16:45:02 -0000	1.1585
  +++ rpm/CHANGES	18 Aug 2007 21:32:28 -0000	1.1586
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: permit mixed binary/source installation transactions.
       - jbj: re-add rpmcache/rpmcmp/rpmdigest tools.
       - jbj: more rpmInstall refactoring.
       - jbj: use rpmgi for --addsign/--checksig arg iteration.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/files.c
  ============================================================================
  $ cvs diff -u -r1.260 -r1.261 files.c
  --- rpm/build/files.c	17 Aug 2007 18:53:05 -0000	1.260
  +++ rpm/build/files.c	18 Aug 2007 21:32:29 -0000	1.261
  @@ -1523,7 +1523,8 @@
   		freecon(scon);
   	}
       }
  -    matchpathcon_fini();
  +    if (sxfn != NULL && *sxfn != '\0')
  +	matchpathcon_fini();
       sxfn = _free(sxfn);
   
       (void) headerAddEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE,
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/depends.c
  ============================================================================
  $ cvs diff -u -r1.338 -r1.339 depends.c
  --- rpm/lib/depends.c	3 Aug 2007 18:29:53 -0000	1.338
  +++ rpm/lib/depends.c	18 Aug 2007 21:32:29 -0000	1.339
  @@ -391,7 +391,6 @@
       if (!(upgrade & 0x1))
   	goto exit;
   
  -    /* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */
       if (isSource)
   	goto exit;
   
  @@ -2351,10 +2350,16 @@
   	    ? rpmteDS(p, RPMTAG_REQUIRENAME) : NULL);
   	conflicts = (!(depFlags & RPMDEPS_FLAG_NOCONFLICTS)
   	    ? rpmteDS(p, RPMTAG_CONFLICTNAME) : NULL);
  -	dirnames = (!(depFlags & RPMDEPS_FLAG_NOPARENTDIRS)
  -	    ? rpmteDS(p, RPMTAG_DIRNAMES) : NULL);
  -	linktos = (!(depFlags & RPMDEPS_FLAG_NOLINKTOS)
  -	    ? rpmteDS(p, RPMTAG_FILELINKTOS) : NULL);
  +	/* XXX srpm's don't have directory paths. */
  +	if (p->isSource) {
  +	    dirnames = NULL;
  +	    linktos = NULL;
  +	} else {
  +	    dirnames = (!(depFlags & RPMDEPS_FLAG_NOPARENTDIRS)
  +		? rpmteDS(p, RPMTAG_DIRNAMES) : NULL);
  +	    linktos = (!(depFlags & RPMDEPS_FLAG_NOLINKTOS)
  +		? rpmteDS(p, RPMTAG_FILELINKTOS) : NULL);
  +	}
   
   	rc = checkPackageDeps(ts, rpmteNEVRA(p),
   			requires, conflicts, dirnames, linktos,
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/psm.c
  ============================================================================
  $ cvs diff -u -r2.219 -r2.220 psm.c
  --- rpm/lib/psm.c	17 Aug 2007 16:04:51 -0000	2.219
  +++ rpm/lib/psm.c	18 Aug 2007 21:32:29 -0000	2.220
  @@ -2273,6 +2273,7 @@
   	break;
       case PSM_RPMDB_ADD:
   	if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)	break;
  +	if (fi->isSource)	break;	/* XXX never add SRPM's */
   	if (fi->h == NULL)	break;	/* XXX can't happen */
   
   	/* Add header to db, doing header check if requested */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfi.c
  ============================================================================
  $ cvs diff -u -r2.73 -r2.74 rpmfi.c
  --- rpm/lib/rpmfi.c	17 Aug 2007 18:50:20 -0000	2.73
  +++ rpm/lib/rpmfi.c	18 Aug 2007 21:32:29 -0000	2.74
  @@ -105,6 +105,11 @@
       return j;
   }
   
  +int rpmfiIsSource(rpmfi fi)
  +{
  +    return (fi != NULL ? fi->isSource : 0);
  +}
  +
   const char * rpmfiBN(rpmfi fi)
   {
       const char * BN = NULL;
  @@ -1219,7 +1224,8 @@
   	    fi->fddictx = _free(fi->fddictx);
   	    fi->fddictn = _free(fi->fddictn);
   
  -	}
  +	} else if (fi->isSource)	/* XXX SRPM's always re-alloc fi->dil */
  +	    fi->dil = _free(fi->dil);
   	/*@=evalorder@*/
       }
       /*@=branchstate@*/
  @@ -1318,6 +1324,7 @@
       fi->hfd = headerFreeData;
   
       fi->h = (h != NULL && scareMem ? headerLink(h) : NULL);
  +    fi->isSource = (headerIsEntry(h, RPMTAG_SOURCERPM) == 0);
   
       if (fi->fsm == NULL)
   	fi->fsm = newFSM();
  @@ -1518,6 +1525,54 @@
   	_fdupe(fi, fddictn);
   
   	fi->h = headerFree(fi->h);
  +    } else if (fi->isSource)	/* XXX SRPM's always re-alloc fi->dil */
  +	_fdupe(fi, dil);
  +
  +    if (fi->isSource && fi->dc == 1 && *fi->dnl[0] == '\0') {
  +	const char ** av = xcalloc(4+1, sizeof(*av));
  +	char * te;
  +	size_t nb;
  +
  +	av[0] = rpmGenPath(rpmtsRootDir(ts), "%{_sourcedir}", "");
  +	av[1] = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", "");
  +	av[2] = rpmGenPath(rpmtsRootDir(ts), "%{_patchdir}", "");
  +	av[3] = rpmGenPath(rpmtsRootDir(ts), "%{_icondir}", "");
  +	av[4] = NULL;
  +
  +	/* Hack up a header RPM_STRING_ARRAY_TYPE array. */
  +	fi->dnl = hfd(fi->dnl, -1);
  +	fi->dc = 4;
  +	nb = fi->dc * sizeof(*av);
  +	for (i = 0; i < fi->dc; i++)
  +	    nb += strlen(av[i]) + sizeof("/");
  +
  +	fi->dnl = xmalloc(nb);
  +	te = (char *) (&fi->dnl[fi->dc]);
  +	*te = '\0';
  +	for (i = 0; i < fi->dc; i++) {
  +	    fi->dnl[i] = te;
  +	    te = stpcpy( stpcpy(te, av[i]), "/");
  +	    *te++ = '\0';
  +	}
  +	av = argvFree(av);
  +
  +	/* Map basenames to appropriate directories. */
  +	for (i = 0; i < fi->fc; i++) {
  +	    if (fi->fflags[i] & RPMFILE_SOURCE)
  +		fi->dil[i] = 0;
  +	    else if (fi->fflags[i] & RPMFILE_SPECFILE)
  +		fi->dil[i] = 1;
  +	    else if (fi->fflags[i] & RPMFILE_PATCH)
  +		fi->dil[i] = 2;
  +	    else if (fi->fflags[i] & RPMFILE_ICON)
  +		fi->dil[i] = 3;
  +	    else {
  +		const char * b = fi->bnl[i];
  +		const char * be = b + strlen(b) - sizeof(".spec") - 1;
  +
  +		fi->dil[i] = (be > b && !strcmp(be, ".spec") ? 1 : 0);
  +	    }
  +	}
       }
   
       dnlmax = -1;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfi.h
  ============================================================================
  $ cvs diff -u -r2.37 -r2.38 rpmfi.h
  --- rpm/lib/rpmfi.h	19 Jun 2007 02:32:42 -0000	2.37
  +++ rpm/lib/rpmfi.h	18 Aug 2007 21:32:29 -0000	2.38
  @@ -130,7 +130,7 @@
   
   /*@only@*/ /*@null@*/
       char * fn;			/*!< File name buffer. */
  -    int fnlen;			/*!< FIle name buffer length. */
  +    int fnlen;			/*!< File name buffer length. */
   
       int astriplen;
       int striplen;
  @@ -148,6 +148,8 @@
       int keep_header;		/*!< Keep header? */
       uint_32 color;		/*!< Color bit(s) from file color union. */
   
  +    int isSource;		/*!< Is this a SRPM? */
  +
   /*@owned@*/
       uint_32 * replacedSizes;	/*!< (TR_ADDED) */
   
  @@ -270,6 +272,14 @@
   	/*@modifies fi @*/;
   
   /**
  + * Return source rpm marker from file info set.
  + * @param fi		file info set
  + * @return		source rpm?
  + */
  +int rpmfiIsSource(/*@null@*/ rpmfi fi)
  +	/*@*/;
  +
  +/**
    * Return current base name from file info set.
    * @param fi		file info set
    * @return		current base name, NULL on invalid
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpminstall.c
  ============================================================================
  $ cvs diff -u -r1.159 -r1.160 rpminstall.c
  --- rpm/lib/rpminstall.c	18 Aug 2007 16:29:21 -0000	1.159
  +++ rpm/lib/rpminstall.c	18 Aug 2007 21:32:29 -0000	1.160
  @@ -310,7 +310,6 @@
   {
       int numFailed = 0;
       int numRPMS = 0;
  -    ARGV_t sourceURL = NULL;
       rpmRelocation relocations = NULL;
       rpmRC rpmrc = RPMRC_OK;
       rpmVSFlags vsflags, ovsflags;
  @@ -405,7 +404,6 @@
       while (rpmgiNext(gi) == RPMRC_OK) {
   	Header h = rpmgiHeader(gi);
   	const char * fn;
  -	int isSource;
   
   	if (h == NULL) {
   	    numFailed++;
  @@ -413,15 +411,6 @@
   	}
   	fn = rpmgiHdrPath(gi);
   
  -	/* === Check for source package, saving for delayed installs. */
  -	isSource = (headerIsEntry(h, RPMTAG_SOURCERPM) == 0);
  -	if (isSource) {
  -	    rpmMessage(RPMMESS_DEBUG, D_("\tadded source package [%d]: %s\n"),
  -		argvCount(sourceURL), fn);
  -	    argvAdd(&sourceURL, fn);
  -	    continue;
  -	}
  -
   	/* === Check for relocatable package. */
   	if (relocations) {
   	    const char ** paths;
  @@ -468,16 +457,13 @@
   	}
   
   	/* === Add binary package to transaction set. */
  -	rc = rpmtsAddInstallElement(ts, h, (fnpyKey)fn,
  +	rc = rpmtsAddInstallElement(ts, h, (fnpyKey)xstrdup(fn),
   			(ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,
   			ia->relocations);
   
   	if (relocations)
   	    relocations->oldPath = _free(relocations->oldPath);
   
  -	rpmMessage(RPMMESS_DEBUG, D_("\tadded binary package [%d]: %s\n"),
  -			numRPMS, fn);
  -
   	numRPMS++;
       }
   
  @@ -485,66 +471,35 @@
   
   }	/* end-of-transaction-build */
   
  -    rpmMessage(RPMMESS_DEBUG, D_("found %d source and %d binary packages\n"),
  -		argvCount(sourceURL), numRPMS);
  -
       if (numFailed) goto exit;
   
  -    rpmcliPackagesTotal += argvCount(sourceURL);
  -
       if (numRPMS) {
   	if (!(ia->installInterfaceFlags & INSTALL_NODEPS)
   	 && (rc = rpmcliInstallCheck(ts)) != 0) {
  -	    numFailed = (numRPMS + argvCount(sourceURL));
  +	    numFailed = numRPMS;
   	    (void) rpmcliInstallSuggests(ts);
   	}
   
   	if (!(ia->installInterfaceFlags & INSTALL_NOORDER)
   	 && (rc = rpmcliInstallOrder(ts)) != 0)
  -	    numFailed = (numRPMS + argvCount(sourceURL));
  +	    numFailed = numRPMS;
   
   	/* Drop added/available package indices and dependency sets. */
   	rpmtsClean(ts);
   
   	if (numFailed == 0
   	 && (rc = rpmcliInstallRun(ts, NULL, ia->probFilter)) != 0)
  -	    numFailed += (rc < 0 ? numRPMS : rc) + argvCount(sourceURL);
  +	    numFailed += (rc < 0 ? numRPMS : rc);
       }
   
       if (numFailed) goto exit;
   
  -    if (sourceURL) {
  -	int numSRPMS = argvCount(sourceURL);
  -	FD_t fd;
  -
  -	for (i = 0; i < numSRPMS; i++) {
  -	    if (sourceURL[i] == NULL) continue;
  -	    fd = Fopen(sourceURL[i], "r.fdio");
  -	    if (fd == NULL || Ferror(fd)) {
  -		rpmMessage(RPMMESS_ERROR, _("cannot open file %s: %s\n"),
  -			   sourceURL[i], Fstrerror(fd));
  -		if (fd != NULL) {
  -		    xx = Fclose(fd);
  -		    fd = NULL;
  -		}
  -		continue;
  -	    }
  -
  -	    if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) {
  -		rpmrc = rpmInstallSourcePackage(ts, fd, NULL, NULL);
  -		if (rpmrc != RPMRC_OK) numFailed++;
  -	    }
  -
  -	    xx = Fclose(fd);
  -	    fd = NULL;
  -	}
  -    }
  -
   exit:
  -    sourceURL = argvFree(sourceURL);
   
  +#ifdef	NOTYET	/* XXX grrr, segfault in selabel_close */
       if (!(ia->transFlags & RPMTRANS_FLAG_NOCONTEXTS))
   	matchpathcon_fini();
  +#endif
   
       rpmtsEmpty(ts);
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/transaction.c
  ============================================================================
  $ cvs diff -u -r1.329 -r1.330 transaction.c
  --- rpm/lib/transaction.c	3 Aug 2007 18:29:53 -0000	1.329
  +++ rpm/lib/transaction.c	18 Aug 2007 21:32:29 -0000	1.330
  @@ -990,6 +990,7 @@
   
   	tsi = rpmtsiInit(rbts);
   	while((te = rpmtsiNext(tsi, TR_REMOVED)) != NULL) {
  +	    if (te->isSource) continue;
   	    if(!te->u.removed.dboffset)
   		continue;
   	    rc = rpmdbRemove(rpmtsGetRdb(rbts),
  @@ -1243,6 +1244,7 @@
   	rpmdbMatchIterator mi;
   	int fc;
   
  +	if (p->isSource) continue;
   	if ((fi = rpmtsiFi(pi)) == NULL)
   	    continue;	/* XXX can't happen */
   	fc = rpmfiFC(fi);
  @@ -1292,6 +1294,7 @@
       while ((p = rpmtsiNext(pi, TR_REMOVED)) != NULL) {
   	int fc;
   
  +	if (p->isSource) continue;
   	if ((fi = rpmtsiFi(pi)) == NULL)
   	    continue;	/* XXX can't happen */
   	fc = rpmfiFC(fi);
  @@ -1310,6 +1313,7 @@
   	rpmMessage(RPMMESS_DEBUG, D_("running pre-transaction scripts\n"));
   	pi = rpmtsiInit(ts);
   	while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) {
  +	    if (p->isSource) continue;
   	    if ((fi = rpmtsiFi(pi)) == NULL)
   		continue;	/* XXX can't happen */
   
  @@ -1389,6 +1393,7 @@
       while ((p = rpmtsiNext(pi, 0)) != NULL) {
   	int fc;
   
  +	if (p->isSource) continue;
   	if ((fi = rpmtsiFi(pi)) == NULL)
   	    continue;	/* XXX can't happen */
   	fc = rpmfiFC(fi);
  @@ -1443,6 +1448,7 @@
   
   	(void) rpmdbCheckSignals();
   
  +	if (p->isSource) continue;
   	if ((fi = rpmtsiFi(pi)) == NULL)
   	    continue;	/* XXX can't happen */
   	fc = rpmfiFC(fi);
  @@ -1483,6 +1489,7 @@
   
   	(void) rpmdbCheckSignals();
   
  +	if (p->isSource) continue;
   	if ((fi = rpmtsiFi(pi)) == NULL)
   	    continue;	/* XXX can't happen */
   	fc = rpmfiFC(fi);
  @@ -1635,6 +1642,7 @@
        */
       pi = rpmtsiInit(ts);
       while ((p = rpmtsiNext(pi, 0)) != NULL) {
  +	if (p->isSource) continue;
   	if ((fi = rpmtsiFi(pi)) == NULL)
   	    continue;	/* XXX can't happen */
   	if (rpmfiFC(fi) == 0)
  @@ -1670,6 +1678,7 @@
   
   	    (void) rpmdbCheckSignals();
   
  +	    if (p->isSource) continue;
   	    if ((fi = rpmtsiFi(pi)) == NULL)
   		continue;	/* XXX can't happen */
   	    switch (rpmteType(p)) {
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/hdrNVR.c
  ============================================================================
  $ cvs diff -u -r1.7 -r1.8 hdrNVR.c
  --- rpm/rpmdb/hdrNVR.c	3 Aug 2007 18:29:54 -0000	1.7
  +++ rpm/rpmdb/hdrNVR.c	18 Aug 2007 21:32:31 -0000	1.8
  @@ -164,6 +164,12 @@
   		*rp = NULL;
       }
       if (ap) {
  +	if (!headerIsEntry(h, RPMTAG_ARCH))
  +	    *ap = "pubkey";
  +	else
  +	if (!headerIsEntry(h, RPMTAG_SOURCERPM))
  +	    *ap = "src";
  +	else
   	if (!(headerGetEntry(h, RPMTAG_ARCH, &type, ap, &count)
   	    && type == RPM_STRING_TYPE && count == 1))
   		*ap = NULL;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.c
  ============================================================================
  $ cvs diff -u -r1.151 -r1.152 rpmdb.c
  --- rpm/rpmdb/rpmdb.c	17 Aug 2007 05:36:05 -0000	1.151
  +++ rpm/rpmdb/rpmdb.c	18 Aug 2007 21:32:31 -0000	1.152
  @@ -4013,6 +4013,14 @@
   			_RECNUM);
   		continue;
   	    }
  +	    if (!headerIsEntry(h, RPMTAG_SOURCERPM)
  +	     &&  headerIsEntry(h, RPMTAG_ARCH))
  +	    {
  +		rpmError(RPMERR_INTERNAL,
  +			_("header #%u in the database is SRPM -- skipping.\n"),
  +			_RECNUM);
  +		continue;
  +	    }
   
   	    /* Filter duplicate entries ? (bug in pre rpm-3.0.4) */
   	    if (_db_filter_dups || newdb->db_filter_dups) {
  @@ .
Received on Sat Aug 18 23:32:31 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.