diff --git a/SOURCES/rpm-4.11.1-digests-max.patch b/SOURCES/rpm-4.11.1-digests-max.patch
new file mode 100644
index 0000000..53cbf91
--- /dev/null
+++ b/SOURCES/rpm-4.11.1-digests-max.patch
@@ -0,0 +1,24 @@
+commit 85b62554d2632d06f975f90697c4c11c3f180931
+Author: Panu Matilainen <pmatilai@redhat.com>
+Date:   Tue Feb 18 18:13:54 2014 +0200
+
+    Make room for SHA224 in digest bundles. Doh.
+    
+    - Should've really been in commit 20cfa7d2b4c927798ad38126821d194fafd93ffe
+      but at the time NSS didn't even support SHA-224 so it was untestable.
+      Now that it does, and somebody actually bothered to test...
+      Fixes RhBug:1066494.
+
+diff --git a/rpmio/digest.c b/rpmio/digest.c
+index c1f73b3..4956a30 100644
+--- a/rpmio/digest.c
++++ b/rpmio/digest.c
+@@ -8,7 +8,7 @@
+ 
+ #include "debug.h"
+ 
+-#define DIGESTS_MAX 11
++#define DIGESTS_MAX 12
+ struct rpmDigestBundle_s {
+     int index_min;			/*!< Smallest index of active digest */
+     int index_max;			/*!< Largest index of active digest */
diff --git a/SOURCES/rpm-4.11.1-headersort.patch b/SOURCES/rpm-4.11.1-headersort.patch
new file mode 100644
index 0000000..3b2f27e
--- /dev/null
+++ b/SOURCES/rpm-4.11.1-headersort.patch
@@ -0,0 +1,125 @@
+commit da3a3a14e757ccd517e2eb2a3f0293ff48b3ff7f
+Author: Panu Matilainen <pmatilai@redhat.com>
+Date:   Wed Feb 5 13:36:31 2014 +0200
+
+    A boolean flag is not sufficient to cover three different states...
+    
+    - HEADERFLAG_SORTED flag bit has been used to track the header
+      sort state since beginning of times, but the header sort actually
+      has three different states: truly unsorted (such as after additions),
+      sorted by index achieved with headerSort(), or sorted by offset which
+      is creatively called headerUnsort() in the API.
+    
+      There's exactly one place that requires offset sorting, namely
+      headerExport(). It does call headerUnsort() explicitly, but
+      headerUnsort() would not do anything unless the header was in
+      index-sorted state. This is quite often the case, but data addition
+      would unset the sorted-flag, and causing headerUnsort() not to
+      do anything at all when it most certainly should have. That incorrect
+      sorting caused headerExport() calculations to be wildly off.
+    
+      This ancient bug was unearthed by the innocent looking
+      commit eae671556470136c37951f53ca966cd1bd09aac4: prior to that,
+      in half the cases headerSizeof() used to be called first, causing
+      index-sorting to take place, after which the headerUnsort() in
+      headerExport() did the right thing. In the other two cases
+      headerSizeof() was called afterwards, and the headerExport() would
+      be garbage in cases where new data had been just added, such as package
+      installation. With headerExport() eliminating the need to call
+      headerSizeof() all the cases became broken as the header would
+      seem much bigger than it is due to the bad sort order and cause
+      cases like RhBug:953719 where a largish header suddenly appears
+      to be oversized, causing mysterious install failure. Prior to the
+      commit (which in itself IS innocent) the issue would've mainly
+      manifested in cases where the header needs to be rewritten, which
+      only happens when files are replaced and the header is rewritten for that.
+
+diff --git a/lib/header.c b/lib/header.c
+index ceffb32..f78ba78 100644
+--- a/lib/header.c
++++ b/lib/header.c
+@@ -68,8 +68,13 @@ static const int typeSizes[16] =  {
+     0
+ };
+ 
++enum headerSorted_e {
++    HEADERSORT_NONE	= 0,	/* Not sorted */
++    HEADERSORT_OFFSET	= 1,	/* Sorted by offset (on-disk format) */
++    HEADERSORT_INDEX	= 2,	/* Sorted by index  */
++};
++
+ enum headerFlags_e {
+-    HEADERFLAG_SORTED    = (1 << 0), /*!< Are header entries sorted? */
+     HEADERFLAG_ALLOCATED = (1 << 1), /*!< Is 1st header region allocated? */
+     HEADERFLAG_LEGACY    = (1 << 2), /*!< Header came from legacy source? */
+     HEADERFLAG_DEBUG     = (1 << 3), /*!< Debug this header? */
+@@ -87,6 +92,7 @@ struct headerToken_s {
+     int indexAlloced;		/*!< Allocated size of tag array. */
+     unsigned int instance;	/*!< Rpmdb instance (offset) */
+     headerFlags flags;
++    int sorted;			/*!< Current sort method */
+     int nrefs;			/*!< Reference count. */
+ };
+ 
+@@ -169,7 +175,7 @@ static Header headerCreate(void *blob, unsigned int pvlen, int32_t indexLen)
+ 	h->indexUsed = 0;
+     }
+     h->instance = 0;
+-    h->flags |= HEADERFLAG_SORTED;
++    h->sorted = HEADERSORT_NONE;
+ 
+     h->index = (h->indexAlloced
+ 	? xcalloc(h->indexAlloced, sizeof(*h->index))
+@@ -219,9 +225,9 @@ static int indexCmp(const void * avp, const void * bvp)
+ 
+ void headerSort(Header h)
+ {
+-    if (!(h->flags & HEADERFLAG_SORTED)) {
++    if (h->sorted != HEADERSORT_INDEX) {
+ 	qsort(h->index, h->indexUsed, sizeof(*h->index), indexCmp);
+-	h->flags |= HEADERFLAG_SORTED;
++	h->sorted = HEADERSORT_INDEX;
+     }
+ }
+ 
+@@ -242,9 +248,9 @@ static int offsetCmp(const void * avp, const void * bvp)
+ 
+ void headerUnsort(Header h)
+ {
+-    if (h->flags & HEADERFLAG_SORTED) {
++    if (h->sorted != HEADERSORT_OFFSET) {
+ 	qsort(h->index, h->indexUsed, sizeof(*h->index), offsetCmp);
+-	h->flags &= ~HEADERFLAG_SORTED;
++	h->sorted = HEADERSORT_OFFSET;
+     }
+ }
+ 
+@@ -721,7 +727,8 @@ indexEntry findEntry(Header h, rpmTagVal tag, rpm_tagtype_t type)
+     struct indexEntry_s key;
+ 
+     if (h == NULL) return NULL;
+-    if (!(h->flags & HEADERFLAG_SORTED)) headerSort(h);
++    if (h->sorted != HEADERSORT_INDEX)
++	headerSort(h);
+ 
+     key.info.tag = tag;
+ 
+@@ -907,7 +914,8 @@ Header headerImport(void * blob, unsigned int bsize, headerImportFlags flags)
+ 	    goto errxit;
+     }
+ 
+-    h->flags &= ~HEADERFLAG_SORTED;
++    /* Force sorting, dribble lookups can cause early sort on partial header */
++    h->sorted = HEADERSORT_NONE;
+     headerSort(h);
+     h->flags |= HEADERFLAG_ALLOCATED;
+ 
+@@ -1439,7 +1447,7 @@ static int intAddEntry(Header h, rpmtd td)
+     entry->length = length;
+ 
+     if (h->indexUsed > 0 && td->tag < h->index[h->indexUsed-1].info.tag)
+-	h->flags &= ~HEADERFLAG_SORTED;
++	h->sorted = HEADERSORT_NONE;
+     h->indexUsed++;
+ 
+     return 1;
diff --git a/SOURCES/rpm-4.11.x-minidebuginfo-ppc64.patch b/SOURCES/rpm-4.11.x-minidebuginfo-ppc64.patch
new file mode 100644
index 0000000..600d8f8
--- /dev/null
+++ b/SOURCES/rpm-4.11.x-minidebuginfo-ppc64.patch
@@ -0,0 +1,15 @@
+diff -up rpm-4.11.1/scripts/find-debuginfo.sh.minidebug-ppc64 rpm-4.11.1/scripts/find-debuginfo.sh
+--- rpm-4.11.1/scripts/find-debuginfo.sh.minidebug-ppc64	2014-01-16 14:05:17.291955782 +0200
++++ rpm-4.11.1/scripts/find-debuginfo.sh	2014-01-16 14:05:56.437285842 +0200
+@@ -149,7 +149,10 @@ add_minidebug()
+   # in the normal symbol table
+   nm -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms"
+   # Extract all the text (i.e. function) symbols from the debuginfo 
+-  nm "$debuginfo" --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }' | sort > "$funcsyms"
++  # Use format sysv to make sure we can match against the actual ELF FUNC
++  # symbol type. The binutils nm posix format symbol type chars are
++  # ambigous for architectures that might use function descriptors.
++  nm "$debuginfo" --format=sysv --defined-only | awk -F \| '{ if ($4 ~ "FUNC") print $1 }' | sort > "$funcsyms"
+   # Keep all the function symbols not already in the dynamic symbol table
+   comm -13 "$dynsyms" "$funcsyms" > "$keep_symbols"
+   # Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections
diff --git a/SOURCES/rpm-4.11.x-reset-fileactions.patch b/SOURCES/rpm-4.11.x-reset-fileactions.patch
new file mode 100644
index 0000000..cf67f6b
--- /dev/null
+++ b/SOURCES/rpm-4.11.x-reset-fileactions.patch
@@ -0,0 +1,58 @@
+diff --git a/lib/rpmfs.c b/lib/rpmfs.c
+index 764618d..916f6eb 100644
+--- a/lib/rpmfs.c
++++ b/lib/rpmfs.c
+@@ -18,7 +18,7 @@ rpmfs rpmfsNew(rpm_count_t fc, int initState)
+     rpmfs fs = xcalloc(1, sizeof(*fs));
+     fs->fc = fc;
+     fs->actions = xmalloc(fs->fc * sizeof(*fs->actions));
+-    memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions));
++    rpmfsResetActions(fs);
+     if (initState) {
+ 	fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
+ 	memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc);
+@@ -115,3 +115,10 @@ void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action)
+ 	fs->actions[ix] = action;
+     }
+ }
++
++void rpmfsResetActions(rpmfs fs)
++{
++    if (fs && fs->actions) {
++	memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions));
++    }
++}
+diff --git a/lib/rpmfs.h b/lib/rpmfs.h
+index 5f74753..83f99d1 100644
+--- a/lib/rpmfs.h
++++ b/lib/rpmfs.h
+@@ -57,6 +57,9 @@ rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix);
+ RPM_GNUC_INTERNAL
+ void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action);
+ 
++RPM_GNUC_INTERNAL
++void rpmfsResetActions(rpmfs fs);
++
+ #ifdef __cplusplus
+ }
+ #endif
+diff --git a/lib/transaction.c b/lib/transaction.c
+index 02badc6..09c199a 100644
+--- a/lib/transaction.c
++++ b/lib/transaction.c
+@@ -1323,11 +1323,14 @@ static int rpmtsPrepare(rpmts ts)
+ 
+     rpmlog(RPMLOG_DEBUG, "computing %" PRIu64 " file fingerprints\n", fileCount);
+ 
+-    /* Skip netshared paths, not our i18n files, and excluded docs */
++    /* Reset actions, set skip for netshared paths and excluded files */
+     pi = rpmtsiInit(ts);
+     while ((p = rpmtsiNext(pi, 0)) != NULL) {
+ 	if (rpmfiFC(rpmteFI(p)) == 0)
+ 	    continue;
++	/* Ensure clean state, this could get called more than once. */
++	rpmfs fs = rpmteGetFileStates(p);
++	rpmfsResetActions(fs);
+ 	if (rpmteType(p) == TR_ADDED) {
+ 	    skipInstallFiles(ts, p);
+ 	} else {
diff --git a/SPECS/rpm.spec b/SPECS/rpm.spec
index fac3698..51663c8 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}.}9%{?dist}
+Release: %{?snapver:0.%{snapver}.}16%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/rpm-4.11.x/%{name}-%{srcver}.tar.bz2
@@ -48,6 +48,9 @@ Patch100: rpm-4.11.1-instprefix.patch
 Patch101: rpm-4.11.1-reloc-sanity-check.patch
 Patch102: rpm-4.11.1-caps-doublefree.patch
 Patch103: rpm-4.11.1-empty-lua-script.patch
+Patch104: rpm-4.11.1-headersort.patch
+Patch105: rpm-4.11.1-digests-max.patch
+Patch106: rpm-4.11.x-reset-fileactions.patch
 
 # Patches already in upstream but not in 4.11.x branch
 # Filter soname dependencies by name
@@ -67,6 +70,8 @@ Patch305: rpm-4.10.0-dwz-debuginfo.patch
 Patch306: rpm-4.10.0-minidebuginfo.patch
 # Fix CRC32 after dwz (#971119)
 Patch307: rpm-4.11.1-sepdebugcrcfix.patch
+# Fix minidebuginfo on ppc64 (#1052415)
+Patch308: rpm-4.11.x-minidebuginfo-ppc64.patch
 # Temporary Patch to provide support for updates
 Patch400: rpm-4.10.90-rpmlib-filesystem-check.patch
 
@@ -179,6 +184,11 @@ Requires: findutils sed grep gawk diffutils file patch >= 2.5
 Requires: unzip gzip bzip2 cpio xz tar
 Requires: pkgconfig >= 1:0.24
 Requires: /usr/bin/gdb-add-index
+# Technically rpmbuild doesn't require any external configuration, but
+# creating distro-compatible packages does. To make the common case
+# "just work" while allowing for alternatives, depend on a virtual
+# provide, typically coming from redhat-rpm-config.
+Requires: system-rpm-config
 Conflicts: ocaml-runtime < 3.11.1-7
 
 %description build
@@ -235,6 +245,9 @@ packages on a system.
 %patch101 -p1 -b .reloc-sanity-check
 %patch102 -p1 -b .caps-doublefree
 %patch103 -p1 -b .empty-lua-script
+%patch104 -p1 -b .headersort
+%patch105 -p1 -b .digests-max
+%patch106 -p1 -b .reset-fileactions
 
 %patch200 -p1 -b .filter-soname-deps
 %patch201 -p1 -b .dont-filter-ld64
@@ -247,6 +260,7 @@ packages on a system.
 %patch305 -p1 -b .dwz-debuginfo
 %patch306 -p1 -b .minidebuginfo
 %patch307 -p1 -b .sepdebugcrcfix
+%patch308 -p1 -b .minidebuginfo-ppc64
 
 %patch400 -p1 -b .rpmlib-filesystem-check
 
@@ -475,6 +489,27 @@ exit 0
 %doc COPYING doc/librpm/html/*
 
 %changelog
+* Mon Mar 24 2014 Panu Matilainen <pmatilai@redhat.com> - 4.11.1-16
+- Fully reset file actions between rpmtsRun() calls (#1076552)
+
+* Wed Feb 19 2014 Panu Matilainen <pmatilai@redhat.com> - 4.11.1-15
+- Make room for SHA224 in digest bundles (#1066494)
+
+* Tue Feb 18 2014 Panu Matilainen <pmatilai@redhat.com> - 4.11.1-14
+- Fix incorrect header sort state on export bloating headers (#1061730)
+
+* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 4.11.1-13
+- Mass rebuild 2014-01-24
+
+* Thu Jan 16 2014 Panu Matilainen <pmatilai@redhat.com> - 4.11.1-12
+- Make rpm-build depend on virtual system-rpm-config provide (#1048514)
+
+* Thu Jan 16 2014 Panu Matilainen <pmatilai@redhat.com> - 4.11.1-11
+- Fix minidebuginfo generation on ppc64 (#1052415)
+
+* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 4.11.1-10
+- Mass rebuild 2013-12-27
+
 * Mon Sep 30 2013 Florian Festi <ffesti@redhat.com> - 4.11.1-9
  - Fix byteorder for 64 bit tags on big endian machines (#1012946)
  - Better RPMSIGTAG_SIZE vs PMSIGTAG_LONGSIZE detection (#1012595)