Blob Blame History Raw
commit d7e2a04d68dea4d1c7dbaf457b5b4210dfa452f2
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Tue Jan 25 15:27:28 2011 +0200

    Teach rpm about post-transaction dependencies
    - %posttrans dependencies have their own peculiar semantics, they're
      install-only dependencies which have no implications on ordering.

diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 3d8b859..e4f4e0a 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -309,6 +309,7 @@ static struct tokenBits_s const installScriptBits[] = {
     { "rpmlib",		RPMSENSE_RPMLIB },
     { "verify",		RPMSENSE_SCRIPT_VERIFY },
     { "pretrans",	RPMSENSE_PRETRANS },
+    { "posttrans",	RPMSENSE_POSTTRANS },
     { NULL, 0 }
 };
 
diff --git a/build/parseScript.c b/build/parseScript.c
index d4b2293..87b3d58 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -139,7 +139,7 @@ int parseScript(rpmSpec spec, int parsePart)
 	break;
       case PART_POSTTRANS:
 	tag = RPMTAG_POSTTRANS;
-	tagflags = 0;
+	tagflags = RPMSENSE_POSTTRANS;
 	progtag = RPMTAG_POSTTRANSPROG;
 	flagtag = RPMTAG_POSTTRANSFLAGS;
 	partname = "%posttrans";
diff --git a/lib/formats.c b/lib/formats.c
index 386bdd3..7ce4608 100644
--- a/lib/formats.c
+++ b/lib/formats.c
@@ -251,6 +251,8 @@ static char * deptypeFormat(rpmtd td, char * formatPrefix)
 	    argvAdd(&sdeps, "prereq");
 	if (item & RPMSENSE_PRETRANS)
 	    argvAdd(&sdeps, "pretrans");
+	if (item & RPMSENSE_POSTTRANS)
+	    argvAdd(&sdeps, "posttrans");
 
 	if (sdeps) {
 	    val = argvJoin(sdeps, ",");
diff --git a/lib/order.c b/lib/order.c
index 9cda649..3b0849d 100644
--- a/lib/order.c
+++ b/lib/order.c
@@ -149,7 +149,7 @@ static inline int addRelation(rpmts ts,
     dsflags = rpmdsFlags(requires);
 
     /* Avoid dependendencies which are not relevant for ordering */
-    if (dsflags & (RPMSENSE_RPMLIB|RPMSENSE_CONFIG|RPMSENSE_PRETRANS))
+    if (dsflags & (RPMSENSE_RPMLIB|RPMSENSE_CONFIG|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS))
 	return 0;
 
     q = rpmalSatisfiesDepend(al, requires);
diff --git a/lib/rpmds.h b/lib/rpmds.h
index 75c1541..bf3ee2c 100644
--- a/lib/rpmds.h
+++ b/lib/rpmds.h
@@ -27,7 +27,8 @@ enum rpmsenseFlags_e {
     RPMSENSE_LESS	= (1 << 1),
     RPMSENSE_GREATER	= (1 << 2),
     RPMSENSE_EQUAL	= (1 << 3),
-    /* bits 4-5 unused */
+    /* bit 4 unused */
+    RPMSENSE_POSTTRANS	= (1 << 5),	/*!< %posttrans dependency */
     RPMSENSE_PREREQ	= (1 << 6), 	/* legacy prereq dependency */
     RPMSENSE_PRETRANS	= (1 << 7),	/*!< Pre-transaction dependency. */
     RPMSENSE_INTERP	= (1 << 8),	/*!< Interpreter used by scriptlet. */
@@ -70,11 +71,12 @@ typedef rpmFlags rpmsenseFlags;
     RPMSENSE_RPMLIB | \
     RPMSENSE_KEYRING | \
     RPMSENSE_PRETRANS | \
+    RPMSENSE_POSTTRANS | \
     RPMSENSE_PREREQ)
 
 #define	_notpre(_x)		((_x) & ~RPMSENSE_PREREQ)
 #define	_INSTALL_ONLY_MASK \
-    _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING|RPMSENSE_PRETRANS)
+    _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS)
 #define	_ERASE_ONLY_MASK  \
     _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)