diff --git a/SOURCES/rpm-4.11.x-elem-progress.patch b/SOURCES/rpm-4.11.x-elem-progress.patch
new file mode 100644
index 0000000..7025075
--- /dev/null
+++ b/SOURCES/rpm-4.11.x-elem-progress.patch
@@ -0,0 +1,77 @@
+From 08473f4ad8d79e6d232832c6863b2848f8a41734 Mon Sep 17 00:00:00 2001
+From: Michal Domonkos <mdomonko@redhat.com>
+Date: Mon, 7 Dec 2015 17:13:26 +0100
+Subject: [PATCH] Add RPMCALLBACK_ELEM_PROGRESS callback type
+
+Currently, there's no callback type that would be issued per each
+transaction element.  RPMCALLBACK_TRANS_PROGRESS is only issued during
+the prepare phase but not when packages are actually installed or
+erased.  Likewise, RPMCALLBACK_INST_ST* and RPMCALLBACK_UNINST_ST* won't
+be issued if an install or erase operation is skipped for some reason (a
+script or package upgrade failure).
+
+Having such a callback would allow the Python API consumers to always
+know upfront which element is about to be processed, before any other
+callbacks are issued.  This is important since not every callback type
+carries enough data about the subject package; while the INST types
+provide the user object passed to a former addInstall call, the UNINST
+types only provide the package name (which may not be unique within the
+transaction set).
+
+This commit adds such a callback.
+
+(cherry picked from commit 448db68ceb5be3c7171b7ec0ea908d905792dc2f)
+---
+ lib/rpmcallback.h  | 1 +
+ lib/transaction.c  | 4 ++++
+ python/rpmmodule.c | 1 +
+ 3 files changed, 6 insertions(+)
+
+diff --git a/lib/rpmcallback.h b/lib/rpmcallback.h
+index b3b05c6c1..b6d434c01 100644
+--- a/lib/rpmcallback.h
++++ b/lib/rpmcallback.h
+@@ -31,6 +31,7 @@ typedef enum rpmCallbackType_e {
+     RPMCALLBACK_SCRIPT_START	= (1 << 16),
+     RPMCALLBACK_SCRIPT_STOP	= (1 << 17),
+     RPMCALLBACK_INST_STOP	= (1 << 18),
++    RPMCALLBACK_ELEM_PROGRESS	= (1 << 19),
+ } rpmCallbackType;
+ 
+ /**
+diff --git a/lib/transaction.c b/lib/transaction.c
+index 45c30b5ba..1cd9ca674 100644
+--- a/lib/transaction.c
++++ b/lib/transaction.c
+@@ -1410,12 +1410,16 @@ exit:
+ static int rpmtsProcess(rpmts ts)
+ {
+     rpmtsi pi;	rpmte p;
++    tsMembers tsmem = rpmtsMembers(ts);
+     int rc = 0;
++    int i = 0;
+ 
+     pi = rpmtsiInit(ts);
+     while ((p = rpmtsiNext(pi, 0)) != NULL) {
+ 	int failed;
+ 
++	rpmtsNotify(ts, NULL, RPMCALLBACK_ELEM_PROGRESS, i++,
++		tsmem->orderCount);
+ 	rpmlog(RPMLOG_DEBUG, "========== +++ %s %s-%s 0x%x\n",
+ 		rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
+ 
+diff --git a/python/rpmmodule.c b/python/rpmmodule.c
+index 04285a63f..fc8115d30 100644
+--- a/python/rpmmodule.c
++++ b/python/rpmmodule.c
+@@ -459,6 +459,7 @@ static int initModule(PyObject *m)
+     REGISTER_ENUM(RPMCALLBACK_SCRIPT_START);
+     REGISTER_ENUM(RPMCALLBACK_SCRIPT_STOP);
+     REGISTER_ENUM(RPMCALLBACK_INST_STOP);
++    REGISTER_ENUM(RPMCALLBACK_ELEM_PROGRESS);
+ 
+     REGISTER_ENUM(RPMPROB_BADARCH);
+     REGISTER_ENUM(RPMPROB_BADOS);
+-- 
+2.13.2
+
diff --git a/SOURCES/rpm-4.11.x-reinstall.patch b/SOURCES/rpm-4.11.x-reinstall.patch
new file mode 100644
index 0000000..75cbdfa
--- /dev/null
+++ b/SOURCES/rpm-4.11.x-reinstall.patch
@@ -0,0 +1,368 @@
+This patchset consists of following upstream commits:
+- 1f3164ae6975747e72af383f2d74c27245e6fe36
+- fd40d58efa0fbff535f273e5ae5c200d43d28aef
+- bfa76529864b9dfb29258f4dedc3fa9de9c5aeca
+- 6665503ec6fb6430ecaafb3e318a4730f146efa9
+- bf856744f2820a1625ef9428284b5788d18103f3
+- c5200145fa08da884ce2c1ed85941363eeae6407
+- 80dee39fb1f97ab3927c10bdd13c7c438b5677be
+
+with some changes to make RPM to compile.
+
+diff -uNr rpm-4.11.3/doc/rpm.8 rpm-4.11.3.reinstall/doc/rpm.8
+--- rpm-4.11.3/doc/rpm.8	2017-07-12 16:57:41.711722771 +0200
++++ rpm-4.11.3.reinstall/doc/rpm.8	2017-07-12 16:14:26.842680581 +0200
+@@ -110,7 +110,7 @@
+ One of the following basic modes must be selected:
+ \fBQuery\fR,
+ \fBVerify\fR,
+-\fBInstall/Upgrade/Freshen\fR,
++\fBInstall/Upgrade/Freshen/Reinstall\fR,
+ \fBUninstall\fR,
+ \fBSet Owners/Groups\fR,
+ \fBShow Querytags\fR, and
+@@ -206,6 +206,13 @@
+ This will upgrade packages, but only ones for which an earlier version is
+ installed.
+ .PP
++The general form of an rpm reinstall command is 
++.PP
++\fBrpm\fR {\fB--reinstall\fR} [\fBinstall-options\fR] \fB\fIPACKAGE_FILE\fB\fR\fI ...\fR
++.PP
++This reinstalls a previously installed package.
++.PP
++.PP
+ .TP
+ \fB--allfiles\fR
+ Installs or upgrades all the missingok files in the package,
+diff -uNr rpm-4.11.3/lib/depends.c rpm-4.11.3.reinstall/lib/depends.c
+--- rpm-4.11.3/lib/depends.c	2017-07-12 16:57:41.742723041 +0200
++++ rpm-4.11.3.reinstall/lib/depends.c	2017-07-12 16:14:12.203550634 +0200
+@@ -54,6 +54,12 @@
+ #undef HASHTYPE
+ #undef HTKEYTYPE
+ 
++enum addOp_e {
++    RPMTE_INSTALL	= 0,
++    RPMTE_UPGRADE	= 1,
++    RPMTE_REINSTALL	= 2,
++};
++
+ /**
+  * Check for supported payload format in header.
+  * @param h		header to check
+@@ -126,7 +132,7 @@
+ }
+ 
+ /* Return rpmdb iterator with removals optionally pruned out */
+-static rpmdbMatchIterator rpmtsPrunedIterator(rpmts ts, rpmDbiTagVal tag,
++rpmdbMatchIterator rpmtsPrunedIterator(rpmts ts, rpmDbiTagVal tag,
+ 					      const char * key, int prune)
+ {
+     rpmdbMatchIterator mi = rpmtsInitIterator(ts, tag, key, 0);
+@@ -152,22 +158,29 @@
+ }
+ 
+ /* Add erase elements for older packages of same color (if any). */
+-static int addUpgradeErasures(rpmts ts, rpm_color_t tscolor,
++static int addSelfErasures(rpmts ts, rpm_color_t tscolor, int op,
+ 				rpmte p, rpm_color_t hcolor, Header h)
+ {
+     Header oh;
+     rpmdbMatchIterator mi = rpmtsInitIterator(ts, RPMDBI_NAME, rpmteN(p), 0);
+     int rc = 0;
++    int cmp;
+ 
+     while((oh = rpmdbNextIterator(mi)) != NULL) {
+ 	/* Ignore colored packages not in our rainbow. */
+ 	if (skipColor(tscolor, hcolor, headerGetNumber(oh, RPMTAG_HEADERCOLOR)))
+ 	    continue;
+ 
+-	/* Skip packages that contain identical NEVR. */
+-	if (rpmVersionCompare(h, oh) == 0)
++	cmp = rpmVersionCompare(h, oh);
++
++	/* On upgrade, skip packages that contain identical NEVR. */
++	if ((op == RPMTE_UPGRADE) && (cmp == 0))
+ 	    continue;
+ 
++	/* On reinstall, skip packages with differing NEVR. */
++	if ((op == RPMTE_REINSTALL) && (cmp != 0))
++	    continue;
++	
+ 	if (removePackage(ts, oh, p)) {
+ 	    rc = 1;
+ 	    break;
+@@ -385,8 +398,8 @@
+     return al;
+ }
+ 
+-int rpmtsAddInstallElement(rpmts ts, Header h,
+-			fnpyKey key, int upgrade, rpmRelocation * relocs)
++static int addPackage(rpmts ts, Header h,
++		    fnpyKey key, int op, rpmRelocation * relocs)
+ {
+     tsMembers tsmem = rpmtsMembers(ts);
+     rpm_color_t tscolor = rpmtsColor(ts);
+@@ -403,10 +416,10 @@
+ 
+     /* Source packages are never "upgraded" */
+     if (isSource)
+-	upgrade = 0;
++	op = RPMTE_INSTALL;
+ 
+     /* Do lazy (readonly?) open of rpm database for upgrades. */
+-    if (upgrade && rpmtsGetRdb(ts) == NULL && rpmtsGetDBMode(ts) != -1) {
++    if (op != RPMTE_INSTALL && rpmtsGetRdb(ts) == NULL && rpmtsGetDBMode(ts) != -1) {
+ 	if ((ec = rpmtsOpenDB(ts, rpmtsGetDBMode(ts))) != 0)
+ 	    goto exit;
+     }
+@@ -419,7 +432,7 @@
+ 
+     /* Check binary packages for redundancies in the set */
+     if (!isSource) {
+-	oc = findPos(ts, tscolor, p, upgrade);
++	oc = findPos(ts, tscolor, p, (op == RPMTE_UPGRADE));
+ 	/* If we're replacing a previously added element, free the old one */
+ 	if (oc >= 0 && oc < tsmem->orderCount) {
+ 	    rpmalDel(tsmem->addedPackages, tsmem->order[oc]);
+@@ -451,15 +464,33 @@
+ 
+     /* Add erasure elements for old versions and obsoletions on upgrades */
+     /* XXX TODO: If either of these fails, we'd need to undo all additions */
+-    if (upgrade) {
+-	addUpgradeErasures(ts, tscolor, p, rpmteColor(p), h);
++    if (op != RPMTE_INSTALL)
++	addSelfErasures(ts, tscolor, op, p, rpmteColor(p), h);
++    if (op == RPMTE_UPGRADE)
+ 	addObsoleteErasures(ts, tscolor, p);
+-    }
+ 
+ exit:
+     return ec;
+ }
+ 
++int rpmtsAddInstallElement(rpmts ts, Header h,
++			fnpyKey key, int upgrade, rpmRelocation * relocs)
++{
++    int op = (upgrade == 0) ? RPMTE_INSTALL : RPMTE_UPGRADE;
++    if (rpmtsSetupTransactionPlugins(ts) == RPMRC_FAIL)
++	return 1;
++    return addPackage(ts, h, key, op, relocs);
++}
++
++int rpmtsAddReinstallElement(rpmts ts, Header h, fnpyKey key)
++{
++    if (rpmtsSetupTransactionPlugins(ts) == RPMRC_FAIL)
++	return 1;
++    /* TODO: pull relocations from installed package */
++    /* TODO: should reinstall of non-installed package fail? */
++    return addPackage(ts, h, key, RPMTE_REINSTALL, NULL);
++}
++
+ int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
+ {
+     return removePackage(ts, h, NULL);
+diff -uNr rpm-4.11.3/lib/poptI.c rpm-4.11.3.reinstall/lib/poptI.c
+--- rpm-4.11.3/lib/poptI.c	2013-06-07 09:37:21.000000000 +0200
++++ rpm-4.11.3.reinstall/lib/poptI.c	2017-07-12 16:14:26.842680581 +0200
+@@ -247,6 +247,10 @@
+ 	&rpmIArgs.installInterfaceFlags, (INSTALL_UPGRADE|INSTALL_INSTALL),
+ 	N_("upgrade package(s)"),
+ 	N_("<packagefile>+") },
++ { "reinstall", '\0', POPT_BIT_SET,
++	&rpmIArgs.installInterfaceFlags, (INSTALL_REINSTALL|INSTALL_INSTALL),
++	N_("reinstall package(s)"),
++	N_("<packagefile>+") },
+ 
+    POPT_TABLEEND
+ };
+diff -uNr rpm-4.11.3/lib/rpmcli.h rpm-4.11.3.reinstall/lib/rpmcli.h
+--- rpm-4.11.3/lib/rpmcli.h	2017-07-12 16:57:41.741723032 +0200
++++ rpm-4.11.3.reinstall/lib/rpmcli.h	2017-07-12 16:14:26.842680581 +0200
+@@ -293,7 +293,8 @@
+     INSTALL_FRESHEN	= (1 << 6),	/*!< from --freshen */
+     INSTALL_INSTALL	= (1 << 7),	/*!< from --install */
+     INSTALL_ERASE	= (1 << 8),	/*!< from --erase */
+-    INSTALL_ALLMATCHES	= (1 << 9)	/*!< from --allmatches */
++    INSTALL_ALLMATCHES	= (1 << 9),	/*!< from --allmatches */
++    INSTALL_REINSTALL	= (1 << 10),	/*!< from --reinstall */
+ };
+ 
+ typedef rpmFlags rpmInstallFlags;
+@@ -354,7 +355,7 @@
+ };
+ 
+ /** \ingroup rpmcli
+- * Install/upgrade/freshen binary rpm package.
++ * Install/upgrade/freshen/reinstall binary rpm package.
+  * @param ts		transaction set
+  * @param ia		mode flags and parameters
+  * @param fileArgv	array of package file names (NULL terminated)
+diff -uNr rpm-4.11.3/lib/rpminstall.c rpm-4.11.3.reinstall/lib/rpminstall.c
+--- rpm-4.11.3/lib/rpminstall.c	2014-09-05 13:48:07.000000000 +0200
++++ rpm-4.11.3.reinstall/lib/rpminstall.c	2017-07-12 16:14:26.843680590 +0200
+@@ -552,7 +552,10 @@
+ 	        continue;
+ 	    }
+ 
+-	rc = rpmtsAddInstallElement(ts, h, (fnpyKey)fileName,
++	if (ia->installInterfaceFlags & INSTALL_REINSTALL)
++	    rc = rpmtsAddReinstallElement(ts, h, (fnpyKey)fileName);
++	else
++	    rc = rpmtsAddInstallElement(ts, h, (fnpyKey)fileName,
+ 			(ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,
+ 			relocations);
+ 
+diff -uNr rpm-4.11.3/lib/rpmts.h rpm-4.11.3.reinstall/lib/rpmts.h
+--- rpm-4.11.3/lib/rpmts.h	2017-07-12 16:57:41.710722762 +0200
++++ rpm-4.11.3.reinstall/lib/rpmts.h	2017-07-12 16:14:12.203550634 +0200
+@@ -544,6 +544,16 @@
+ 		rpmRelocation * relocs);
+ 
+ /** \ingroup rpmts
++ * Add package to be reinstalled to transaction set.
++ *
++ * @param ts		transaction set
++ * @param h		header
++ * @param key		package retrieval key (e.g. file name)
++ * @return		0 on success
++ */
++int rpmtsAddReinstallElement(rpmts ts, Header h, const fnpyKey key);
++
++/** \ingroup rpmts
+  * Add package to be erased to transaction set.
+  * @param ts		transaction set
+  * @param h		header
+diff -uNr rpm-4.11.3/lib/rpmts_internal.h rpm-4.11.3.reinstall/lib/rpmts_internal.h
+--- rpm-4.11.3/lib/rpmts_internal.h	2014-06-04 11:25:23.000000000 +0200
++++ rpm-4.11.3.reinstall/lib/rpmts_internal.h	2017-07-12 16:44:18.613959252 +0200
+@@ -86,6 +86,11 @@
+ RPM_GNUC_INTERNAL
+ tsMembers rpmtsMembers(rpmts ts);
+ 
++/* Return rpmdb iterator with removals optionally pruned out */
++RPM_GNUC_INTERNAL
++rpmdbMatchIterator rpmtsPrunedIterator(rpmts ts, rpmDbiTagVal tag,
++					      const char * key, int prune);
++
+ RPM_GNUC_INTERNAL
+ rpmal rpmtsCreateAl(rpmts ts, rpmElementTypes types);
+ 
+@@ -118,6 +123,9 @@
+  */
+ void rpmtsSELabelFini(rpmts ts, int close_status);
+ 
++RPM_GNUC_INTERNAL
++rpmRC rpmtsSetupTransactionPlugins(rpmts ts);
++
+ #ifdef __cplusplus
+ }
+ #endif
+diff -uNr rpm-4.11.3/lib/transaction.c rpm-4.11.3.reinstall/lib/transaction.c
+--- rpm-4.11.3/lib/transaction.c	2017-07-12 16:57:41.747723085 +0200
++++ rpm-4.11.3.reinstall/lib/transaction.c	2017-07-12 16:43:59.563741144 +0200
+@@ -1138,7 +1138,7 @@
+ 	if (!(probFilter & RPMPROB_FILTER_REPLACEPKG)) {
+ 	    Header h;
+ 	    rpmdbMatchIterator mi;
+-	    mi = rpmtsInitIterator(ts, RPMDBI_NAME, rpmteN(p), 0);
++	    mi = rpmtsPrunedIterator(ts, RPMDBI_NAME, rpmteN(p), 1);
+ 	    rpmdbSetIteratorRE(mi, RPMTAG_EPOCH, RPMMIRE_STRCMP, rpmteE(p));
+ 	    rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_STRCMP, rpmteV(p));
+ 	    rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, RPMMIRE_STRCMP, rpmteR(p));
+@@ -1444,7 +1444,7 @@
+     return rc;
+ }
+ 
+-static rpmRC rpmtsSetupTransactionPlugins(rpmts ts)
++rpmRC rpmtsSetupTransactionPlugins(rpmts ts)
+ {
+     rpmRC rc = RPMRC_OK;
+     ARGV_t files = NULL;
+diff -uNr rpm-4.11.3/python/rpm/transaction.py rpm-4.11.3.reinstall/python/rpm/transaction.py
+--- rpm-4.11.3/python/rpm/transaction.py	2014-02-05 14:04:02.000000000 +0100
++++ rpm-4.11.3.reinstall/python/rpm/transaction.py	2017-07-12 16:14:22.573642686 +0200
+@@ -50,7 +50,7 @@
+         else:
+             return tuple(keys)
+ 
+-    def addInstall(self, item, key, how="u"):
++    def _f2hdr(self, item):
+         if isinstance(item, _string_types):
+             f = open(item)
+             header = self.hdrFromFdno(f)
+@@ -59,6 +59,10 @@
+             header = item
+         else:
+             header = self.hdrFromFdno(item)
++        return header
++
++    def addInstall(self, item, key, how="u"):
++        header = self._f2hdr(item)
+ 
+         if not how in ['u', 'i']:
+             raise ValueError('how argument must be "u" or "i"')
+@@ -67,6 +71,12 @@
+         if not TransactionSetCore.addInstall(self, header, key, upgrade):
+             raise rpm.error("adding package to transaction failed")
+ 
++    def addReinstall(self, item, key):
++        header = self._f2hdr(item)
++
++        if not TransactionSetCore.addReinstall(self, header, key):
++            raise rpm.error("adding package to transaction failed")
++
+     def addErase(self, item):
+         hdrs = []
+         if isinstance(item, rpm.hdr):
+diff -uNr rpm-4.11.3/python/rpmts-py.c rpm-4.11.3.reinstall/python/rpmts-py.c
+--- rpm-4.11.3/python/rpmts-py.c	2017-07-12 16:57:41.741723032 +0200
++++ rpm-4.11.3.reinstall/python/rpmts-py.c	2017-07-12 16:14:18.800609194 +0200
+@@ -190,6 +190,24 @@
+ }
+ 
+ static PyObject *
++rpmts_AddReinstall(rpmtsObject * s, PyObject * args)
++{
++    Header h = NULL;
++    PyObject * key;
++    int rc;
++
++    if (!PyArg_ParseTuple(args, "O&O:AddReinstall", 
++			  hdrFromPyObject, &h, &key))
++	return NULL;
++
++    rc = rpmtsAddReinstallElement(s->ts, h, key);
++    if (key && rc == 0) {
++	PyList_Append(s->keyList, key);
++    }
++    return PyBool_FromLong((rc == 0));
++}
++
++static PyObject *
+ rpmts_AddErase(rpmtsObject * s, PyObject * args)
+ {
+     Header h;
+@@ -693,6 +711,8 @@
+ static struct PyMethodDef rpmts_methods[] = {
+  {"addInstall",	(PyCFunction) rpmts_AddInstall,	METH_VARARGS,
+ 	NULL },
++ {"addReinstall",	(PyCFunction) rpmts_AddReinstall,	METH_VARARGS,
++	NULL },
+  {"addErase",	(PyCFunction) rpmts_AddErase,	METH_VARARGS|METH_KEYWORDS,
+ 	NULL },
+  {"check",	(PyCFunction) rpmts_Check,	METH_VARARGS|METH_KEYWORDS,
+diff -uNr rpm-4.11.3/rpmqv.c rpm-4.11.3.reinstall/rpmqv.c
+--- rpm-4.11.3/rpmqv.c	2012-11-07 13:55:24.000000000 +0100
++++ rpm-4.11.3.reinstall/rpmqv.c	2017-07-12 16:14:26.843680590 +0200
+@@ -135,7 +135,8 @@
+ #ifdef	IAM_RPMEIU
+   if (bigMode == MODE_UNKNOWN || (bigMode & MODES_IE))
+     {	int iflags = (ia->installInterfaceFlags &
+-		(INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL));
++			(INSTALL_UPGRADE|INSTALL_FRESHEN|
++			 INSTALL_INSTALL|INSTALL_REINSTALL));
+ 	int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
+ 
+ 	if (iflags & eflags)
diff --git a/SOURCES/rpm-4.11.x-skipattr.patch b/SOURCES/rpm-4.11.x-skipattr.patch
new file mode 100644
index 0000000..5095f7d
--- /dev/null
+++ b/SOURCES/rpm-4.11.x-skipattr.patch
@@ -0,0 +1,61 @@
+diff --git a/lib/query.c b/lib/query.c
+index 6f2d593a7..8a2623241 100644
+--- a/lib/query.c
++++ b/lib/query.c
+@@ -150,8 +150,8 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
+ 	if ((qva->qva_flags & QUERY_FOR_LICENSE) && !(fflags & RPMFILE_LICENSE))
+ 	    continue;
+ 
+-	/* If not querying %ghost, skip ghost files. */
+-	if ((qva->qva_fflags & RPMFILE_GHOST) && (fflags & RPMFILE_GHOST))
++	/* Skip on attributes (eg from --noghost) */
++	if (fflags & qva->qva_fflags)
+ 	    continue;
+ 
+ 	if (qva->qva_flags & QUERY_FOR_STATE) {
+diff --git a/lib/verify.c b/lib/verify.c
+index eb6f2e15e..df17a7b01 100644
+--- a/lib/verify.c
++++ b/lib/verify.c
+@@ -378,10 +378,11 @@ static const char * stateStr(rpmfileState fstate)
+  * @param ts		transaction set
+  * @param h		header to verify
+  * @param omitMask	bits to disable verify checks
+- * @param ghosts	should ghosts be verified?
++ * @param skipAttr	skip files with these attrs (eg %ghost)
+  * @return		0 no problems, 1 problems found
+  */
+-static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask, int ghosts)
++static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask,
++			rpmfileAttrs skipAttrs)
+ {
+     rpmVerifyAttrs verifyResult = 0;
+     int ec = 0;		/* assume no problems */
+@@ -398,8 +399,8 @@ static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask, int ghosts)
+ 	char ac;
+ 	int rc;
+ 
+-	/* If not verifying %ghost, skip ghost files. */
+-	if ((fileAttrs & RPMFILE_GHOST) && !ghosts)
++	/* Skip on attributes (eg from --noghost) */
++	if (skipAttrs & fileAttrs)
+ 	    continue;
+ 
+ 	rc = rpmVerifyFile(ts, fi, &verifyResult, omitMask);
+@@ -494,7 +495,6 @@ static int verifyDependencies(rpmts ts, Header h)
+ int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
+ {
+     rpmVerifyAttrs omitMask = ((qva->qva_flags & VERIFY_ATTRS) ^ VERIFY_ATTRS);
+-    int ghosts = (qva->qva_fflags & RPMFILE_GHOST);
+     int ec = 0;
+     int rc;
+ 
+@@ -503,7 +503,7 @@ int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
+ 	    ec = rc;
+     }
+     if (qva->qva_flags & VERIFY_FILES) {
+-	if ((rc = verifyHeader(ts, h, omitMask, ghosts)) != 0)
++	if ((rc = verifyHeader(ts, h, omitMask, qva->qva_fflags)) != 0)
+ 	    ec = rc;
+     }
+     if (qva->qva_flags & VERIFY_SCRIPT) {
diff --git a/SOURCES/rpm-4.11.x-weakdep-tags.patch b/SOURCES/rpm-4.11.x-weakdep-tags.patch
new file mode 100644
index 0000000..b8c5290
--- /dev/null
+++ b/SOURCES/rpm-4.11.x-weakdep-tags.patch
@@ -0,0 +1,102 @@
+diff -up rpm-4.11.3/build/pack.c.weakdep-tags rpm-4.11.3/build/pack.c
+--- rpm-4.11.3/build/pack.c.weakdep-tags	2017-11-13 16:46:28.552714717 +0200
++++ rpm-4.11.3/build/pack.c	2017-11-13 16:47:44.942681784 +0200
+@@ -228,8 +228,6 @@ static rpmTagVal depevrtags[] = {
+     RPMTAG_CONFLICTVERSION,
+     RPMTAG_ORDERVERSION,
+     RPMTAG_TRIGGERVERSION,
+-    RPMTAG_SUGGESTSVERSION,
+-    RPMTAG_ENHANCESVERSION,
+     0
+ };
+ 
+diff -up rpm-4.11.3/lib/rpmtag.h.weakdep-tags rpm-4.11.3/lib/rpmtag.h
+--- rpm-4.11.3/lib/rpmtag.h.weakdep-tags	2017-11-02 12:21:38.248264213 +0200
++++ rpm-4.11.3/lib/rpmtag.h	2017-11-02 12:24:16.159193622 +0200
+@@ -217,14 +217,14 @@ typedef enum rpmTag_e {
+     RPMTAG_PRETRANSPROG		= 1153,	/* s[] */
+     RPMTAG_POSTTRANSPROG	= 1154,	/* s[] */
+     RPMTAG_DISTTAG		= 1155,	/* s */
+-    RPMTAG_SUGGESTSNAME		= 1156,	/* s[] extension (unimplemented) */
+-#define	RPMTAG_SUGGESTS RPMTAG_SUGGESTSNAME	/* s[] (unimplemented) */
+-    RPMTAG_SUGGESTSVERSION	= 1157,	/* s[] extension (unimplemented) */
+-    RPMTAG_SUGGESTSFLAGS	= 1158,	/* i[] extension (unimplemented) */
+-    RPMTAG_ENHANCESNAME		= 1159,	/* s[] extension placeholder (unimplemented) */
+-#define	RPMTAG_ENHANCES RPMTAG_ENHANCESNAME	/* s[] (unimplemented) */
+-    RPMTAG_ENHANCESVERSION	= 1160,	/* s[] extension placeholder (unimplemented) */
+-    RPMTAG_ENHANCESFLAGS	= 1161,	/* i[] extension placeholder (unimplemented) */
++    RPMTAG_OLDSUGGESTSNAME		= 1156,	/* s[] extension (unimplemented) */
++#define	RPMTAG_OLDSUGGESTS RPMTAG_OLDSUGGESTSNAME	/* s[] (unimplemented) */
++    RPMTAG_OLDSUGGESTSVERSION	= 1157,	/* s[] extension (unimplemented) */
++    RPMTAG_OLDSUGGESTSFLAGS	= 1158,	/* i[] extension (unimplemented) */
++    RPMTAG_OLDENHANCESNAME		= 1159,	/* s[] extension placeholder (unimplemented) */
++#define	RPMTAG_OLDENHANCES RPMTAG_OLDENHANCESNAME	/* s[] (unimplemented) */
++    RPMTAG_OLDENHANCESVERSION	= 1160,	/* s[] extension placeholder (unimplemented) */
++    RPMTAG_OLDENHANCESFLAGS	= 1161,	/* i[] extension placeholder (unimplemented) */
+     RPMTAG_PRIORITY		= 1162, /* i[] extension placeholder (unimplemented) */
+     RPMTAG_CVSID		= 1163, /* s (unimplemented) */
+ #define	RPMTAG_SVNID	RPMTAG_CVSID	/* s (unimplemented) */
+@@ -307,6 +307,22 @@ typedef enum rpmTag_e {
+     RPMTAG_OBSOLETENEVRS	= 5043, /* s[] extension */
+     RPMTAG_CONFLICTNEVRS	= 5044, /* s[] extension */
+     RPMTAG_FILENLINKS		= 5045,	/* i[] extension */
++    RPMTAG_RECOMMENDNAME	= 5046,	/* s[] */
++#define	RPMTAG_RECOMMENDS RPMTAG_RECOMMENDNAME	/* s[] */
++    RPMTAG_RECOMMENDVERSION	= 5047,	/* s[] */
++    RPMTAG_RECOMMENDFLAGS	= 5048,	/* i[] */
++    RPMTAG_SUGGESTNAME		= 5049,	/* s[] */
++#define	RPMTAG_SUGGESTS RPMTAG_SUGGESTNAME	/* s[] */
++    RPMTAG_SUGGESTVERSION	= 5050,	/* s[] extension */
++    RPMTAG_SUGGESTFLAGS		= 5051,	/* i[] extension */
++    RPMTAG_SUPPLEMENTNAME	= 5052,	/* s[] */
++#define	RPMTAG_SUPPLEMENTS RPMTAG_SUPPLEMENTNAME /* s[] */
++    RPMTAG_SUPPLEMENTVERSION	= 5053,	/* s[] */
++    RPMTAG_SUPPLEMENTFLAGS	= 5054,	/* i[] */
++    RPMTAG_ENHANCENAME		= 5055,	/* s[] */
++#define	RPMTAG_ENHANCES RPMTAG_ENHANCENAME	/* s[] */
++    RPMTAG_ENHANCEVERSION	= 5056,	/* s[] */
++    RPMTAG_ENHANCEFLAGS		= 5057,	/* i[] */
+ 
+     RPMTAG_FIRSTFREE_TAG	/*!< internal */
+ } rpmTag;
+diff -up rpm-4.11.3/tests/rpmgeneral.at.weakdep-tags rpm-4.11.3/tests/rpmgeneral.at
+--- rpm-4.11.3/tests/rpmgeneral.at.weakdep-tags	2012-11-07 14:55:24.000000000 +0200
++++ rpm-4.11.3/tests/rpmgeneral.at	2017-11-02 12:21:38.248264213 +0200
+@@ -79,6 +79,10 @@ DISTTAG
+ DISTURL
+ DSAHEADER
+ E
++ENHANCEFLAGS
++ENHANCENAME
++ENHANCES
++ENHANCEVERSION
+ EPOCH
+ EPOCHNUM
+ EVR
+@@ -199,6 +203,10 @@ PROVIDES
+ PROVIDEVERSION
+ PUBKEYS
+ R
++RECOMMENDFLAGS
++RECOMMENDNAME
++RECOMMENDS
++RECOMMENDVERSION
+ RECONTEXTS
+ RELEASE
+ REMOVETID
+@@ -219,7 +227,15 @@ SOURCE
+ SOURCEPACKAGE
+ SOURCEPKGID
+ SOURCERPM
++SUGGESTFLAGS
++SUGGESTNAME
++SUGGESTS
++SUGGESTVERSION
+ SUMMARY
++SUPPLEMENTFLAGS
++SUPPLEMENTNAME
++SUPPLEMENTS
++SUPPLEMENTVERSION
+ TRIGGERCONDS
+ TRIGGERFLAGS
+ TRIGGERINDEX
diff --git a/SOURCES/rpm-4.13.x-Implement-noconfig-query.patch b/SOURCES/rpm-4.13.x-Implement-noconfig-query.patch
new file mode 100644
index 0000000..c8623eb
--- /dev/null
+++ b/SOURCES/rpm-4.13.x-Implement-noconfig-query.patch
@@ -0,0 +1,33 @@
+--- current/lib/poptQV.c.noconfig	2017-10-10 16:36:22.671332271 +0200
++++ current/lib/poptQV.c	2017-10-10 16:40:44.735808086 +0200
+@@ -185,6 +185,9 @@
+  { "noghost", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN,
+ 	&rpmQVKArgs.qva_fflags, RPMFILE_GHOST,
+         N_("skip %%ghost files"), NULL },
++ { "noconfig", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
++	&rpmQVKArgs.qva_fflags, RPMFILE_CONFIG,
++        N_("skip %%config files"), NULL },
+ 
+  { "qf", '\0', POPT_ARG_STRING | POPT_ARGFLAG_DOC_HIDDEN, 0, 
+ 	POPT_QUERYFORMAT, NULL, NULL },
+--- current/doc/rpm.8.noconfig	2017-10-10 16:36:22.671332271 +0200
++++ current/doc/rpm.8	2017-10-10 17:04:28.537393197 +0200
+@@ -76,7 +76,7 @@
+  [\fB--nodigest\fR] [\fB--nosignature\fR]
+  [\fB--nolinkto\fR] [\fB--nofiledigest\fR] [\fB--nosize\fR] [\fB--nouser\fR]
+  [\fB--nogroup\fR] [\fB--nomtime\fR] [\fB--nomode\fR] [\fB--nordev\fR]
+- [\fB--nocaps\fR]
++ [\fB--nocaps\fR] [\fB--noconfig\fR]
+ 
+ .SS "install-options"
+ .PP
+@@ -673,6 +673,9 @@
+ \fB--nofiles\fR
+ Don't verify any attributes of package files.
+ .TP
++\fB--noconfig\fR
++Don't verify config files.
++.TP
+ \fB--noscripts\fR
+ Don't execute the \fB%verifyscript\fR scriptlet (if any).
+ .TP
diff --git a/SOURCES/rpm-4.13.x-Make-the-stftime-buffer-big-enuff.patch b/SOURCES/rpm-4.13.x-Make-the-stftime-buffer-big-enuff.patch
new file mode 100644
index 0000000..6f31ae0
--- /dev/null
+++ b/SOURCES/rpm-4.13.x-Make-the-stftime-buffer-big-enuff.patch
@@ -0,0 +1,11 @@
+--- current/lib/formats.orig	2017-10-09 16:02:37.884785158 +0200
++++ current/lib/formats.c	2017-10-09 16:03:20.640862788 +0200
+@@ -101,7 +101,7 @@
+ 	val = xstrdup(_("(not a number)"));
+     } else {
+ 	struct tm * tstruct;
+-	char buf[50];
++	char buf[1024];
+ 	time_t dateint = rpmtdGetNumber(td);
+ 	tstruct = localtime(&dateint);
+ 
diff --git a/SOURCES/rpm-4.13.x-RPMCALLBACK_ELEM_PROGRESS-available-header.patch b/SOURCES/rpm-4.13.x-RPMCALLBACK_ELEM_PROGRESS-available-header.patch
new file mode 100644
index 0000000..2b779eb
--- /dev/null
+++ b/SOURCES/rpm-4.13.x-RPMCALLBACK_ELEM_PROGRESS-available-header.patch
@@ -0,0 +1,86 @@
+Move RPMCALLBACK_ELEM_PROGRESS to rpmteProcess to have header available
+
+The header of the rpmte is only available after rpmteOpen().
+Added num param to rpmteProcess to be able to signal the progress to the
+callback.
+
+(cherry picked from commit 124ed29259b05fdf574d5e3e145bc1201b24ae4d)
+---
+diff -uNr rpm-4.11.3.orig/lib/rpmte.c rpm-4.11.3/lib/rpmte.c
+--- rpm-4.11.3.orig/lib/rpmte.c	2017-08-23 15:39:18.195927789 +0200
++++ rpm-4.11.3/lib/rpmte.c	2017-08-23 15:40:12.857349575 +0200
+@@ -939,7 +939,7 @@
+     return rc;
+ }
+ 
+-int rpmteProcess(rpmte te, pkgGoal goal)
++int rpmteProcess(rpmte te, pkgGoal goal, int num)
+ {
+     /* Only install/erase resets pkg file info */
+     int scriptstage = (goal != PKG_INSTALL && goal != PKG_ERASE);
+@@ -959,6 +959,11 @@
+     }
+ 
+     if (rpmteOpen(te, reset_fi)) {
++	if (!scriptstage) {
++	    rpmtsNotify(te->ts, te, RPMCALLBACK_ELEM_PROGRESS, num,
++			rpmtsMembers(te->ts)->orderCount);
++	}
++
+ 	failed = rpmpsmRun(te->ts, te, goal);
+ 	rpmteClose(te, reset_fi);
+     }
+diff -uNr rpm-4.11.3.orig/lib/rpmte_internal.h rpm-4.11.3/lib/rpmte_internal.h
+--- rpm-4.11.3.orig/lib/rpmte_internal.h	2013-11-22 11:31:31.000000000 +0100
++++ rpm-4.11.3/lib/rpmte_internal.h	2017-08-23 15:40:24.654440605 +0200
+@@ -56,7 +56,7 @@
+ FD_t rpmtePayload(rpmte te);
+ 
+ RPM_GNUC_INTERNAL
+-int rpmteProcess(rpmte te, pkgGoal goal);
++int rpmteProcess(rpmte te, pkgGoal goal, int num);
+ 
+ RPM_GNUC_INTERNAL
+ void rpmteAddProblem(rpmte te, rpmProblemType type,
+diff -uNr rpm-4.11.3.orig/lib/transaction.c rpm-4.11.3/lib/transaction.c
+--- rpm-4.11.3.orig/lib/transaction.c	2017-08-23 15:39:18.257928268 +0200
++++ rpm-4.11.3/lib/transaction.c	2017-08-23 15:42:24.986369126 +0200
+@@ -1170,10 +1170,11 @@
+ static int runTransScripts(rpmts ts, pkgGoal goal) 
+ {
+     int rc = 0;
++    int i = 0;
+     rpmte p;
+     rpmtsi pi = rpmtsiInit(ts);
+     while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) {
+-	rc += rpmteProcess(p, goal);
++	rc += rpmteProcess(p, goal, i++);
+     }
+     rpmtsiFree(pi);
+     return rc;
+@@ -1415,7 +1416,6 @@
+ static int rpmtsProcess(rpmts ts)
+ {
+     rpmtsi pi;	rpmte p;
+-    tsMembers tsmem = rpmtsMembers(ts);
+     int rc = 0;
+     int i = 0;
+ 
+@@ -1423,8 +1423,6 @@
+     while ((p = rpmtsiNext(pi, 0)) != NULL) {
+ 	int failed;
+ 
+-	rpmtsNotify(ts, NULL, RPMCALLBACK_ELEM_PROGRESS, i++,
+-		tsmem->orderCount);
+ 	rpmlog(RPMLOG_DEBUG, "========== +++ %s %s-%s 0x%x\n",
+ 		rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
+ 
+@@ -1432,7 +1430,7 @@
+ 	    rpmtsSELabelInit(ts, 0);
+ 	}
+ 
+-	failed = rpmteProcess(p, rpmteType(p));
++	failed = rpmteProcess(p, rpmteType(p), i++);
+ 	if (failed) {
+ 	    rpmlog(RPMLOG_ERR, "%s: %s %s\n", rpmteNEVRA(p),
+ 		   rpmteTypeString(p), failed > 1 ? _("skipped") : _("failed"));
diff --git a/SOURCES/rpm-4.13.x-increase_header_size.patch b/SOURCES/rpm-4.13.x-increase_header_size.patch
new file mode 100644
index 0000000..7a2496a
--- /dev/null
+++ b/SOURCES/rpm-4.13.x-increase_header_size.patch
@@ -0,0 +1,59 @@
+From 89e6317c75b494905590903fadbfdc3c8d31e2b8 Mon Sep 17 00:00:00 2001
+From: Stefan Berger <stefanb@us.ibm.com>
+Date: Fri, 29 Apr 2016 07:09:49 -0400
+Subject: [PATCH] Extend header size to 256MB due to file signatures
+
+Extend the header size to 256MB in case an RPM has a lot of files
+and the file signatures do not fit within the current limit of 16MB.
+
+An example for an RPM with many files is kcbench-data-4.0. It contains
+more than 52000 files. With each signature with a 2048 bit key requiring
+256 bytes plus a preamble, its representation in text from, and other
+overhead, the size of the header (index length and data length) exceeds
+32Mb.
+
+If this particular RPM's files have been signed using this patch, older
+versions of the rpm tool will report the header being too large. So this
+failure is expected then.
+
+By setting the limit to 256MB we create a lot of room for the future.
+
+Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
+---
+ lib/header.c          | 2 +-
+ lib/header_internal.h | 5 +++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/lib/header.c b/lib/header.c
+index 81f2038..7f7c115 100644
+--- a/lib/header.c
++++ b/lib/header.c
+@@ -99,7 +99,7 @@ struct headerToken_s {
+ /** \ingroup header
+  * Maximum no. of bytes permitted in a header.
+  */
+-static const size_t headerMaxbytes = (32*1024*1024);
++static const size_t headerMaxbytes = (256*1024*1024);
+ 
+ #define	INDEX_MALLOC_SIZE	8
+ 
+diff --git a/lib/header_internal.h b/lib/header_internal.h
+index bbe2097..aed3977 100644
+--- a/lib/header_internal.h
++++ b/lib/header_internal.h
+@@ -45,9 +45,10 @@ struct indexEntry_s {
+ 
+ /**
+  * Sanity check on data size and/or offset and/or count.
+- * This check imposes a limit of 16 MB, more than enough.
++ * This check imposes a limit of 256 MB -- file signatures
++ * may require a lot of space in the header.
+  */
+-#define HEADER_DATA_MAX 0x00ffffff
++#define HEADER_DATA_MAX 0x0fffffff
+ #define hdrchkData(_nbytes) ((_nbytes) & (~HEADER_DATA_MAX))
+ 
+ /**
+-- 
+2.9.5
+
diff --git a/SOURCES/rpm-4.13.x-writable-tmp-dir.patch b/SOURCES/rpm-4.13.x-writable-tmp-dir.patch
new file mode 100644
index 0000000..9a33adb
--- /dev/null
+++ b/SOURCES/rpm-4.13.x-writable-tmp-dir.patch
@@ -0,0 +1,106 @@
+commit c707ab26362e795d3f9dba4eb87dc7ed99a28bcb
+Author: Robin Lee <cheeselee@fedoraproject.org>
+Date:   Sat Apr 8 21:21:39 2017 +0800
+
+    Fix non-standard inherented modes of directories in debuginfo
+    
+    In case that binary compiled from source generated in /tmp, a
+    /usr/src/debug/tmp directory will be created with the same mode as
+    /tmp, a.k.a 777, which should be avoided.
+    
+    Fixes: rhbz#641022
+
+diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
+old mode 100644
+new mode 100755
+index 547dbd9..6f38e19
+--- a/scripts/find-debuginfo.sh
++++ b/scripts/find-debuginfo.sh
+@@ -396,9 +396,10 @@
+   mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug"
+   LC_ALL=C sort -z -u "$SOURCEFILE" | grep -E -v -z '(<internal>|<built-in>)$' |
+   (cd "$RPM_BUILD_DIR"; cpio -pd0mL "${RPM_BUILD_ROOT}/usr/src/debug")
+-  # stupid cpio creates new directories in mode 0700, fixup
++  # stupid cpio creates new directories in mode 0700,
++  # and non-standard modes may be inherented from original directories, fixup
+   find "${RPM_BUILD_ROOT}/usr/src/debug" -type d -print0 |
+-  xargs --no-run-if-empty -0 chmod a+rx
++  xargs --no-run-if-empty -0 chmod 0755
+ fi
+ 
+ if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then
+
+commit e795899780337dea751d85db8f381eff3fe75275
+Author: Mark Wielaard <mark@klomp.org>
+Date:   Fri Apr 21 17:33:26 2017 +0200
+
+    debugedit: Only output comp_dir under build dir (once).
+    
+    The fix for rhbz#444310 (commit c1a5eb - Include empty CU current dirs)
+    was a little greedy. It would also include comp_dirs outside the build
+    root. Those are unnecessary and we don't have a good way to store them.
+    Such dirs (e.g. /tmp) would then show up at the root of /usr/src/debug.
+    
+    Fix this by including only comp_dirs under base_dir. Also only output
+    all dirs once (during phase zero) and don't output empty dirs (which
+    was harmless but would produce a warning from cpio).
+    
+    This still includes all empty dirs from the original rhbz#444310
+    nodir testcase and it is an alternative fix for rhbz#641022
+    (commit c707ab).
+    
+    Both fixes are necessary in case of an unexpected mode for a directory
+    actually in the build root that we want to include in the source list.
+    
+    Signed-off-by: Mark Wielaard <mark@klomp.org>
+
+diff --git a/tools/debugedit.c b/tools/debugedit.c
+index 8444e03..bf11513 100644
+--- a/tools/debugedit.c
++++ b/tools/debugedit.c
+@@ -926,27 +926,27 @@
+   /* Ensure the CU current directory will exist even if only empty.  Source
+      filenames possibly located in its parent directories refer relatively to
+      it and the debugger (GDB) cannot safely optimize out the missing
+-     CU current dir subdirectories.  */
+-  if (comp_dir && list_file_fd != -1)
++     CU current dir subdirectories.  Only do this once in phase one. And
++     only do this for dirs under our build/base_dir.  Don't output the
++     empty string (in case the comp_dir == base_dir).  */
++  if (phase == 0 && base_dir && comp_dir && list_file_fd != -1)
+     {
+-      char *p;
+-      size_t size;
+ 
+-      if (base_dir && has_prefix (comp_dir, base_dir))
+-	p = comp_dir + strlen (base_dir);
+-      else if (dest_dir && has_prefix (comp_dir, dest_dir))
+-	p = comp_dir + strlen (dest_dir);
+-      else
+-	p = comp_dir;
+-
+-      size = strlen (p) + 1;
+-      while (size > 0)
++      if (has_prefix (comp_dir, base_dir))
+ 	{
+-	  ssize_t ret = write (list_file_fd, p, size);
+-	  if (ret == -1)
+-	    break;
+-	  size -= ret;
+-	  p += ret;
++	  char *p = comp_dir + strlen (base_dir);
++	  if (p[0] != '\0')
++	    {
++	      size_t size = strlen (p) + 1;
++	      while (size > 0)
++		{
++		  ssize_t ret = write (list_file_fd, p, size);
++		  if (ret == -1)
++		    break;
++		  size -= ret;
++		  p += ret;
++		}
++	    }
+ 	}
+     }
+ 
diff --git a/SPECS/rpm.spec b/SPECS/rpm.spec
index 8b445aa..b7518c8 100644
--- a/SPECS/rpm.spec
+++ b/SPECS/rpm.spec
@@ -21,7 +21,7 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}25%{?dist}
+Release: %{?snapver:0.%{snapver}.}32%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/rpm-4.11.x/%{name}-%{srcver}.tar.bz2
@@ -82,6 +82,12 @@ Patch179: rpm-4.11.x-sources-to-lua-variables.patch
 Patch180: rpm-4.11.x-Fix-Python-hdr-refcount.patch
 Patch181: rpm-4.11.x-perl.req-skip-my-var-block.patch
 Patch182: rpm-4.11.x-verify-data-range.patch
+Patch183: rpm-4.13.x-writable-tmp-dir.patch
+Patch184: rpm-4.13.x-increase_header_size.patch
+Patch185: rpm-4.13.x-Make-the-stftime-buffer-big-enuff.patch
+Patch186: rpm-4.11.x-skipattr.patch
+Patch187: rpm-4.13.x-Implement-noconfig-query.patch
+Patch188: rpm-4.11.x-weakdep-tags.patch
 
 # Filter soname dependencies by name
 Patch200: rpm-4.11.x-filter-soname-deps.patch
@@ -115,6 +121,15 @@ Patch401: rpm-4.11.3-disable-collection-plugins.patch
 # Remove EVR check
 Patch402: rpm-4.11.3-EVR-validity-check.patch
 
+# Backport of RPMCALLBACK_ELEM_PROGRESS
+# https://bugzilla.redhat.com/show_bug.cgi?id=1466649
+Patch501: rpm-4.11.x-elem-progress.patch
+# Make header to be available for RPMCALLBACK_ELEM_PROGRESS
+Patch502: rpm-4.13.x-RPMCALLBACK_ELEM_PROGRESS-available-header.patch
+# Backport of reinstall functionality from 4.12
+# https://bugzilla.redhat.com/show_bug.cgi?id=1466650
+Patch503: rpm-4.11.x-reinstall.patch
+
 # Partially GPL/LGPL dual-licensed and some bits with BSD
 # SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD 
 License: GPLv2+
@@ -335,6 +350,12 @@ Requires: rpm-libs%{_isa} = %{version}-%{release}
 %patch180 -p1 -b .hdrrefcnt
 %patch181 -p1 -b .perlblock
 %patch182 -p1 -b .verifysignature
+%patch183 -p1 -b .writable_tmp
+%patch184 -p1 -b .hdr_size
+%patch185 -p1 -b .strtime
+%patch186 -p1 -b .skipattr
+%patch187 -p1 -b .noconfig-cli
+%patch188 -p1 -b .weakdep-tags
 
 %patch200 -p1 -b .filter-soname-deps
 %patch201 -p1 -b .dont-filter-ld64
@@ -363,6 +384,10 @@ Requires: rpm-libs%{_isa} = %{version}-%{release}
 %patch6 -p1 -b .armhfp-logic
 %endif
 
+%patch501 -p1 -b .elem-progress
+%patch502 -p1 -b .elem-progress-header
+%patch503 -p1 -b .reinstall
+
 %if %{with int_bdb}
 ln -s db-%{bdbver} db
 %endif
@@ -593,6 +618,32 @@ exit 0
 %doc COPYING doc/librpm/html/*
 
 %changelog
+* Mon Nov 13 2017 Panu Matilainen <pmatilai@redhat.com> - 4.11.3-32
+- Backport weak dependency tag definitions (#1508538)
+
+* Mon Oct 30 2017 Panu Matilainen <pmatilai@redhat.com> - 4.11.3-31
+- Backport missing infra for --noconfig option (#1406611)
+- As a side-effect, this also makes --noghost work as intended
+
+* Fri Oct 13 2017 Florian Festi <ffesti@redhat.com> - 4.11.3-30
+- Respin to fix changelog
+
+* Fri Oct 13 2017 Florian Festi <ffesti@redhat.com> - 4.11.3-29
+- Fix coverity warnings in patch for #1441098
+
+* Mon Oct 09 2017 Florian Festi <ffesti@redhat.com> - 4.11.3-28
+- Make sure files in /usr/src/debug are not world writable (RHBZ #1441098)
+- Increase maximal header size (RHBZ #1434656)
+- Increase buffer to be able to render Korean dates (RHBZ #1425231)
+- Add --noconfig option (RHBZ #1406611)
+
+* Wed Aug 23 2017 Igor Gnatenko <ignatenko@redhat.com> - 4.11.3-27
+- Make header available from RPMCALLBACK_ELEM_PROGRESS (RHBZ #1466649)
+
+* Wed Aug 02 2017 Igor Gnatenko <ignatenko@redhat.com> - 4.11.3-26
+- Backport RPMCALLBACK_ELEM_PROGRESS (RHBZ #1466649)
+- Backport reinstall feature (RHBZ #1466650)
+
 * Fri Mar 17 2017 Panu Matilainen <pmatilai@redhat.com> - 4.11.3-25
 - Really fix #1371487