[packages/poldek/rpm5] - merged upstream

baggins baggins at pld-linux.org
Thu Sep 13 18:43:43 CEST 2012


commit b3b4fdfb095ae1ffb04a179db776f6427642a201
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Thu Sep 13 18:43:33 2012 +0200

    - merged upstream

 poldek-rpm54.patch | 1153 ----------------------------------------------------
 1 file changed, 1153 deletions(-)
---
diff --git a/poldek-rpm54.patch b/poldek-rpm54.patch
deleted file mode 100644
index ef20130..0000000
--- a/poldek-rpm54.patch
+++ /dev/null
@@ -1,1153 +0,0 @@
-From 8cf145343137ceee3a4355ab02e2160481efb5c1 Mon Sep 17 00:00:00 2001
-From: Marcin Banasiak <marcin.banasiak at gmail.com>
-Date: Wed, 29 Aug 2012 20:52:58 +0200
-Subject: [PATCH 1/5] Drop support for ancient rpm versions
-
----
- configure.ac           |   8 ++-
- pm/rpm/pm_rpm.h        |   4 ++
- pm/rpm/rpm.c           |   5 +-
- pm/rpm/rpmdb_depdirs.c |   3 -
- pm/rpm/rpmdb_it.c      | 164 ++++++++-----------------------------------------
- pm/rpm/signature4.c    |  72 ----------------------
- 6 files changed, 36 insertions(+), 220 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 64eac04..5f14b64 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -79,6 +79,7 @@ if test -n "$GCC"; then
-   )
- fi
- 
-+PKG_PROG_PKG_CONFIG()
- 
- PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check=yes, have_check=no)
-  
-@@ -196,7 +197,12 @@ AC_CHECK_HEADERS([sys/filio.h])
- 
- dnl RH rpm needs this
- CPPFLAGS="-I/usr/include/rpm $CPPFLAGS"
--AC_CHECK_HEADER([rpm/rpmlib.h],,AC_MSG_ERROR(["missing required rpmlib.h"]))
-+AC_CHECK_HEADER([rpm/rpmdb.h],,AC_MSG_ERROR(["missing required rpmlib.h"]))
-+
-+AC_CHECK_TYPE([rpmmi],
-+	      [AC_DEFINE([HAVE_RPMMI], 1, [rpm with database iterator])],
-+	      [],
-+	      [[#include <rpm/rpmtypes.h>]])
- 
- AC_MSG_CHECKING([for rpm 4.x])
- #RPMDBI_PACKAGES
-diff --git a/pm/rpm/pm_rpm.h b/pm/rpm/pm_rpm.h
-index a34dd60..8c6a179 100644
---- a/pm/rpm/pm_rpm.h
-+++ b/pm/rpm/pm_rpm.h
-@@ -22,6 +22,10 @@
- # include <rpm/rpmcb.h>
- #endif
- 
-+#ifdef HAVE_RPMMI
-+# include <rpm/rpmtypes.h>
-+#endif
-+
- #if HAVE_RPMDSRPMLIB
- # include <rpm/rpmds.h>
- #endif
-diff --git a/pm/rpm/rpm.c b/pm/rpm/rpm.c
-index 512a8ea..73275af 100644
---- a/pm/rpm/rpm.c
-+++ b/pm/rpm/rpm.c
-@@ -253,14 +253,11 @@ char *pm_rpm_dbpath(void *pm_rpm, char *path, size_t size)
- 
- time_t pm_rpm_dbmtime(void *pm_rpm, const char *dbpath) 
- {
--    const char *file = "packages.rpm";
-+    const char *file = "Packages";
-     char path[PATH_MAX];
-     struct stat st;
- 
-     pm_rpm = pm_rpm;
--#ifdef HAVE_RPM_4_0
--    file = "Packages";
--#endif
-     
-     snprintf(path, sizeof(path), "%s/%s", dbpath, file);
-      
-diff --git a/pm/rpm/rpmdb_depdirs.c b/pm/rpm/rpmdb_depdirs.c
-index 4898958..9eab1bf 100644
---- a/pm/rpm/rpmdb_depdirs.c
-+++ b/pm/rpm/rpmdb_depdirs.c
-@@ -76,10 +76,7 @@ int pm_rpm_dbdepdirs(void *pm_rpm, const char *rootdir, const char *dbpath,
-     return -1;
- #endif    
-     
--    index = "requirename.rpm";
--#ifdef HAVE_RPM_4_0
-     index = "Requirename";
--#endif
- 
- #ifdef HAVE_RPM_5
-     dbtype = DB_BTREE; /* XXX: should be detected at runtime */
-diff --git a/pm/rpm/rpmdb_it.c b/pm/rpm/rpmdb_it.c
-index 3578977..37c7ef2 100644
---- a/pm/rpm/rpmdb_it.c
-+++ b/pm/rpm/rpmdb_it.c
-@@ -10,10 +10,6 @@
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
- 
--/*
--  $Id$
--*/
--
- #ifdef HAVE_CONFIG_H
- # include "config.h"
- #endif
-@@ -30,21 +26,16 @@
- /* remeber! don't touch any member */
- struct rpmdb_it {
-     int                  tag;
--#ifdef HAVE_RPM_4_0
--    rpmdbMatchIterator   mi;
-+#ifdef HAVE_RPMMI
-+    rpmmi                mi;
- #else
--    dbiIndexSet          matches;
--    int                  i;
--    int                  recno;
--#endif
-+    rpmdbMatchIterator   mi;
-+#endif /* HAVE_RPMMI */
-     
-     struct pm_dbrec      dbrec;
-     rpmdb                db; 
- };
- 
--
--
--#ifdef HAVE_RPM_4_0
- static
- int rpmdb_it_init(rpmdb db, struct rpmdb_it *it, int tag, const char *arg)
- {
-@@ -94,154 +85,50 @@ int rpmdb_it_init(rpmdb db, struct rpmdb_it *it, int tag, const char *arg)
-             break;
-     }
-     
--    
-     DBGF("%p, %p\n", it, db);
-     it->tag = tag;
-     it->db = db;
-+#ifdef HAVE_RPMMI
-+    it->mi = rpmmiInit(db, rpmtag, arg, argsize);
-+    return rpmmiCount(it->mi);
-+#else
-     it->mi = rpmdbInitIterator(db, rpmtag, arg, argsize);
-     return rpmdbGetIteratorCount(it->mi);
-+#endif /* HAVE_RPMMI */
- }
- 
--#else  /* HAVE_RPM_4_0 */
--/* Ancient rpm3 */
--static
--int rpmdb_it_init(rpmdb db, struct rpmdb_it *it, int tag, const char *arg) 
--{
--    int rc, n;
--    
--    it->matches.count = 0;
--    it->matches.recs = NULL;
--    it->i = 0;
--    it->recno = 0;
--    it->db = db;
--    it->dbrec.hdr = NULL;
--    it->dbrec.recno = 0;
--    it->tag = tag;
--    
--    switch (tag) {
--        case PMTAG_RECNO:
--            it->recno = rpmdbFirstRecNum(db);
--            if (recno == 0)
--                return 0;
--            if (recno < 0)
--                n_die("%d: invalid recno", recno);
--            break;
--            
--        case PMTAG_NAME:
--            rc = rpmdbFindPackage(db, arg, &it->matches);
--            break;
--            
--        case PMTAG_FILE:
--        case PMTAG_DIRNAME:
--            rc = rpmdbFindByFile(db, arg, &it->matches);
--            break;
--
--        case PMTAG_CAP:
--            rc = rpmdbFindByProvides(db, arg, &it->matches);
--            break;
--            
--        case PMTAG_REQ:
--            rc = rpmdbFindByRequiredBy(db, arg, &it->matches);
--            break;
--            
--        case PMTAG_CNFL:
--            rc = rpmdbFindByConflicts(db, arg, &it->matches);
--            break;
--            
--        case PMTAG_OBSL:
--            n_die("missing feature"); /* don't remember in fact */
--            rc = rpmdbFindByConflicts(db, arg, &it->matches);
--            break;
--            
--        default:
--            n_assert(0);
--    }
--    if (rc < 0)
--        n_die("rpm database error");
--    
--    else if (rc != 0) {
--        n = 0;
--        it->matches.count = 0;
--        
--    } else if (rc == 0)
--        n = it->matches.count;
--
--    return n;
--}
--#endif /* HAVE_RPM_4_0 */
--
--
- static
- void rpmdb_it_destroy(struct rpmdb_it *it) 
- {
--
--#ifdef HAVE_RPM_4_0
-+#ifdef HAVE_RPMMI
-     rpmdbFreeIterator(it->mi);
-+#else
-+    rpmmiFree(it->mi);
-+#endif /* HAVE_RPMMI */
-     it->mi = NULL;
-     it->dbrec.hdr = NULL;
-     DBGF("%p, %p\n", it, it->db);
--#else
--    if (it->dbrec.hdr != NULL) {
--        headerFree(it->dbrec.hdr);
--        it->dbrec.hdr = NULL;
--    }
--    
--    it->db = NULL;
--    if (it->tag != PMTAG_RECNO)
--        dbiFreeIndexRecord(it->matches);
--    it->matches.count = 0;
--    it->matches.recs = NULL;
--#endif    
- }
- 
- 
- static
- const struct pm_dbrec *rpmdb_it_get(struct rpmdb_it *it)
- {
--#ifdef HAVE_RPM_4_0
--    it->dbrec.hdr = rpmdbNextIterator(it->mi);
--    DBGF("%p, %p\n", it, it->db);
-+#ifdef HAVE_RPMMI
-+    it->dbrec.hdr = rpmmiNext(it->mi);
-     
-     if (it->dbrec.hdr == NULL)
-         return NULL;
- 
--    it->dbrec.recno = rpmdbGetIteratorOffset(it->mi);
-+    it->dbrec.recno = rpmmiInstance(it->mi);
- #else
-+    it->dbrec.hdr = rpmdbNextIterator(it->mi);
-     
--    if (it->tag == PMTAG_RECNO) {
--        if (it->recno <= 0)
--            return NULL;
--        
--        n_assert(it->recno);
--        it->dbrec.recno = it->recno;
--        it->dbrec.hdr = rpmdbGetRecord(it->db, it->recno);
--        it->recno = rpmdbNextRecNum(db, it->recno);
--        it->i++;
--        return &it->dbrec;
--    }
--
--    if (it->i == it->matches.count) {
--        if (it->dbrec.hdr != NULL) 
--            headerFree(it->dbrec.hdr);
--        it->dbrec.hdr = NULL;
--        it->i++;
-+    if (it->dbrec.hdr == NULL)
-         return NULL;
--    }
- 
--    if (it->i > it->matches.count)
--        n_die("rpm database error?");
--
--    if (it->dbrec.hdr != NULL)
--        headerFree(it->dbrec.hdr);
--    
--    it->dbrec.recno = it->matches.recs[it->i].recOffset;
--    it->dbrec.hdr = rpmdbGetRecord(it->db, it->dbrec.recno);
--    it->i++;
--    
--    if (it->dbrec.hdr == NULL)
--        n_die("rpm database error?");
--    
--#endif /* HAVE_RPM_4_0 */
-+    it->dbrec.recno = rpmdbGetIteratorOffset(it->mi);
-+#endif /* HAVE_RPMMI */
- 
-     return &it->dbrec;
- }
-@@ -249,14 +136,11 @@ const struct pm_dbrec *rpmdb_it_get(struct rpmdb_it *it)
- static
- int rpmdb_it_get_count(struct rpmdb_it *it)
- {
--#ifdef HAVE_RPM_4_0
--    return rpmdbGetIteratorCount(it->mi);
-+#ifdef HAVE_RPMMI
-+    return rpmmiCount(it->mi);
- #else
--    if (it->tag == PMTAG_RECNO)
--        return it->recno > 0 ? 1000:0; /* TODO howto do dbcount() with rpm3 */
--        
--    return it->matches.count;
--#endif /* HAVE_RPM_4_0 */
-+    return rpmdbGetIteratorCount(it->mi);
-+#endif /* HAVE_RPMMI */
- }
- 
- static 
-diff --git a/pm/rpm/signature4.c b/pm/rpm/signature4.c
-index e69970a..7321e3c 100644
---- a/pm/rpm/signature4.c
-+++ b/pm/rpm/signature4.c
-@@ -10,10 +10,6 @@
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
- 
--/*
--  $Id$
--*/
--
- #ifdef HAVE_CONFIG_H
- # include "config.h"
- #endif
-@@ -66,17 +62,6 @@ static int rpm_read_signature(FD_t fd, Header *sighp, int sig_type)
-     return 0;
- }
-     
--/* rpmlib's rpmCheckSig reports success when GPG signature is missing,
--   so it is useless for real sig verification */
--#if !defined HAVE_RPM_4_0
--static int rpm_signatures(const char *path, unsigned *signature_flags, FD_t *fd)
--{
--    *signature_flags = VRFYSIG_DGST;
--    path = path;
--    return 1;
--}
--
--#else  /* 4.x series  */
- static int rpm_signatures(const char *path, unsigned *signature_flags, FD_t *fd) 
- {
-     unsigned        flags;
-@@ -161,7 +146,6 @@ static int rpm_signatures(const char *path, unsigned *signature_flags, FD_t *fd)
-     *signature_flags = flags;
-     return 1;
- }
--#endif 
- 
- 
- 
-@@ -279,7 +263,6 @@ int do_verify_signature(const char *path, unsigned flags)
- #endif
- 
- 
--#ifdef HAVE_RPM_4_0
- static
- int do_pm_rpm_verify_signature(void *pm_rpm, const char *path, unsigned flags) 
- {
-@@ -303,61 +286,6 @@ int do_pm_rpm_verify_signature(void *pm_rpm, const char *path, unsigned flags)
-     return do_verify_signature(path, rpmflags);
- }
- 
--#else  /* HAVE_RPMCHECKSIG */
--extern int pm_rpm_execrpm(const char *cmd, char *const argv[],
--                          int ontty, int verbose_level);
--static
--int do_pm_rpm_verify_signature(void *pm_rpm, const char *path, unsigned flags) 
--{
--    struct pm_rpm *pm = pm_rpm;
--    char **argv;
--    char *cmd;
--    int i, n, nopts = 0;
--
--    pm_rpm_setup_commands(pm);
--    
--    n = 32;
--    argv = alloca((n + 1) * sizeof(*argv));
--    argv[n] = NULL;
--    n = 0;
--    
--    cmd = pm->rpm;
--    argv[n++] = n_basenam(pm->rpm);
--    argv[n++] = "-K";
--
--    nopts = n;
--    
--    if ((flags & PKGVERIFY_GPG) == 0)
--        argv[n++] = "--nogpg";
--
--    if ((flags & PKGVERIFY_PGP) == 0)
--        argv[n++] = "--nopgp";
--    
--    
--    if ((flags & PKGVERIFY_MD) == 0) {
--        argv[n++] = "--nomd5";
--    }
--    n_assert(n > nopts);        /* any PKGVERIFY_* given? */
--    
--    argv[n++] = (char*)path;
--    nopts = n;
--    argv[n++] = NULL;
--    
--    if (verbose > 1) {
--        char buf[1024], *p;
--        p = buf;
--        
--        for (i=0; i < nopts; i++) 
--            p += n_snprintf(p, &buf[sizeof(buf) - 1] - p, " %s", argv[i]);
--        *p = '\0';
--        msgn(1, _("Executing%s..."), buf);
--    }
--
--    return pm_rpm_execrpm(cmd, argv, 0, 4) == 0;
--}
--
--#endif /* HAVE_RPMCHECKSIG */
--
- extern int pm_rpm_verbose;
- int pm_rpm_verify_signature(void *pm_rpm, const char *path, unsigned flags) 
- {
--- 
-1.7.11.2
-
-
-From dceacab14dec5f5f8a2cfeb426edee7191b0f578 Mon Sep 17 00:00:00 2001
-From: Marcin Banasiak <marcin.banasiak at gmail.com>
-Date: Fri, 31 Aug 2012 14:27:41 +0200
-Subject: [PATCH 2/5] Fix build with rpm 5.4 (lp#1042200)
-
-Currently poldek builds with rpm 5.4 and seems to work, but is not well
-tested and some regressions may still occur.
----
- pkgdir/dir/dir.c    |  1 +
- pkgroup.c           |  4 ----
- pm/rpm/misc.c       | 17 +++++++++++++++--
- pm/rpm/pm_rpm.h     | 22 ++++++++++++++++------
- pm/rpm/rpm_pkg_ld.c |  1 -
- pm/rpm/rpmdb_it.c   |  4 ++--
- pm/rpm/rpmhdr.c     | 15 +++++++++++----
- pm/rpm/rpmvercmp.c  | 29 +++++++++++++++++++++++++++--
- pm/rpm/signature5.c |  6 +++---
- 9 files changed, 75 insertions(+), 24 deletions(-)
-
-diff --git a/pkgdir/dir/dir.c b/pkgdir/dir/dir.c
-index cfe16cb..69d9eef 100644
---- a/pkgdir/dir/dir.c
-+++ b/pkgdir/dir/dir.c
-@@ -18,6 +18,7 @@
- # include "config.h"
- #endif
- 
-+#include <dirent.h>
- #include <limits.h>
- #include <stdint.h>
- #include <stdio.h>
-diff --git a/pkgroup.c b/pkgroup.c
-index 21b29c5..62f124e 100644
---- a/pkgroup.c
-+++ b/pkgroup.c
-@@ -6,9 +6,6 @@
-   the Free Software Foundation (see file COPYING for details).
- */
- 
--/*
--  $Id$
--*/
- #ifdef HAVE_CONFIG_H
- # include "config.h"
- #endif
-@@ -19,7 +16,6 @@
- #include <string.h>
- 
- #include <trurl/trurl.h>
--#include <rpm/rpmlib.h>
- 
- #define ENABLE_TRACE 0
- 
-diff --git a/pm/rpm/misc.c b/pm/rpm/misc.c
-index 613ac1b..89ef808 100644
---- a/pm/rpm/misc.c
-+++ b/pm/rpm/misc.c
-@@ -21,18 +21,25 @@
- #include <ctype.h>
- #include <stdint.h>
- #include <string.h>
-+#include <stdio.h>
- #include <time.h> /* rpmts.h with defined _RPMTS_INTERNAL needs ctime() */
- 
- #include <trurl/nassert.h>
- #include <trurl/nstr.h>
- 
--#include <rpm/rpmlib.h>
-+#ifdef HAVE_RPM_5
-+# include <rpm/rpmtypes.h>
-+# include <rpm/rpmtag.h>
-+# include <rpm/rpmio.h>
-+#else
-+# include <rpm/rpmlib.h>
-+#endif
- #include <rpm/rpmte.h>
- #if HAVE_RPM_4_1
- # define _RPMPRCO_INTERNAL
- # include <rpm/rpmds.h>
- #endif
--#define _RPMTS_INTERNAL
-+//#define _RPMTS_INTERNAL
- #include <rpm/rpmts.h>
- 
- #include "capreq.h"
-@@ -224,6 +231,8 @@ static int rpmioaccess_satisfies(const struct capreq *req)
-     return rc;
- }
- 
-+
-+#if 0
- static int rpmdiskspace_satisfies(const struct capreq *req)
- {
-     const char *name = NULL;
-@@ -307,6 +316,8 @@ static int rpmdiskspace_satisfies(const struct capreq *req)
-     
-     return rc;
- }
-+#endif
-+
- 
- int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
- {
-@@ -320,8 +331,10 @@ int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
-     if (rpmioaccess_satisfies(req))
-         return 1;
- 
-+#if 0
-     if (rpmdiskspace_satisfies(req))
- 	return 1;
-+#endif
- 
-     if (pm->caps == NULL)
-         if ((pm->caps = load_internal_caps(pm_rpm)) == NULL)
-diff --git a/pm/rpm/pm_rpm.h b/pm/rpm/pm_rpm.h
-index 8c6a179..2494bf0 100644
---- a/pm/rpm/pm_rpm.h
-+++ b/pm/rpm/pm_rpm.h
-@@ -16,16 +16,21 @@
- #include <sys/time.h>           /* timeval */
- 
- #define _RPMPRCO_INTERNAL 1 /* see pm_rpmdsSysinfo */
--#include <rpm/rpmlib.h>
-+
-+#ifdef HAVE_RPM_5
-+# include <rpm/rpmtypes.h>
-+# include <rpm/rpmiotypes.h>
-+# include <rpm/rpmtag.h>
-+# include <rpm/pkgio.h>
-+#else
-+# include <rpm/rpmlib.h>
-+# include <rpm/rpmurl.h>
-+#endif /* HAVE_RPM_5 */
- 
- #ifdef HAVE_RPM_RPMCB_H
- # include <rpm/rpmcb.h>
- #endif
- 
--#ifdef HAVE_RPMMI
--# include <rpm/rpmtypes.h>
--#endif
--
- #if HAVE_RPMDSRPMLIB
- # include <rpm/rpmds.h>
- #endif
-@@ -45,7 +50,6 @@
- # include <rpm/rpmdb.h>
- #endif
- 
--#include <rpm/rpmurl.h>
- #include <rpm/rpmmacro.h>
- 
- #ifdef RPM_MAJOR_VERSION
-@@ -56,6 +60,12 @@
- # if PM_RPMVER(RPM_FORMAT_VERSION,RPM_MAJOR_VERSION,RPM_MINOR_VERSION) >= PM_RPMVER(5,0,0)
- #  define HAVE_RPM_VERSION_GE_5 1
- # endif
-+#else
-+# include <rpm/rpmversion.h>
-+# if defined(RPMLIB_VERSION) && RPMLIB_VERSION >= RPMLIB_VERSION_ENCODE(5,0,r,0,0,_)
-+#  define HAVE_RPM_VERSION_GE_4_4_8 1
-+#  define HAVE_RPM_VERSION_GE_5 1
-+# endif
- #endif 
- 
- 
-diff --git a/pm/rpm/rpm_pkg_ld.c b/pm/rpm/rpm_pkg_ld.c
-index dbed6f6..8423a62 100644
---- a/pm/rpm/rpm_pkg_ld.c
-+++ b/pm/rpm/rpm_pkg_ld.c
-@@ -21,7 +21,6 @@
- 
- #ifdef HAVE_RPM_RPMEVR_H
- # define _RPMEVR_INTERNAL 1
--# include <rpm/rpmevr.h>
- #endif
- 
- #include "i18n.h"
-diff --git a/pm/rpm/rpmdb_it.c b/pm/rpm/rpmdb_it.c
-index 37c7ef2..059db46 100644
---- a/pm/rpm/rpmdb_it.c
-+++ b/pm/rpm/rpmdb_it.c
-@@ -101,9 +101,9 @@ static
- void rpmdb_it_destroy(struct rpmdb_it *it) 
- {
- #ifdef HAVE_RPMMI
--    rpmdbFreeIterator(it->mi);
--#else
-     rpmmiFree(it->mi);
-+#else
-+    rpmdbFreeIterator(it->mi);
- #endif /* HAVE_RPMMI */
-     it->mi = NULL;
-     it->dbrec.hdr = NULL;
-diff --git a/pm/rpm/rpmhdr.c b/pm/rpm/rpmhdr.c
-index 360a6d5..5989553 100644
---- a/pm/rpm/rpmhdr.c
-+++ b/pm/rpm/rpmhdr.c
-@@ -29,12 +29,14 @@
- #include "pm_rpm.h"
- 
- #if defined(HAVE_RPM_4_0_4) || defined(HAVE_RPM_VERSION_GE_4_4_8)           /* missing prototypes in public headers */
-+#ifndef HAVE_RPM_5
- int headerGetRawEntry(Header h, int_32 tag,
-                       /*@null@*/ /*@out@*/ hTYP_t type,
-                       /*@null@*/ /*@out@*/ hPTR_t * p, 
-                       /*@null@*/ /*@out@*/ hCNT_t c);
- char ** headerGetLangs(Header h);
- #endif
-+#endif
- 
- 
- int pm_rpmhdr_get_string(Header h, int32_t tag, char *value, int size)
-@@ -122,8 +124,9 @@ int pm_rpmhdr_get_raw_entry(Header h, int32_t tag, void *buf, int32_t *cnt)
-         return 0;
-     }
- #endif
--    
--    if (tag == RPMTAG_GROUP && type == RPM_STRING_TYPE) { /* build by old rpm */
-+
-+#ifndef HAVE_RPM_5
-+    if (tag == RPMTAG_GROUP && type == RPM_STRING_TYPE) { // build by old rpm
-         char **g;
- 	
-         n_assert(*cnt == 1);
-@@ -133,7 +136,8 @@ int pm_rpmhdr_get_raw_entry(Header h, int32_t tag, void *buf, int32_t *cnt)
-         g[1] = NULL;
-         *(char ***)buf = g;
-     }
--    
-+#endif
-+
-     DBGF("%d type=%d, cnt=%d\n", tag, type, *cnt);
-     return 1;
- }
-@@ -147,7 +151,10 @@ int pm_rpmhdr_loadfdt(FD_t fdt, Header *hdr, const char *path)
- #else 
-     rpmRC rpmrc;
-     rpmts ts = rpmtsCreate();
--    rpmtsSetVSFlags(ts, _RPMVSF_NODIGESTS | _RPMVSF_NOSIGNATURES);
-+    rpmtsSetVSFlags(ts, RPMVSF_NOSHA1HEADER | RPMVSF_NOMD5HEADER |
-+                        RPMVSF_NOSHA1 | RPMVSF_NOMD5 |
-+                        RPMVSF_NODSAHEADER | RPMVSF_NORSAHEADER |
-+                        RPMVSF_NODSA | RPMVSF_NODSA);
-     rpmrc = rpmReadPackageFile(ts, fdt, path, hdr);
-     switch (rpmrc) {
-         case RPMRC_NOTTRUSTED:
-diff --git a/pm/rpm/rpmvercmp.c b/pm/rpm/rpmvercmp.c
-index c40d903..968489a 100644
---- a/pm/rpm/rpmvercmp.c
-+++ b/pm/rpm/rpmvercmp.c
-@@ -1,13 +1,32 @@
-+/*
-+  Copyright (C) 2000 - 2008 Pawel A. Gajda <mis at pld-linux.org>
-+  Copyright (C) 2010 - 2012 Marcin Banasiak <marcin.banasiak at gmail.com>
-+
-+  This program is free software; you can redistribute it and/or modify
-+  it under the terms of the GNU General Public License, version 2 as
-+  published by the Free Software Foundation (see file COPYING for details).
-+
-+  You should have received a copy of the GNU General Public License along
-+  with this program; if not, write to the Free Software Foundation, Inc.,
-+  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-+*/
-+
- #ifdef HAVE_CONFIG_H
- # include "config.h"
- #endif 
- 
-+#include <stdint.h>
- #include <stdio.h>
- #include <stdlib.h>
- 
-+#ifdef HAVE_RPM_5
-+# include <rpm/rpmtag.h>
-+#endif
-+
- #define _RPMEVR_INTERNAL
- #include <rpm/rpmevr.h>
- 
-+#ifndef HAVE_RPM_5
- static void parse(const char *evrstr, EVR_t evr)
- {
-     rpmEVRparse(evrstr, evr);
-@@ -20,6 +39,7 @@ static void parse(const char *evrstr, EVR_t evr)
-     if (evr->R == NULL)
- 	evr->R = "0";
- }
-+#endif
- 
- int main(int argc, char *argv[])
- {
-@@ -43,10 +63,15 @@ int main(int argc, char *argv[])
- 
-     evr1 = malloc(sizeof(struct EVR_s));
-     evr2 = malloc(sizeof(struct EVR_s));
--    
-+
-+#ifdef HAVE_RPM_5    
-+    rpmEVRparse(v1, evr1);
-+    rpmEVRparse(v2, evr2);
-+#else
-     parse(v1, evr1);
-     parse(v2, evr2);
--    
-+#endif
-+
-     cmprc = rpmEVRcompare(evr1, evr2);
-     
-     printf("%s %s %s\n", v1, cmprc == 0 ?  "==" : cmprc > 0 ? ">" : "<", v2);
-diff --git a/pm/rpm/signature5.c b/pm/rpm/signature5.c
-index e954fa5..ac1f9e4 100644
---- a/pm/rpm/signature5.c
-+++ b/pm/rpm/signature5.c
-@@ -18,7 +18,7 @@
- # include "config.h"
- #endif
- 
--#ifndef HAVE_RPMPKGREAD          /* rpm 5.x */
-+#ifndef HAVE_RPM_5          /* rpm 5.x */
- # error "not rpm 5.x"
- #endif
- 
-@@ -31,10 +31,10 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- 
-+#include <rpm/rpmtypes.h>
-+#include <rpm/rpmtag.h>
- #include <rpm/rpmcb.h>
--#include <rpm/rpmlib.h>
- #include <rpm/rpmio.h>
--#include <rpm/rpmurl.h>
- #include <rpm/rpmmacro.h>
- 
- #include <rpm/rpmts.h>
--- 
-1.7.11.2
-
-
-From 9e4fe82da2df9b43b22a2bf36f2da69bb3238e87 Mon Sep 17 00:00:00 2001
-From: Marcin Banasiak <marcin.banasiak at gmail.com>
-Date: Fri, 31 Aug 2012 14:44:09 +0200
-Subject: [PATCH 3/5] Drop support for diskspace()
-
-It was not a good idea to add support for diskspace() dependency in
-poldek, which, I think, is designed for BuildRequires in spec files.
-Package install size can be measured using RPMTAG_SIZE, so I see no
-point in using diskspace() for this purpose.
----
- pm/rpm/misc.c | 102 +---------------------------------------------------------
- 1 file changed, 1 insertion(+), 101 deletions(-)
-
-diff --git a/pm/rpm/misc.c b/pm/rpm/misc.c
-index 89ef808..8a5c1bf 100644
---- a/pm/rpm/misc.c
-+++ b/pm/rpm/misc.c
-@@ -10,10 +10,6 @@
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
- 
--/*
--  $Id$
--*/
--
- #ifdef HAVE_CONFIG_H
- # include "config.h"
- #endif
-@@ -22,7 +18,6 @@
- #include <stdint.h>
- #include <string.h>
- #include <stdio.h>
--#include <time.h> /* rpmts.h with defined _RPMTS_INTERNAL needs ctime() */
- 
- #include <trurl/nassert.h>
- #include <trurl/nstr.h>
-@@ -34,13 +29,11 @@
- #else
- # include <rpm/rpmlib.h>
- #endif
--#include <rpm/rpmte.h>
-+
- #if HAVE_RPM_4_1
- # define _RPMPRCO_INTERNAL
- # include <rpm/rpmds.h>
- #endif
--//#define _RPMTS_INTERNAL
--#include <rpm/rpmts.h>
- 
- #include "capreq.h"
- #include "i18n.h"
-@@ -231,94 +224,6 @@ static int rpmioaccess_satisfies(const struct capreq *req)
-     return rc;
- }
- 
--
--#if 0
--static int rpmdiskspace_satisfies(const struct capreq *req)
--{
--    const char *name = NULL;
--    char *s, *e;
--    int rc = 0;
--    
--    name = capreq_name(req);
--        
--    if (strncmp(name, "diskspace(", sizeof("diskspace(")-1) == 0 &&
--	(e = strchr(name, ')')) != NULL) {
--	const char **fs = NULL;
--	char path[PATH_MAX];
--	rpmts ts;
--	rpmDiskSpaceInfo dsi = NULL;
--	int nfs = 0, pathlen, longest = 0;
--	
--	/* extract path */
--	s = strchr(name, '(');
--	n_strncpy(path, s+1, e-s);
--	pathlen = strlen(path);
--	
--	ts = rpmtsCreate();
--	
--	/* code copied from lib/depends.c */
--	rpmtsInitDSI(ts);
--	fs = ts->filesystems;
--	nfs = ts->filesystemCount;
--	
--	if (fs) {
--	    int i;
--	    
--	    for (i = 0; i < nfs; i++) {
--		int fslen = strlen(fs[i]);
--		
--		if (fslen > pathlen)
--		    continue;
--		
--		if (strncmp(fs[i], path, fslen))
--		    continue;
--		
--		if (fslen > 1 && path[fslen] != '/' && path[fslen] != '\0')
--		    continue;
--		
--		if (fslen < longest)
--		    continue;
--		
--		longest = fslen;
--		dsi = ts->dsi + i;
--	    }
--	    
--	    if (dsi) {
--		char *end = NULL;
--		long long needed = strtoll(capreq_ver(req), &end, 0);		
--		int x;
--		
--		if (end && *end) {
--		    if (strchr("Gg", end[0]) && strchr("Bb", end[1]) && !end[2])
--			needed *= 1024 * 1024 * 1024;
--		    if (strchr("Mm", end[0]) && strchr("Bb", end[1]) && !end[2])
--			needed *= 1024 * 1024;
--		    if (strchr("Kk", end[0]) && strchr("Bb", end[1]) && !end[2])
--			needed *= 1024;
--		} else {
--		    /* assume Mb if no units given */
--		    needed *= 1024 * 1024;
--		}
--
--		needed = BLOCK_ROUND(needed, dsi->f_bsize);
--		x = (dsi->f_bavail - needed);
--
--		if ((req->cr_relflags & REL_LT) && x < 0)
--		    rc = 1;
--		else if ((req->cr_relflags & REL_GT) && x > 0)
--		    rc = 1;
--		else if ((req->cr_relflags & REL_EQ) && x == 0)
--		    rc = 1;
--	    }
--	}	
--	rpmtsFree(ts);
--    }
--    
--    return rc;
--}
--#endif
--
--
- int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
- {
-     struct pm_rpm *pm = pm_rpm;
-@@ -331,11 +236,6 @@ int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
-     if (rpmioaccess_satisfies(req))
-         return 1;
- 
--#if 0
--    if (rpmdiskspace_satisfies(req))
--	return 1;
--#endif
--
-     if (pm->caps == NULL)
-         if ((pm->caps = load_internal_caps(pm_rpm)) == NULL)
-             return 0;
--- 
-1.7.11.2
-
-
-From ec43fec423b9e577d7b5698185fb3b993dab57ed Mon Sep 17 00:00:00 2001
-From: Marcin Banasiak <marcin.banasiak at gmail.com>
-Date: Fri, 31 Aug 2012 15:48:52 +0200
-Subject: [PATCH 4/5] Adjust autogen.sh and make snap for git
-
----
- Makefile.extra | 26 ++++++++++----------------
- autogen.sh     | 13 +++----------
- 2 files changed, 13 insertions(+), 26 deletions(-)
-
-diff --git a/Makefile.extra b/Makefile.extra
-index 2c97511..9debaa1 100644
---- a/Makefile.extra
-+++ b/Makefile.extra
-@@ -1,17 +1,11 @@
--# $Id$
--
- PROJ_DIR=$(shell pwd)
- 
- copylibs:
--	./getlib.sh trurlib copy
--	./getlib.sh tndb copy
--
--removelibs:
--	./getlib.sh trurlib link
--	./getlib.sh tndb link
-+	git submodule init
-+	git submodule update
- 
--tarball: copylibs dist removelibs
--tarball-bz2: copylibs dist-bzip2 removelibs
-+tarball: copylibs dist
-+tarball-bz2: copylibs dist-bzip2
- 
- rpm-package: tarball-bz2
- 	rpmbuild -tb $(distdir).tar.bz2
-@@ -50,21 +44,21 @@ backup:
- arch : mclean backup 
- 
- POTFILES_in:
--	-rm -f poldek-cvs*
-+	-rm -f poldek-git*
- 	-find . -type f -name \*.c | egrep -v '(poldek-.*/|Cellar/|intl/|trurlib/|tndb/|python/|tests/|conf_sections.c)'  | sed 's|^\./||' | LC_ALL=C sort > po/POTFILES.in
- 
- misarch: mclean
- 	$(MAKE) -C . backup cparch=1 backupdir=/z
- 
- snap: tarball-bz2
--	@dts=`date +%Y%m%d.%H` && rm -rf $(PACKAGE)-cvs$$dts* && \
-+	@dts=`date +%Y%m%d.%H` && rm -rf $(PACKAGE)-git$$dts* && \
- 	tar xpjf $(distdir).tar.bz2 && \
- 	echo "$$dts" > $(distdir)/0_THIS_IS_SNAPSHOT && \
-         perl -pi -e "s/VERSION_STATUS=.+$$/VERSION_STATUS=\"snap$$dts\"/" $(distdir)/configure $(distdir)/configure.in; \
--	mv -f $(distdir) $(PACKAGE)-$(VERSION)-cvs$$dts && \
--	tar cpjf $(PACKAGE)-$(VERSION)-cvs$$dts.tar.bz2 $(PACKAGE)-$(VERSION)-cvs$$dts && \
--	rm -rf $(PACKAGE)-$(VERSION)-cvs$$dts && \
--	echo "$(PACKAGE)-$(VERSION)-cvs$$dts.tar.bz2"
-+	mv -f $(distdir) $(PACKAGE)-$(VERSION)-git$$dts && \
-+	tar cpjf $(PACKAGE)-$(VERSION)-git$$dts.tar.bz2 $(PACKAGE)-$(VERSION)-git$$dts && \
-+	rm -rf $(PACKAGE)-$(VERSION)-git$$dts && \
-+	echo "$(PACKAGE)-$(VERSION)-git$$dts.tar.bz2"
- 
- snap-rpm-package: snap
- 		dts=`date +%Y%m%d.%H` && echo $$dts && ls -l $(PACKAGE)-$(VERSION)-cvs$$dts.tar.bz2 &&\
-diff --git a/autogen.sh b/autogen.sh
-index 6ec65b6..7248be0 100755
---- a/autogen.sh
-+++ b/autogen.sh
-@@ -1,5 +1,4 @@
- #!/bin/sh
--# $Id$
- 
- if [ ! -f capreq.h ]; then
-     cd `dirname $0`;
-@@ -19,16 +18,10 @@ runcmd () {
- }
- 
- CONFOPTS="--enable-maintainer-mode --enable-compile-warnings"
--
--getlib_mode="link"
--if [ -n "$1" -a "$1" = "makedist" ]; then
--    rm -f trurlib tndb
--    getlib_mode="cp"
--    shift
--fi
- CONFOPTS="$CONFOPTS $@"
--runcmd ./getlib.sh trurlib $getlib_mode
--runcmd ./getlib.sh tndb    $getlib_mode
-+
-+runcmd git submodule init
-+runcmd git submodule update
- 
- # generate po/POTFILES.in
- make -f Makefile.extra POTFILES_in
--- 
-1.7.11.2
-
-
-From c26ae4cfeb59d6529e8c8a0b545f88811ca14c58 Mon Sep 17 00:00:00 2001
-From: Marcin Banasiak <marcin.banasiak at gmail.com>
-Date: Fri, 31 Aug 2012 16:31:48 +0200
-Subject: [PATCH 5/5] rpm 5.x has RPMTAG_* in rpmtag.h
-
----
- configure.ac | 65 +++++++++++++++++++++++++++++++++++-------------------------
- 1 file changed, 38 insertions(+), 27 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 5f14b64..1519149 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -197,21 +197,15 @@ AC_CHECK_HEADERS([sys/filio.h])
- 
- dnl RH rpm needs this
- CPPFLAGS="-I/usr/include/rpm $CPPFLAGS"
--AC_CHECK_HEADER([rpm/rpmdb.h],,AC_MSG_ERROR(["missing required rpmlib.h"]))
--
--AC_CHECK_TYPE([rpmmi],
--	      [AC_DEFINE([HAVE_RPMMI], 1, [rpm with database iterator])],
--	      [],
--	      [[#include <rpm/rpmtypes.h>]])
-+AC_CHECK_HEADER([rpm/rpmdb.h], [], AC_MSG_ERROR(["missing required rpmdb.h"]))
- 
- AC_MSG_CHECKING([for rpm 4.x])
--#RPMDBI_PACKAGES
- AC_EGREP_CPP(yes,
--     [#include <rpm/rpmlib.h>
--      #ifdef RPMDBI_PACKAGES
--       yes
--      #endif
--     ], is_rpm4=yes, is_rpm4=no)
-+    [#include <rpm/rpmlib.h>
-+     #ifdef RPMDBI_PACKAGES
-+	yes
-+     #endif
-+    ], is_rpm4=yes, is_rpm4=no)
- 
- if test "${is_rpm4}." = "no." ; then
- 	AC_MSG_RESULT(no)
-@@ -242,17 +236,36 @@ else
- 		[ #include <rpm/rpmlib.h>
- 		], have_tag_pubkeys=yes, have_tag_pubkeys=no)
- 
--	if test "${have_tag_pubkeys}." = "yes." ; then
--		AC_DEFINE([HAVE_RPMTAG_PUBKEYS],1,["rpm with RPMTAG_PUBKEYS"])
--	fi
--
-         AC_EGREP_CPP(RPMTAG_SUGGESTS,
- 		[ #include <rpm/rpmlib.h>
- 		], have_tag_suggests=yes, have_tag_suggests=no)
-+fi
- 
--	if test "${have_tag_suggests}." = "yes." ; then
--		AC_DEFINE([HAVE_RPMTAG_SUGGESTS],1,["rpm with RPMTAG_SUGGESTS support"])
--	fi
-+AC_MSG_CHECKING([for rpm 5.x])
-+
-+PKG_CHECK_EXISTS([rpm >= 5.0], [is_rpm5=yes], [is_rpm5=no])
-+
-+if test "${is_rpm5}." = "yes."; then
-+    AC_MSG_RESULT(yes)
-+    AC_EGREP_CPP(RPMTAG_PUBKEYS,
-+    		 [ #include <rpm/rpmtag.h>
-+    		 ], have_tag_pubkeys=yes, have_tag_pubkeys=no)
-+
-+    AC_EGREP_CPP(RPMTAG_SUGGESTS,
-+		 [ #include <rpm/rpmtag.h>
-+		 ], have_tag_suggests=yes, have_tag_suggests=no)
-+
-+    AC_DEFINE([HAVE_RPM_5], [1], [])
-+else
-+    AC_MSG_RESULT(no)
-+fi
-+
-+if test "${have_tag_pubkeys}." = "yes." ; then
-+    AC_DEFINE([HAVE_RPMTAG_PUBKEYS], 1, [rpm with RPMTAG_PUBKEYS])
-+fi
-+
-+if test "${have_tag_suggests}." = "yes." ; then
-+    AC_DEFINE([HAVE_RPMTAG_SUGGESTS], 1, [rpm with RPMTAG_SUGGESTS support])
- fi
- 
- dnl Checks for libraries.
-@@ -361,22 +374,20 @@ AC_CHECK_FUNCS(_rpmvercmp)
- dnl rpm 4.4.9
- AC_CHECK_HEADERS([rpm/rpmevr.h])
- 
--dnl
- dnl rpm 5.x
- dnl fnpyKey provider
- AC_CHECK_HEADERS([rpm/rpmcb.h])
- AC_CHECK_FUNCS(rpmpkgRead)
--AC_MSG_CHECKING([for rpm 5.x])
--if test "$ac_cv_func_rpmpkgRead." != "yes."; then
--     AC_MSG_RESULT(no)   
--else
--     AC_DEFINE([HAVE_RPM_5], [1], [])
--     AC_MSG_RESULT(yes)
--fi
-+
- AC_CHECK_FUNCS(headerNVR)     # removed since 5.0
- AC_CHECK_FUNCS(headerNEVRA)  
- AC_CHECK_FUNCS(rpmErrorString)
- 
-+AC_CHECK_TYPE([rpmmi],
-+	      [AC_DEFINE([HAVE_RPMMI], 1, [rpm with database iterator])],
-+	      [],
-+	      [[#include <rpm/rpmtypes.h>]])
-+
- dnl  - removed enum (not macro) HEADER_MAGIC_YES
- if test "${is_rpm4}." = "yes." ; then
-    AC_EGREP_CPP(HEADER_MAGIC_YES,
--- 
-1.7.11.2
-
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/poldek.git/commitdiff/b3b4fdfb095ae1ffb04a179db776f6427642a201



More information about the pld-cvs-commit mailing list