Blame SOURCES/0002-github-coreos-rpm-ostree-pr2869.patch

cfef07
From 63275852afc4ab0bd0c45ac80f8f865c222759ac Mon Sep 17 00:00:00 2001
cfef07
From: Luca BRUNO <luca.bruno@coreos.com>
cfef07
Date: Mon, 31 May 2021 10:15:55 +0000
cfef07
Subject: [PATCH 1/6] lib: temporarily fork rpmver logic
cfef07
cfef07
This adds an internal temporary copy of the rpm version comparison
cfef07
logic from librpmio (LGPL).
cfef07
It allows relaxing the minimum library version to >= 4.14.
cfef07
---
cfef07
 Makefile-lib.am             |   1 +
cfef07
 configure.ac                |   6 +
cfef07
 src/lib/rpmostree-package.c |   7 +-
cfef07
 src/lib/rpmver-private.c    | 223 ++++++++++++++++++++++++++++++++++++
cfef07
 src/lib/rpmver-private.h    | 108 +++++++++++++++++
cfef07
 5 files changed, 344 insertions(+), 1 deletion(-)
cfef07
 create mode 100644 src/lib/rpmver-private.c
cfef07
 create mode 100644 src/lib/rpmver-private.h
cfef07
cfef07
diff --git a/Makefile-lib.am b/Makefile-lib.am
cfef07
index bef049e1e7..f9d67f5c57 100644
cfef07
--- a/Makefile-lib.am
cfef07
+++ b/Makefile-lib.am
cfef07
@@ -28,6 +28,7 @@ librpmostree_1_la_SOURCES = \
cfef07
 	src/lib/rpmostree.c \
cfef07
 	src/lib/rpmostree-db.c \
cfef07
 	src/lib/rpmostree-package.c \
cfef07
+	src/lib/rpmver-private.c \
cfef07
 	$(NULL)
cfef07
 
cfef07
 librpmostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/libglnx -I$(srcdir)/src/libpriv -I$(srcdir)/src/lib \
cfef07
diff --git a/configure.ac b/configure.ac
cfef07
index e763781566..ef5551657f 100644
cfef07
--- a/configure.ac
cfef07
+++ b/configure.ac
cfef07
@@ -53,6 +53,12 @@ dnl RHEL8.1 has old libarchive
cfef07
 AS_IF([pkg-config --atleast-version=3.3.3 libarchive],
cfef07
   [AC_DEFINE([HAVE_LIBARCHIVE_ZSTD], 1, [Define if we have libarchive with zstd])])
cfef07
 
cfef07
+# rpmver is available in rpm >= 4.16, el8 is still on 4.14
cfef07
+AC_SEARCH_LIBS([rpmverCmp], [rpm],
cfef07
+  AC_DEFINE([BUILDOPT_HAVE_RPMVER], 1, [Whether rpmver API is available in librpmio]),
cfef07
+  AC_DEFINE([BUILDOPT_HAVE_RPMVER], 0, [Whether rpmver API is available in librpmio])
cfef07
+)
cfef07
+
cfef07
 dnl We don't *actually* use this ourself, but librepo does, and libdnf gets confused
cfef07
 dnl if librepo doesn't support it.
cfef07
 have_zchunk=no
cfef07
diff --git a/src/lib/rpmostree-package.c b/src/lib/rpmostree-package.c
cfef07
index 8575c4a5ed..3bb03bfef0 100644
cfef07
--- a/src/lib/rpmostree-package.c
cfef07
+++ b/src/lib/rpmostree-package.c
cfef07
@@ -32,12 +32,17 @@
cfef07
 
cfef07
 #include <string.h>
cfef07
 #include <stdlib.h>
cfef07
-#include <rpm/rpmver.h>
cfef07
 #include "libglnx.h"
cfef07
 
cfef07
 #include "rpmostree-shlib-ipc-private.h"
cfef07
 #include "rpmostree-package-priv.h"
cfef07
 
cfef07
+#if BUILDOPT_HAVE_RPMVER
cfef07
+#include <rpm/rpmver.h>
cfef07
+#else
cfef07
+#include "rpmver-private.h"
cfef07
+#endif
cfef07
+
cfef07
 typedef GObjectClass RpmOstreePackageClass;
cfef07
 
cfef07
 /* Since the class is small, we perform a poor man's polymorphism; RpmOstreePackage objects
cfef07
diff --git a/src/lib/rpmver-private.c b/src/lib/rpmver-private.c
cfef07
new file mode 100644
cfef07
index 0000000000..117df79206
cfef07
--- /dev/null
cfef07
+++ b/src/lib/rpmver-private.c
cfef07
@@ -0,0 +1,223 @@
cfef07
+// Temporary forked internal copy of:
cfef07
+// https://github.com/rpm-software-management/rpm/blob/rpm-4.16.1.3/rpmio/rpmver.c
cfef07
+// SPDX-License-Identifier: LGPL-2.1-or-later
cfef07
+
cfef07
+/* NOTE(lucab): compatibility changes to avoid touching the source.
cfef07
+ *  The *malloc functions have different behaviors when size=0, but this is not
cfef07
+ *  a concern here because all calls in this file have strictly-positive size.
cfef07
+ */
cfef07
+#include "config.h"
cfef07
+#if !BUILDOPT_HAVE_RPMVER
cfef07
+#include <glib.h>
cfef07
+#define xmalloc(_size) g_malloc((_size))
cfef07
+#define free(_mem) g_free((_mem))
cfef07
+#include "rpmver-private.h"
cfef07
+
cfef07
+#include <rpm/rpmstring.h>
cfef07
+#include <stdlib.h>
cfef07
+
cfef07
+struct rpmver_s {
cfef07
+    const char *e;
cfef07
+    const char *v;
cfef07
+    const char *r;
cfef07
+    char arena[];
cfef07
+};
cfef07
+
cfef07
+/**
cfef07
+ * Split EVR into epoch, version, and release components.
cfef07
+ * @param evr		[epoch:]version[-release] string
cfef07
+ * @retval *ep		pointer to epoch
cfef07
+ * @retval *vp		pointer to version
cfef07
+ * @retval *rp		pointer to release
cfef07
+ */
cfef07
+static
cfef07
+void parseEVR(char * evr,
cfef07
+		const char ** ep,
cfef07
+		const char ** vp,
cfef07
+		const char ** rp)
cfef07
+{
cfef07
+    const char *epoch;
cfef07
+    const char *version;		/* assume only version is present */
cfef07
+    const char *release;
cfef07
+    char *s, *se;
cfef07
+
cfef07
+    s = evr;
cfef07
+    while (*s && risdigit(*s)) s++;	/* s points to epoch terminator */
cfef07
+    se = strrchr(s, '-');		/* se points to version terminator */
cfef07
+
cfef07
+    if (*s == ':') {
cfef07
+	epoch = evr;
cfef07
+	*s++ = '\0';
cfef07
+	version = s;
cfef07
+	if (*epoch == '\0') epoch = "0";
cfef07
+    } else {
cfef07
+	epoch = NULL;	/* XXX disable epoch compare if missing */
cfef07
+	version = evr;
cfef07
+    }
cfef07
+    if (se) {
cfef07
+	*se++ = '\0';
cfef07
+	release = se;
cfef07
+    } else {
cfef07
+	release = NULL;
cfef07
+    }
cfef07
+
cfef07
+    if (ep) *ep = epoch;
cfef07
+    if (vp) *vp = version;
cfef07
+    if (rp) *rp = release;
cfef07
+}
cfef07
+
cfef07
+int rpmverOverlap(rpmver v1, rpmsenseFlags f1, rpmver v2, rpmsenseFlags f2)
cfef07
+{
cfef07
+    int sense = 0;
cfef07
+    int result = 0;
cfef07
+
cfef07
+    /* Compare {A,B} [epoch:]version[-release] */
cfef07
+    if (v1->e && *v1->e && v2->e && *v2->e)
cfef07
+	sense = rpmvercmp(v1->e, v2->e);
cfef07
+    else if (v1->e && *v1->e && atol(v1->e) > 0) {
cfef07
+	sense = 1;
cfef07
+    } else if (v2->e && *v2->e && atol(v2->e) > 0)
cfef07
+	sense = -1;
cfef07
+
cfef07
+    if (sense == 0) {
cfef07
+	sense = rpmvercmp(v1->v, v2->v);
cfef07
+	if (sense == 0) {
cfef07
+	    if (v1->r && *v1->r && v2->r && *v2->r) {
cfef07
+		sense = rpmvercmp(v1->r, v2->r);
cfef07
+	    } else {
cfef07
+		/* always matches if the side with no release has SENSE_EQUAL */
cfef07
+		if ((v1->r && *v1->r && (f2 & RPMSENSE_EQUAL)) ||
cfef07
+		    (v2->r && *v2->r && (f1 & RPMSENSE_EQUAL))) {
cfef07
+		    result = 1;
cfef07
+		    goto exit;
cfef07
+		}
cfef07
+	    }
cfef07
+	}
cfef07
+    }
cfef07
+
cfef07
+    /* Detect overlap of {A,B} range. */
cfef07
+    if (sense < 0 && ((f1 & RPMSENSE_GREATER) || (f2 & RPMSENSE_LESS))) {
cfef07
+	result = 1;
cfef07
+    } else if (sense > 0 && ((f1 & RPMSENSE_LESS) || (f2 & RPMSENSE_GREATER))) {
cfef07
+	result = 1;
cfef07
+    } else if (sense == 0 &&
cfef07
+	(((f1 & RPMSENSE_EQUAL) && (f2 & RPMSENSE_EQUAL)) ||
cfef07
+	 ((f1 & RPMSENSE_LESS) && (f2 & RPMSENSE_LESS)) ||
cfef07
+	 ((f1 & RPMSENSE_GREATER) && (f2 & RPMSENSE_GREATER)))) {
cfef07
+	result = 1;
cfef07
+    }
cfef07
+
cfef07
+exit:
cfef07
+    return result;
cfef07
+}
cfef07
+
cfef07
+static int compare_values(const char *str1, const char *str2)
cfef07
+{
cfef07
+    if (!str1 && !str2)
cfef07
+	return 0;
cfef07
+    else if (str1 && !str2)
cfef07
+	return 1;
cfef07
+    else if (!str1 && str2)
cfef07
+	return -1;
cfef07
+    return rpmvercmp(str1, str2);
cfef07
+}
cfef07
+
cfef07
+int rpmverCmp(rpmver v1, rpmver v2)
cfef07
+{
cfef07
+    const char *e1 = (v1->e != NULL) ? v1->e : "0";
cfef07
+    const char *e2 = (v2->e != NULL) ? v2->e : "0";
cfef07
+
cfef07
+    int rc = compare_values(e1, e2);
cfef07
+    if (!rc) {
cfef07
+	rc = compare_values(v1->v, v2->v);
cfef07
+	if (!rc)
cfef07
+	    rc = compare_values(v1->r, v2->r);
cfef07
+    }
cfef07
+    return rc;
cfef07
+}
cfef07
+
cfef07
+uint32_t rpmverEVal(rpmver rv)
cfef07
+{
cfef07
+    return (rv != NULL && rv->e != NULL) ? atol(rv->e) : 0;
cfef07
+}
cfef07
+
cfef07
+const char *rpmverE(rpmver rv)
cfef07
+{
cfef07
+    return (rv != NULL) ? rv->e : NULL;
cfef07
+}
cfef07
+
cfef07
+const char *rpmverV(rpmver rv)
cfef07
+{
cfef07
+    return (rv != NULL) ? rv->v : NULL;
cfef07
+}
cfef07
+
cfef07
+const char *rpmverR(rpmver rv)
cfef07
+{
cfef07
+    return (rv != NULL) ? rv->r : NULL;
cfef07
+}
cfef07
+
cfef07
+char *rpmverEVR(rpmver rv)
cfef07
+{
cfef07
+    char *EVR = NULL;
cfef07
+    if (rv) {
cfef07
+	rstrscat(&EVR, rv->e ? rv-> e : "", rv->e ? ":" : "",
cfef07
+		       rv->v,
cfef07
+		       rv->r ? "-" : "", rv->r ? rv->r : "", NULL);
cfef07
+    }
cfef07
+    return EVR;
cfef07
+}
cfef07
+
cfef07
+rpmver rpmverParse(const char *evr)
cfef07
+{
cfef07
+    rpmver rv = NULL;
cfef07
+    if (evr && *evr) {
cfef07
+	size_t evrlen = strlen(evr) + 1;
cfef07
+	rv = xmalloc(sizeof(*rv) + evrlen);
cfef07
+	memcpy(rv->arena, evr, evrlen);
cfef07
+	parseEVR(rv->arena, &rv->e, &rv->v, &rv->r);
cfef07
+    }
cfef07
+    return rv;
cfef07
+}
cfef07
+
cfef07
+rpmver rpmverNew(const char *e, const char *v, const char *r)
cfef07
+{
cfef07
+    rpmver rv = NULL;
cfef07
+
cfef07
+    if (v && *v) {
cfef07
+	size_t nb = strlen(v) + 1;
cfef07
+	nb += (e != NULL) ? strlen(e) + 1 : 0;
cfef07
+	nb += (r != NULL) ? strlen(r) + 1 : 0;
cfef07
+	rv = xmalloc(sizeof(*rv) + nb);
cfef07
+
cfef07
+	rv->e = NULL;
cfef07
+	rv->v = NULL;
cfef07
+	rv->r = NULL;
cfef07
+
cfef07
+	char *p = rv->arena;
cfef07
+	if (e) {
cfef07
+	    rv->e = p;
cfef07
+	    p = stpcpy(p, e);
cfef07
+	    p++;
cfef07
+	}
cfef07
+
cfef07
+	rv->v = p;
cfef07
+	p = stpcpy(p, v);
cfef07
+	p++;
cfef07
+
cfef07
+	if (r) {
cfef07
+	    rv->r = p;
cfef07
+	    p = stpcpy(p, r);
cfef07
+	    p++;
cfef07
+	}
cfef07
+    }
cfef07
+    return rv;
cfef07
+}
cfef07
+
cfef07
+rpmver rpmverFree(rpmver rv)
cfef07
+{
cfef07
+    if (rv) {
cfef07
+	free(rv);
cfef07
+    }
cfef07
+    return NULL;
cfef07
+}
cfef07
+#endif
cfef07
diff --git a/src/lib/rpmver-private.h b/src/lib/rpmver-private.h
cfef07
new file mode 100644
cfef07
index 0000000000..f875c2f9d3
cfef07
--- /dev/null
cfef07
+++ b/src/lib/rpmver-private.h
cfef07
@@ -0,0 +1,108 @@
cfef07
+// Temporary forked internal copy of
cfef07
+// https://github.com/rpm-software-management/rpm/blob/rpm-4.16.1.3/rpmio/rpmver.h
cfef07
+// SPDX-License-Identifier: LGPL-2.1-or-later
cfef07
+
cfef07
+#ifndef _RPMVER_H
cfef07
+#define _RPMVER_H
cfef07
+
cfef07
+#include <rpm/rpmtypes.h>
cfef07
+#include <rpm/rpmds.h>		/* sense flags */
cfef07
+
cfef07
+#ifdef __cplusplus
cfef07
+extern "C" {
cfef07
+#endif
cfef07
+
cfef07
+// NOTE(lucab): Backported from <rpm/rpmtypes.h>.
cfef07
+#ifndef rpmver
cfef07
+typedef struct rpmver_s * rpmver;
cfef07
+#endif
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * Segmented string compare for version or release strings.
cfef07
+ *
cfef07
+ * @param a		1st string
cfef07
+ * @param b		2nd string
cfef07
+ * @return		+1 if a is "newer", 0 if equal, -1 if b is "newer"
cfef07
+ */
cfef07
+int rpmvercmp(const char * a, const char * b);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * Parse rpm version handle from evr string
cfef07
+ *
cfef07
+ * @param evr		[epoch:]version[-release] string
cfef07
+ * @return		rpm version, NULL on invalid evr
cfef07
+ */
cfef07
+rpmver rpmverParse(const char *evr);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * Create new rpm version handle from e, v, r components
cfef07
+ *
cfef07
+ * @param e		epoch (or NULL)
cfef07
+ * @param v		version
cfef07
+ * @param r		release (or NULL)
cfef07
+ * @return		rpm version, NULL on invalid
cfef07
+ */
cfef07
+rpmver rpmverNew(const char *e, const char *v, const char *r);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * Free rpm version handle
cfef07
+ *
cfef07
+ * @param rv		rpm version handle
cfef07
+ * @return		NULL always
cfef07
+ */
cfef07
+rpmver rpmverFree(rpmver rv);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * @param rv		rpm version handle
cfef07
+ * @return		numerical value of epoch
cfef07
+ */
cfef07
+uint32_t rpmverEVal(rpmver rv);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * @param rv		rpm version handle
cfef07
+ * @return		epoch portion
cfef07
+ */
cfef07
+const char *rpmverE(rpmver rv);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * @param rv		rpm version handle
cfef07
+ * @return		version portion
cfef07
+ */
cfef07
+const char *rpmverV(rpmver rv);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * @param rv		rpm version handle
cfef07
+ * @return		release portion
cfef07
+ */
cfef07
+const char *rpmverR(rpmver rv);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * @param rv		rpm version handle
cfef07
+ * @return		formatted [E:]V[-R] string (malloced)
cfef07
+ */
cfef07
+char *rpmverEVR(rpmver rv);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * Compare two rpm version handles
cfef07
+ *
cfef07
+ * @param v1		1st version handle
cfef07
+ * @param v2		2nd version handle
cfef07
+ * @return		0 if equal, -1 if v1 smaller, 1 if greater, than v2
cfef07
+ */
cfef07
+int rpmverCmp(rpmver v1, rpmver v2);
cfef07
+
cfef07
+/** \ingroup rpmver
cfef07
+ * Determine whether two versioned ranges overlap.
cfef07
+ * @param v1		1st version
cfef07
+ * @param f1		1st sense flags
cfef07
+ * @param v2		2nd version
cfef07
+ * @param f2		2nd sense flags
cfef07
+ * @return		1 if ranges overlap, 0 otherwise
cfef07
+ */
cfef07
+int rpmverOverlap(rpmver v1, rpmsenseFlags f1, rpmver v2, rpmsenseFlags f2);
cfef07
+
cfef07
+#ifdef __cplusplus
cfef07
+}
cfef07
+#endif
cfef07
+
cfef07
+#endif /* _RPMVER_H */
cfef07
cfef07
From a74a3163b2ae315b5f95d9d7642e868794c47628 Mon Sep 17 00:00:00 2001
cfef07
From: Luca BRUNO <luca.bruno@coreos.com>
cfef07
Date: Mon, 31 May 2021 11:00:10 +0000
cfef07
Subject: [PATCH 2/6] lib/rpmver: replace tabs with spaces
cfef07
cfef07
---
cfef07
 src/lib/rpmver-private.c | 160 +++++++++++++++++++--------------------
cfef07
 src/lib/rpmver-private.h |  60 +++++++--------
cfef07
 2 files changed, 110 insertions(+), 110 deletions(-)
cfef07
cfef07
diff --git a/src/lib/rpmver-private.c b/src/lib/rpmver-private.c
cfef07
index 117df79206..6882be0d1e 100644
cfef07
--- a/src/lib/rpmver-private.c
cfef07
+++ b/src/lib/rpmver-private.c
cfef07
@@ -25,40 +25,40 @@ struct rpmver_s {
cfef07
 
cfef07
 /**
cfef07
  * Split EVR into epoch, version, and release components.
cfef07
- * @param evr		[epoch:]version[-release] string
cfef07
- * @retval *ep		pointer to epoch
cfef07
- * @retval *vp		pointer to version
cfef07
- * @retval *rp		pointer to release
cfef07
+ * @param evr                [epoch:]version[-release] string
cfef07
+ * @retval *ep                pointer to epoch
cfef07
+ * @retval *vp                pointer to version
cfef07
+ * @retval *rp                pointer to release
cfef07
  */
cfef07
 static
cfef07
 void parseEVR(char * evr,
cfef07
-		const char ** ep,
cfef07
-		const char ** vp,
cfef07
-		const char ** rp)
cfef07
+                const char ** ep,
cfef07
+                const char ** vp,
cfef07
+                const char ** rp)
cfef07
 {
cfef07
     const char *epoch;
cfef07
-    const char *version;		/* assume only version is present */
cfef07
+    const char *version;                /* assume only version is present */
cfef07
     const char *release;
cfef07
     char *s, *se;
cfef07
 
cfef07
     s = evr;
cfef07
-    while (*s && risdigit(*s)) s++;	/* s points to epoch terminator */
cfef07
-    se = strrchr(s, '-');		/* se points to version terminator */
cfef07
+    while (*s && risdigit(*s)) s++;        /* s points to epoch terminator */
cfef07
+    se = strrchr(s, '-');                /* se points to version terminator */
cfef07
 
cfef07
     if (*s == ':') {
cfef07
-	epoch = evr;
cfef07
-	*s++ = '\0';
cfef07
-	version = s;
cfef07
-	if (*epoch == '\0') epoch = "0";
cfef07
+        epoch = evr;
cfef07
+        *s++ = '\0';
cfef07
+        version = s;
cfef07
+        if (*epoch == '\0') epoch = "0";
cfef07
     } else {
cfef07
-	epoch = NULL;	/* XXX disable epoch compare if missing */
cfef07
-	version = evr;
cfef07
+        epoch = NULL;        /* XXX disable epoch compare if missing */
cfef07
+        version = evr;
cfef07
     }
cfef07
     if (se) {
cfef07
-	*se++ = '\0';
cfef07
-	release = se;
cfef07
+        *se++ = '\0';
cfef07
+        release = se;
cfef07
     } else {
cfef07
-	release = NULL;
cfef07
+        release = NULL;
cfef07
     }
cfef07
 
cfef07
     if (ep) *ep = epoch;
cfef07
@@ -73,38 +73,38 @@ int rpmverOverlap(rpmver v1, rpmsenseFlags f1, rpmver v2, rpmsenseFlags f2)
cfef07
 
cfef07
     /* Compare {A,B} [epoch:]version[-release] */
cfef07
     if (v1->e && *v1->e && v2->e && *v2->e)
cfef07
-	sense = rpmvercmp(v1->e, v2->e);
cfef07
+        sense = rpmvercmp(v1->e, v2->e);
cfef07
     else if (v1->e && *v1->e && atol(v1->e) > 0) {
cfef07
-	sense = 1;
cfef07
+        sense = 1;
cfef07
     } else if (v2->e && *v2->e && atol(v2->e) > 0)
cfef07
-	sense = -1;
cfef07
+        sense = -1;
cfef07
 
cfef07
     if (sense == 0) {
cfef07
-	sense = rpmvercmp(v1->v, v2->v);
cfef07
-	if (sense == 0) {
cfef07
-	    if (v1->r && *v1->r && v2->r && *v2->r) {
cfef07
-		sense = rpmvercmp(v1->r, v2->r);
cfef07
-	    } else {
cfef07
-		/* always matches if the side with no release has SENSE_EQUAL */
cfef07
-		if ((v1->r && *v1->r && (f2 & RPMSENSE_EQUAL)) ||
cfef07
-		    (v2->r && *v2->r && (f1 & RPMSENSE_EQUAL))) {
cfef07
-		    result = 1;
cfef07
-		    goto exit;
cfef07
-		}
cfef07
-	    }
cfef07
-	}
cfef07
+        sense = rpmvercmp(v1->v, v2->v);
cfef07
+        if (sense == 0) {
cfef07
+            if (v1->r && *v1->r && v2->r && *v2->r) {
cfef07
+                sense = rpmvercmp(v1->r, v2->r);
cfef07
+            } else {
cfef07
+                /* always matches if the side with no release has SENSE_EQUAL */
cfef07
+                if ((v1->r && *v1->r && (f2 & RPMSENSE_EQUAL)) ||
cfef07
+                    (v2->r && *v2->r && (f1 & RPMSENSE_EQUAL))) {
cfef07
+                    result = 1;
cfef07
+                    goto exit;
cfef07
+                }
cfef07
+            }
cfef07
+        }
cfef07
     }
cfef07
 
cfef07
     /* Detect overlap of {A,B} range. */
cfef07
     if (sense < 0 && ((f1 & RPMSENSE_GREATER) || (f2 & RPMSENSE_LESS))) {
cfef07
-	result = 1;
cfef07
+        result = 1;
cfef07
     } else if (sense > 0 && ((f1 & RPMSENSE_LESS) || (f2 & RPMSENSE_GREATER))) {
cfef07
-	result = 1;
cfef07
+        result = 1;
cfef07
     } else if (sense == 0 &&
cfef07
-	(((f1 & RPMSENSE_EQUAL) && (f2 & RPMSENSE_EQUAL)) ||
cfef07
-	 ((f1 & RPMSENSE_LESS) && (f2 & RPMSENSE_LESS)) ||
cfef07
-	 ((f1 & RPMSENSE_GREATER) && (f2 & RPMSENSE_GREATER)))) {
cfef07
-	result = 1;
cfef07
+        (((f1 & RPMSENSE_EQUAL) && (f2 & RPMSENSE_EQUAL)) ||
cfef07
+         ((f1 & RPMSENSE_LESS) && (f2 & RPMSENSE_LESS)) ||
cfef07
+         ((f1 & RPMSENSE_GREATER) && (f2 & RPMSENSE_GREATER)))) {
cfef07
+        result = 1;
cfef07
     }
cfef07
 
cfef07
 exit:
cfef07
@@ -114,11 +114,11 @@ int rpmverOverlap(rpmver v1, rpmsenseFlags f1, rpmver v2, rpmsenseFlags f2)
cfef07
 static int compare_values(const char *str1, const char *str2)
cfef07
 {
cfef07
     if (!str1 && !str2)
cfef07
-	return 0;
cfef07
+        return 0;
cfef07
     else if (str1 && !str2)
cfef07
-	return 1;
cfef07
+        return 1;
cfef07
     else if (!str1 && str2)
cfef07
-	return -1;
cfef07
+        return -1;
cfef07
     return rpmvercmp(str1, str2);
cfef07
 }
cfef07
 
cfef07
@@ -129,9 +129,9 @@ int rpmverCmp(rpmver v1, rpmver v2)
cfef07
 
cfef07
     int rc = compare_values(e1, e2);
cfef07
     if (!rc) {
cfef07
-	rc = compare_values(v1->v, v2->v);
cfef07
-	if (!rc)
cfef07
-	    rc = compare_values(v1->r, v2->r);
cfef07
+        rc = compare_values(v1->v, v2->v);
cfef07
+        if (!rc)
cfef07
+            rc = compare_values(v1->r, v2->r);
cfef07
     }
cfef07
     return rc;
cfef07
 }
cfef07
@@ -160,9 +160,9 @@ char *rpmverEVR(rpmver rv)
cfef07
 {
cfef07
     char *EVR = NULL;
cfef07
     if (rv) {
cfef07
-	rstrscat(&EVR, rv->e ? rv-> e : "", rv->e ? ":" : "",
cfef07
-		       rv->v,
cfef07
-		       rv->r ? "-" : "", rv->r ? rv->r : "", NULL);
cfef07
+        rstrscat(&EVR, rv->e ? rv-> e : "", rv->e ? ":" : "",
cfef07
+                       rv->v,
cfef07
+                       rv->r ? "-" : "", rv->r ? rv->r : "", NULL);
cfef07
     }
cfef07
     return EVR;
cfef07
 }
cfef07
@@ -171,10 +171,10 @@ rpmver rpmverParse(const char *evr)
cfef07
 {
cfef07
     rpmver rv = NULL;
cfef07
     if (evr && *evr) {
cfef07
-	size_t evrlen = strlen(evr) + 1;
cfef07
-	rv = xmalloc(sizeof(*rv) + evrlen);
cfef07
-	memcpy(rv->arena, evr, evrlen);
cfef07
-	parseEVR(rv->arena, &rv->e, &rv->v, &rv->r);
cfef07
+        size_t evrlen = strlen(evr) + 1;
cfef07
+        rv = xmalloc(sizeof(*rv) + evrlen);
cfef07
+        memcpy(rv->arena, evr, evrlen);
cfef07
+        parseEVR(rv->arena, &rv->e, &rv->v, &rv->r);
cfef07
     }
cfef07
     return rv;
cfef07
 }
cfef07
@@ -184,31 +184,31 @@ rpmver rpmverNew(const char *e, const char *v, const char *r)
cfef07
     rpmver rv = NULL;
cfef07
 
cfef07
     if (v && *v) {
cfef07
-	size_t nb = strlen(v) + 1;
cfef07
-	nb += (e != NULL) ? strlen(e) + 1 : 0;
cfef07
-	nb += (r != NULL) ? strlen(r) + 1 : 0;
cfef07
-	rv = xmalloc(sizeof(*rv) + nb);
cfef07
-
cfef07
-	rv->e = NULL;
cfef07
-	rv->v = NULL;
cfef07
-	rv->r = NULL;
cfef07
-
cfef07
-	char *p = rv->arena;
cfef07
-	if (e) {
cfef07
-	    rv->e = p;
cfef07
-	    p = stpcpy(p, e);
cfef07
-	    p++;
cfef07
-	}
cfef07
-
cfef07
-	rv->v = p;
cfef07
-	p = stpcpy(p, v);
cfef07
-	p++;
cfef07
-
cfef07
-	if (r) {
cfef07
-	    rv->r = p;
cfef07
-	    p = stpcpy(p, r);
cfef07
-	    p++;
cfef07
-	}
cfef07
+        size_t nb = strlen(v) + 1;
cfef07
+        nb += (e != NULL) ? strlen(e) + 1 : 0;
cfef07
+        nb += (r != NULL) ? strlen(r) + 1 : 0;
cfef07
+        rv = xmalloc(sizeof(*rv) + nb);
cfef07
+
cfef07
+        rv->e = NULL;
cfef07
+        rv->v = NULL;
cfef07
+        rv->r = NULL;
cfef07
+
cfef07
+        char *p = rv->arena;
cfef07
+        if (e) {
cfef07
+            rv->e = p;
cfef07
+            p = stpcpy(p, e);
cfef07
+            p++;
cfef07
+        }
cfef07
+
cfef07
+        rv->v = p;
cfef07
+        p = stpcpy(p, v);
cfef07
+        p++;
cfef07
+
cfef07
+        if (r) {
cfef07
+            rv->r = p;
cfef07
+            p = stpcpy(p, r);
cfef07
+            p++;
cfef07
+        }
cfef07
     }
cfef07
     return rv;
cfef07
 }
cfef07
@@ -216,7 +216,7 @@ rpmver rpmverNew(const char *e, const char *v, const char *r)
cfef07
 rpmver rpmverFree(rpmver rv)
cfef07
 {
cfef07
     if (rv) {
cfef07
-	free(rv);
cfef07
+        free(rv);
cfef07
     }
cfef07
     return NULL;
cfef07
 }
cfef07
diff --git a/src/lib/rpmver-private.h b/src/lib/rpmver-private.h
cfef07
index f875c2f9d3..458279e202 100644
cfef07
--- a/src/lib/rpmver-private.h
cfef07
+++ b/src/lib/rpmver-private.h
cfef07
@@ -6,7 +6,7 @@
cfef07
 #define _RPMVER_H
cfef07
 
cfef07
 #include <rpm/rpmtypes.h>
cfef07
-#include <rpm/rpmds.h>		/* sense flags */
cfef07
+#include <rpm/rpmds.h>                /* sense flags */
cfef07
 
cfef07
 #ifdef __cplusplus
cfef07
 extern "C" {
cfef07
@@ -20,84 +20,84 @@ typedef struct rpmver_s * rpmver;
cfef07
 /** \ingroup rpmver
cfef07
  * Segmented string compare for version or release strings.
cfef07
  *
cfef07
- * @param a		1st string
cfef07
- * @param b		2nd string
cfef07
- * @return		+1 if a is "newer", 0 if equal, -1 if b is "newer"
cfef07
+ * @param a                1st string
cfef07
+ * @param b                2nd string
cfef07
+ * @return                +1 if a is "newer", 0 if equal, -1 if b is "newer"
cfef07
  */
cfef07
 int rpmvercmp(const char * a, const char * b);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
  * Parse rpm version handle from evr string
cfef07
  *
cfef07
- * @param evr		[epoch:]version[-release] string
cfef07
- * @return		rpm version, NULL on invalid evr
cfef07
+ * @param evr                [epoch:]version[-release] string
cfef07
+ * @return                rpm version, NULL on invalid evr
cfef07
  */
cfef07
 rpmver rpmverParse(const char *evr);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
  * Create new rpm version handle from e, v, r components
cfef07
  *
cfef07
- * @param e		epoch (or NULL)
cfef07
- * @param v		version
cfef07
- * @param r		release (or NULL)
cfef07
- * @return		rpm version, NULL on invalid
cfef07
+ * @param e                epoch (or NULL)
cfef07
+ * @param v                version
cfef07
+ * @param r                release (or NULL)
cfef07
+ * @return                rpm version, NULL on invalid
cfef07
  */
cfef07
 rpmver rpmverNew(const char *e, const char *v, const char *r);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
  * Free rpm version handle
cfef07
  *
cfef07
- * @param rv		rpm version handle
cfef07
- * @return		NULL always
cfef07
+ * @param rv                rpm version handle
cfef07
+ * @return                NULL always
cfef07
  */
cfef07
 rpmver rpmverFree(rpmver rv);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
- * @param rv		rpm version handle
cfef07
- * @return		numerical value of epoch
cfef07
+ * @param rv                rpm version handle
cfef07
+ * @return                numerical value of epoch
cfef07
  */
cfef07
 uint32_t rpmverEVal(rpmver rv);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
- * @param rv		rpm version handle
cfef07
- * @return		epoch portion
cfef07
+ * @param rv                rpm version handle
cfef07
+ * @return                epoch portion
cfef07
  */
cfef07
 const char *rpmverE(rpmver rv);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
- * @param rv		rpm version handle
cfef07
- * @return		version portion
cfef07
+ * @param rv                rpm version handle
cfef07
+ * @return                version portion
cfef07
  */
cfef07
 const char *rpmverV(rpmver rv);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
- * @param rv		rpm version handle
cfef07
- * @return		release portion
cfef07
+ * @param rv                rpm version handle
cfef07
+ * @return                release portion
cfef07
  */
cfef07
 const char *rpmverR(rpmver rv);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
- * @param rv		rpm version handle
cfef07
- * @return		formatted [E:]V[-R] string (malloced)
cfef07
+ * @param rv                rpm version handle
cfef07
+ * @return                formatted [E:]V[-R] string (malloced)
cfef07
  */
cfef07
 char *rpmverEVR(rpmver rv);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
  * Compare two rpm version handles
cfef07
  *
cfef07
- * @param v1		1st version handle
cfef07
- * @param v2		2nd version handle
cfef07
- * @return		0 if equal, -1 if v1 smaller, 1 if greater, than v2
cfef07
+ * @param v1                1st version handle
cfef07
+ * @param v2                2nd version handle
cfef07
+ * @return                0 if equal, -1 if v1 smaller, 1 if greater, than v2
cfef07
  */
cfef07
 int rpmverCmp(rpmver v1, rpmver v2);
cfef07
 
cfef07
 /** \ingroup rpmver
cfef07
  * Determine whether two versioned ranges overlap.
cfef07
- * @param v1		1st version
cfef07
- * @param f1		1st sense flags
cfef07
- * @param v2		2nd version
cfef07
- * @param f2		2nd sense flags
cfef07
- * @return		1 if ranges overlap, 0 otherwise
cfef07
+ * @param v1                1st version
cfef07
+ * @param f1                1st sense flags
cfef07
+ * @param v2                2nd version
cfef07
+ * @param f2                2nd sense flags
cfef07
+ * @return                1 if ranges overlap, 0 otherwise
cfef07
  */
cfef07
 int rpmverOverlap(rpmver v1, rpmsenseFlags f1, rpmver v2, rpmsenseFlags f2);
cfef07