1 From 8cf145343137ceee3a4355ab02e2160481efb5c1 Mon Sep 17 00:00:00 2001
2 From: Marcin Banasiak <marcin.banasiak@gmail.com>
3 Date: Wed, 29 Aug 2012 20:52:58 +0200
4 Subject: [PATCH 1/5] Drop support for ancient rpm versions
10 pm/rpm/rpmdb_depdirs.c | 3 -
11 pm/rpm/rpmdb_it.c | 164 ++++++++-----------------------------------------
12 pm/rpm/signature4.c | 72 ----------------------
13 6 files changed, 36 insertions(+), 220 deletions(-)
15 diff --git a/configure.ac b/configure.ac
16 index 64eac04..5f14b64 100644
19 @@ -79,6 +79,7 @@ if test -n "$GCC"; then
23 +PKG_PROG_PKG_CONFIG()
25 PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check=yes, have_check=no)
27 @@ -196,7 +197,12 @@ AC_CHECK_HEADERS([sys/filio.h])
30 CPPFLAGS="-I/usr/include/rpm $CPPFLAGS"
31 -AC_CHECK_HEADER([rpm/rpmlib.h],,AC_MSG_ERROR(["missing required rpmlib.h"]))
32 +AC_CHECK_HEADER([rpm/rpmdb.h],,AC_MSG_ERROR(["missing required rpmlib.h"]))
34 +AC_CHECK_TYPE([rpmmi],
35 + [AC_DEFINE([HAVE_RPMMI], 1, [rpm with database iterator])],
37 + [[#include <rpm/rpmtypes.h>]])
39 AC_MSG_CHECKING([for rpm 4.x])
41 diff --git a/pm/rpm/pm_rpm.h b/pm/rpm/pm_rpm.h
42 index a34dd60..8c6a179 100644
46 # include <rpm/rpmcb.h>
50 +# include <rpm/rpmtypes.h>
54 # include <rpm/rpmds.h>
56 diff --git a/pm/rpm/rpm.c b/pm/rpm/rpm.c
57 index 512a8ea..73275af 100644
60 @@ -253,14 +253,11 @@ char *pm_rpm_dbpath(void *pm_rpm, char *path, size_t size)
62 time_t pm_rpm_dbmtime(void *pm_rpm, const char *dbpath)
64 - const char *file = "packages.rpm";
65 + const char *file = "Packages";
74 snprintf(path, sizeof(path), "%s/%s", dbpath, file);
76 diff --git a/pm/rpm/rpmdb_depdirs.c b/pm/rpm/rpmdb_depdirs.c
77 index 4898958..9eab1bf 100644
78 --- a/pm/rpm/rpmdb_depdirs.c
79 +++ b/pm/rpm/rpmdb_depdirs.c
80 @@ -76,10 +76,7 @@ int pm_rpm_dbdepdirs(void *pm_rpm, const char *rootdir, const char *dbpath,
84 - index = "requirename.rpm";
86 index = "Requirename";
90 dbtype = DB_BTREE; /* XXX: should be detected at runtime */
91 diff --git a/pm/rpm/rpmdb_it.c b/pm/rpm/rpmdb_it.c
92 index 3578977..37c7ef2 100644
93 --- a/pm/rpm/rpmdb_it.c
94 +++ b/pm/rpm/rpmdb_it.c
96 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
107 /* remeber! don't touch any member */
111 - rpmdbMatchIterator mi;
115 - dbiIndexSet matches;
119 + rpmdbMatchIterator mi;
120 +#endif /* HAVE_RPMMI */
122 struct pm_dbrec dbrec;
130 int rpmdb_it_init(rpmdb db, struct rpmdb_it *it, int tag, const char *arg)
132 @@ -94,154 +85,50 @@ int rpmdb_it_init(rpmdb db, struct rpmdb_it *it, int tag, const char *arg)
137 DBGF("%p, %p\n", it, db);
141 + it->mi = rpmmiInit(db, rpmtag, arg, argsize);
142 + return rpmmiCount(it->mi);
144 it->mi = rpmdbInitIterator(db, rpmtag, arg, argsize);
145 return rpmdbGetIteratorCount(it->mi);
146 +#endif /* HAVE_RPMMI */
149 -#else /* HAVE_RPM_4_0 */
152 -int rpmdb_it_init(rpmdb db, struct rpmdb_it *it, int tag, const char *arg)
156 - it->matches.count = 0;
157 - it->matches.recs = NULL;
161 - it->dbrec.hdr = NULL;
162 - it->dbrec.recno = 0;
167 - it->recno = rpmdbFirstRecNum(db);
171 - n_die("%d: invalid recno", recno);
175 - rc = rpmdbFindPackage(db, arg, &it->matches);
179 - case PMTAG_DIRNAME:
180 - rc = rpmdbFindByFile(db, arg, &it->matches);
184 - rc = rpmdbFindByProvides(db, arg, &it->matches);
188 - rc = rpmdbFindByRequiredBy(db, arg, &it->matches);
192 - rc = rpmdbFindByConflicts(db, arg, &it->matches);
196 - n_die("missing feature"); /* don't remember in fact */
197 - rc = rpmdbFindByConflicts(db, arg, &it->matches);
204 - n_die("rpm database error");
206 - else if (rc != 0) {
208 - it->matches.count = 0;
210 - } else if (rc == 0)
211 - n = it->matches.count;
215 -#endif /* HAVE_RPM_4_0 */
219 void rpmdb_it_destroy(struct rpmdb_it *it)
224 rpmdbFreeIterator(it->mi);
227 +#endif /* HAVE_RPMMI */
229 it->dbrec.hdr = NULL;
230 DBGF("%p, %p\n", it, it->db);
232 - if (it->dbrec.hdr != NULL) {
233 - headerFree(it->dbrec.hdr);
234 - it->dbrec.hdr = NULL;
238 - if (it->tag != PMTAG_RECNO)
239 - dbiFreeIndexRecord(it->matches);
240 - it->matches.count = 0;
241 - it->matches.recs = NULL;
247 const struct pm_dbrec *rpmdb_it_get(struct rpmdb_it *it)
250 - it->dbrec.hdr = rpmdbNextIterator(it->mi);
251 - DBGF("%p, %p\n", it, it->db);
253 + it->dbrec.hdr = rpmmiNext(it->mi);
255 if (it->dbrec.hdr == NULL)
258 - it->dbrec.recno = rpmdbGetIteratorOffset(it->mi);
259 + it->dbrec.recno = rpmmiInstance(it->mi);
261 + it->dbrec.hdr = rpmdbNextIterator(it->mi);
263 - if (it->tag == PMTAG_RECNO) {
264 - if (it->recno <= 0)
267 - n_assert(it->recno);
268 - it->dbrec.recno = it->recno;
269 - it->dbrec.hdr = rpmdbGetRecord(it->db, it->recno);
270 - it->recno = rpmdbNextRecNum(db, it->recno);
275 - if (it->i == it->matches.count) {
276 - if (it->dbrec.hdr != NULL)
277 - headerFree(it->dbrec.hdr);
278 - it->dbrec.hdr = NULL;
280 + if (it->dbrec.hdr == NULL)
284 - if (it->i > it->matches.count)
285 - n_die("rpm database error?");
287 - if (it->dbrec.hdr != NULL)
288 - headerFree(it->dbrec.hdr);
290 - it->dbrec.recno = it->matches.recs[it->i].recOffset;
291 - it->dbrec.hdr = rpmdbGetRecord(it->db, it->dbrec.recno);
294 - if (it->dbrec.hdr == NULL)
295 - n_die("rpm database error?");
297 -#endif /* HAVE_RPM_4_0 */
298 + it->dbrec.recno = rpmdbGetIteratorOffset(it->mi);
299 +#endif /* HAVE_RPMMI */
303 @@ -249,14 +136,11 @@ const struct pm_dbrec *rpmdb_it_get(struct rpmdb_it *it)
305 int rpmdb_it_get_count(struct rpmdb_it *it)
308 - return rpmdbGetIteratorCount(it->mi);
310 + return rpmmiCount(it->mi);
312 - if (it->tag == PMTAG_RECNO)
313 - return it->recno > 0 ? 1000:0; /* TODO howto do dbcount() with rpm3 */
315 - return it->matches.count;
316 -#endif /* HAVE_RPM_4_0 */
317 + return rpmdbGetIteratorCount(it->mi);
318 +#endif /* HAVE_RPMMI */
322 diff --git a/pm/rpm/signature4.c b/pm/rpm/signature4.c
323 index e69970a..7321e3c 100644
324 --- a/pm/rpm/signature4.c
325 +++ b/pm/rpm/signature4.c
327 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
337 @@ -66,17 +62,6 @@ static int rpm_read_signature(FD_t fd, Header *sighp, int sig_type)
341 -/* rpmlib's rpmCheckSig reports success when GPG signature is missing,
342 - so it is useless for real sig verification */
343 -#if !defined HAVE_RPM_4_0
344 -static int rpm_signatures(const char *path, unsigned *signature_flags, FD_t *fd)
346 - *signature_flags = VRFYSIG_DGST;
351 -#else /* 4.x series */
352 static int rpm_signatures(const char *path, unsigned *signature_flags, FD_t *fd)
355 @@ -161,7 +146,6 @@ static int rpm_signatures(const char *path, unsigned *signature_flags, FD_t *fd)
356 *signature_flags = flags;
363 @@ -279,7 +263,6 @@ int do_verify_signature(const char *path, unsigned flags)
369 int do_pm_rpm_verify_signature(void *pm_rpm, const char *path, unsigned flags)
371 @@ -303,61 +286,6 @@ int do_pm_rpm_verify_signature(void *pm_rpm, const char *path, unsigned flags)
372 return do_verify_signature(path, rpmflags);
375 -#else /* HAVE_RPMCHECKSIG */
376 -extern int pm_rpm_execrpm(const char *cmd, char *const argv[],
377 - int ontty, int verbose_level);
379 -int do_pm_rpm_verify_signature(void *pm_rpm, const char *path, unsigned flags)
381 - struct pm_rpm *pm = pm_rpm;
384 - int i, n, nopts = 0;
386 - pm_rpm_setup_commands(pm);
389 - argv = alloca((n + 1) * sizeof(*argv));
394 - argv[n++] = n_basenam(pm->rpm);
399 - if ((flags & PKGVERIFY_GPG) == 0)
400 - argv[n++] = "--nogpg";
402 - if ((flags & PKGVERIFY_PGP) == 0)
403 - argv[n++] = "--nopgp";
406 - if ((flags & PKGVERIFY_MD) == 0) {
407 - argv[n++] = "--nomd5";
409 - n_assert(n > nopts); /* any PKGVERIFY_* given? */
411 - argv[n++] = (char*)path;
416 - char buf[1024], *p;
419 - for (i=0; i < nopts; i++)
420 - p += n_snprintf(p, &buf[sizeof(buf) - 1] - p, " %s", argv[i]);
422 - msgn(1, _("Executing%s..."), buf);
425 - return pm_rpm_execrpm(cmd, argv, 0, 4) == 0;
428 -#endif /* HAVE_RPMCHECKSIG */
430 extern int pm_rpm_verbose;
431 int pm_rpm_verify_signature(void *pm_rpm, const char *path, unsigned flags)
437 From dceacab14dec5f5f8a2cfeb426edee7191b0f578 Mon Sep 17 00:00:00 2001
438 From: Marcin Banasiak <marcin.banasiak@gmail.com>
439 Date: Fri, 31 Aug 2012 14:27:41 +0200
440 Subject: [PATCH 2/5] Fix build with rpm 5.4 (lp#1042200)
442 Currently poldek builds with rpm 5.4 and seems to work, but is not well
443 tested and some regressions may still occur.
445 pkgdir/dir/dir.c | 1 +
447 pm/rpm/misc.c | 17 +++++++++++++++--
448 pm/rpm/pm_rpm.h | 22 ++++++++++++++++------
449 pm/rpm/rpm_pkg_ld.c | 1 -
450 pm/rpm/rpmdb_it.c | 4 ++--
451 pm/rpm/rpmhdr.c | 15 +++++++++++----
452 pm/rpm/rpmvercmp.c | 29 +++++++++++++++++++++++++++--
453 pm/rpm/signature5.c | 6 +++---
454 9 files changed, 75 insertions(+), 24 deletions(-)
456 diff --git a/pkgdir/dir/dir.c b/pkgdir/dir/dir.c
457 index cfe16cb..69d9eef 100644
458 --- a/pkgdir/dir/dir.c
459 +++ b/pkgdir/dir/dir.c
468 diff --git a/pkgroup.c b/pkgroup.c
469 index 21b29c5..62f124e 100644
473 the Free Software Foundation (see file COPYING for details).
485 #include <trurl/trurl.h>
486 -#include <rpm/rpmlib.h>
488 #define ENABLE_TRACE 0
490 diff --git a/pm/rpm/misc.c b/pm/rpm/misc.c
491 index 613ac1b..89ef808 100644
499 #include <time.h> /* rpmts.h with defined _RPMTS_INTERNAL needs ctime() */
501 #include <trurl/nassert.h>
502 #include <trurl/nstr.h>
504 -#include <rpm/rpmlib.h>
506 +# include <rpm/rpmtypes.h>
507 +# include <rpm/rpmtag.h>
508 +# include <rpm/rpmio.h>
510 +# include <rpm/rpmlib.h>
512 #include <rpm/rpmte.h>
514 # define _RPMPRCO_INTERNAL
515 # include <rpm/rpmds.h>
517 -#define _RPMTS_INTERNAL
518 +//#define _RPMTS_INTERNAL
519 #include <rpm/rpmts.h>
522 @@ -224,6 +231,8 @@ static int rpmioaccess_satisfies(const struct capreq *req)
528 static int rpmdiskspace_satisfies(const struct capreq *req)
530 const char *name = NULL;
531 @@ -307,6 +316,8 @@ static int rpmdiskspace_satisfies(const struct capreq *req)
538 int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
540 @@ -320,8 +331,10 @@ int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
541 if (rpmioaccess_satisfies(req))
545 if (rpmdiskspace_satisfies(req))
549 if (pm->caps == NULL)
550 if ((pm->caps = load_internal_caps(pm_rpm)) == NULL)
551 diff --git a/pm/rpm/pm_rpm.h b/pm/rpm/pm_rpm.h
552 index 8c6a179..2494bf0 100644
553 --- a/pm/rpm/pm_rpm.h
554 +++ b/pm/rpm/pm_rpm.h
556 #include <sys/time.h> /* timeval */
558 #define _RPMPRCO_INTERNAL 1 /* see pm_rpmdsSysinfo */
559 -#include <rpm/rpmlib.h>
562 +# include <rpm/rpmtypes.h>
563 +# include <rpm/rpmiotypes.h>
564 +# include <rpm/rpmtag.h>
565 +# include <rpm/pkgio.h>
567 +# include <rpm/rpmlib.h>
568 +# include <rpm/rpmurl.h>
569 +#endif /* HAVE_RPM_5 */
571 #ifdef HAVE_RPM_RPMCB_H
572 # include <rpm/rpmcb.h>
576 -# include <rpm/rpmtypes.h>
580 # include <rpm/rpmds.h>
583 # include <rpm/rpmdb.h>
586 -#include <rpm/rpmurl.h>
587 #include <rpm/rpmmacro.h>
589 #ifdef RPM_MAJOR_VERSION
591 # if PM_RPMVER(RPM_FORMAT_VERSION,RPM_MAJOR_VERSION,RPM_MINOR_VERSION) >= PM_RPMVER(5,0,0)
592 # define HAVE_RPM_VERSION_GE_5 1
595 +# include <rpm/rpmversion.h>
596 +# if defined(RPMLIB_VERSION) && RPMLIB_VERSION >= RPMLIB_VERSION_ENCODE(5,0,r,0,0,_)
597 +# define HAVE_RPM_VERSION_GE_4_4_8 1
598 +# define HAVE_RPM_VERSION_GE_5 1
603 diff --git a/pm/rpm/rpm_pkg_ld.c b/pm/rpm/rpm_pkg_ld.c
604 index dbed6f6..8423a62 100644
605 --- a/pm/rpm/rpm_pkg_ld.c
606 +++ b/pm/rpm/rpm_pkg_ld.c
609 #ifdef HAVE_RPM_RPMEVR_H
610 # define _RPMEVR_INTERNAL 1
611 -# include <rpm/rpmevr.h>
615 diff --git a/pm/rpm/rpmdb_it.c b/pm/rpm/rpmdb_it.c
616 index 37c7ef2..059db46 100644
617 --- a/pm/rpm/rpmdb_it.c
618 +++ b/pm/rpm/rpmdb_it.c
619 @@ -101,9 +101,9 @@ static
620 void rpmdb_it_destroy(struct rpmdb_it *it)
623 - rpmdbFreeIterator(it->mi);
627 + rpmdbFreeIterator(it->mi);
628 #endif /* HAVE_RPMMI */
630 it->dbrec.hdr = NULL;
631 diff --git a/pm/rpm/rpmhdr.c b/pm/rpm/rpmhdr.c
632 index 360a6d5..5989553 100644
633 --- a/pm/rpm/rpmhdr.c
634 +++ b/pm/rpm/rpmhdr.c
638 #if defined(HAVE_RPM_4_0_4) || defined(HAVE_RPM_VERSION_GE_4_4_8) /* missing prototypes in public headers */
640 int headerGetRawEntry(Header h, int_32 tag,
641 /*@null@*/ /*@out@*/ hTYP_t type,
642 /*@null@*/ /*@out@*/ hPTR_t * p,
643 /*@null@*/ /*@out@*/ hCNT_t c);
644 char ** headerGetLangs(Header h);
649 int pm_rpmhdr_get_string(Header h, int32_t tag, char *value, int size)
650 @@ -122,8 +124,9 @@ int pm_rpmhdr_get_raw_entry(Header h, int32_t tag, void *buf, int32_t *cnt)
655 - if (tag == RPMTAG_GROUP && type == RPM_STRING_TYPE) { /* build by old rpm */
658 + if (tag == RPMTAG_GROUP && type == RPM_STRING_TYPE) { // build by old rpm
662 @@ -133,7 +136,8 @@ int pm_rpmhdr_get_raw_entry(Header h, int32_t tag, void *buf, int32_t *cnt)
669 DBGF("%d type=%d, cnt=%d\n", tag, type, *cnt);
672 @@ -147,7 +151,10 @@ int pm_rpmhdr_loadfdt(FD_t fdt, Header *hdr, const char *path)
675 rpmts ts = rpmtsCreate();
676 - rpmtsSetVSFlags(ts, _RPMVSF_NODIGESTS | _RPMVSF_NOSIGNATURES);
677 + rpmtsSetVSFlags(ts, RPMVSF_NOSHA1HEADER | RPMVSF_NOMD5HEADER |
678 + RPMVSF_NOSHA1 | RPMVSF_NOMD5 |
679 + RPMVSF_NODSAHEADER | RPMVSF_NORSAHEADER |
680 + RPMVSF_NODSA | RPMVSF_NODSA);
681 rpmrc = rpmReadPackageFile(ts, fdt, path, hdr);
683 case RPMRC_NOTTRUSTED:
684 diff --git a/pm/rpm/rpmvercmp.c b/pm/rpm/rpmvercmp.c
685 index c40d903..968489a 100644
686 --- a/pm/rpm/rpmvercmp.c
687 +++ b/pm/rpm/rpmvercmp.c
690 + Copyright (C) 2000 - 2008 Pawel A. Gajda <mis@pld-linux.org>
691 + Copyright (C) 2010 - 2012 Marcin Banasiak <marcin.banasiak@gmail.com>
693 + This program is free software; you can redistribute it and/or modify
694 + it under the terms of the GNU General Public License, version 2 as
695 + published by the Free Software Foundation (see file COPYING for details).
697 + You should have received a copy of the GNU General Public License along
698 + with this program; if not, write to the Free Software Foundation, Inc.,
699 + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
711 +# include <rpm/rpmtag.h>
714 #define _RPMEVR_INTERNAL
715 #include <rpm/rpmevr.h>
718 static void parse(const char *evrstr, EVR_t evr)
720 rpmEVRparse(evrstr, evr);
721 @@ -20,6 +39,7 @@ static void parse(const char *evrstr, EVR_t evr)
727 int main(int argc, char *argv[])
729 @@ -43,10 +63,15 @@ int main(int argc, char *argv[])
731 evr1 = malloc(sizeof(struct EVR_s));
732 evr2 = malloc(sizeof(struct EVR_s));
736 + rpmEVRparse(v1, evr1);
737 + rpmEVRparse(v2, evr2);
744 cmprc = rpmEVRcompare(evr1, evr2);
746 printf("%s %s %s\n", v1, cmprc == 0 ? "==" : cmprc > 0 ? ">" : "<", v2);
747 diff --git a/pm/rpm/signature5.c b/pm/rpm/signature5.c
748 index e954fa5..ac1f9e4 100644
749 --- a/pm/rpm/signature5.c
750 +++ b/pm/rpm/signature5.c
755 -#ifndef HAVE_RPMPKGREAD /* rpm 5.x */
756 +#ifndef HAVE_RPM_5 /* rpm 5.x */
757 # error "not rpm 5.x"
761 #include <sys/stat.h>
764 +#include <rpm/rpmtypes.h>
765 +#include <rpm/rpmtag.h>
766 #include <rpm/rpmcb.h>
767 -#include <rpm/rpmlib.h>
768 #include <rpm/rpmio.h>
769 -#include <rpm/rpmurl.h>
770 #include <rpm/rpmmacro.h>
772 #include <rpm/rpmts.h>
777 From 9e4fe82da2df9b43b22a2bf36f2da69bb3238e87 Mon Sep 17 00:00:00 2001
778 From: Marcin Banasiak <marcin.banasiak@gmail.com>
779 Date: Fri, 31 Aug 2012 14:44:09 +0200
780 Subject: [PATCH 3/5] Drop support for diskspace()
782 It was not a good idea to add support for diskspace() dependency in
783 poldek, which, I think, is designed for BuildRequires in spec files.
784 Package install size can be measured using RPMTAG_SIZE, so I see no
785 point in using diskspace() for this purpose.
787 pm/rpm/misc.c | 102 +---------------------------------------------------------
788 1 file changed, 1 insertion(+), 101 deletions(-)
790 diff --git a/pm/rpm/misc.c b/pm/rpm/misc.c
791 index 89ef808..8a5c1bf 100644
795 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
809 -#include <time.h> /* rpmts.h with defined _RPMTS_INTERNAL needs ctime() */
811 #include <trurl/nassert.h>
812 #include <trurl/nstr.h>
815 # include <rpm/rpmlib.h>
817 -#include <rpm/rpmte.h>
820 # define _RPMPRCO_INTERNAL
821 # include <rpm/rpmds.h>
823 -//#define _RPMTS_INTERNAL
824 -#include <rpm/rpmts.h>
828 @@ -231,94 +224,6 @@ static int rpmioaccess_satisfies(const struct capreq *req)
834 -static int rpmdiskspace_satisfies(const struct capreq *req)
836 - const char *name = NULL;
840 - name = capreq_name(req);
842 - if (strncmp(name, "diskspace(", sizeof("diskspace(")-1) == 0 &&
843 - (e = strchr(name, ')')) != NULL) {
844 - const char **fs = NULL;
845 - char path[PATH_MAX];
847 - rpmDiskSpaceInfo dsi = NULL;
848 - int nfs = 0, pathlen, longest = 0;
851 - s = strchr(name, '(');
852 - n_strncpy(path, s+1, e-s);
853 - pathlen = strlen(path);
855 - ts = rpmtsCreate();
857 - /* code copied from lib/depends.c */
859 - fs = ts->filesystems;
860 - nfs = ts->filesystemCount;
865 - for (i = 0; i < nfs; i++) {
866 - int fslen = strlen(fs[i]);
868 - if (fslen > pathlen)
871 - if (strncmp(fs[i], path, fslen))
874 - if (fslen > 1 && path[fslen] != '/' && path[fslen] != '\0')
877 - if (fslen < longest)
886 - long long needed = strtoll(capreq_ver(req), &end, 0);
890 - if (strchr("Gg", end[0]) && strchr("Bb", end[1]) && !end[2])
891 - needed *= 1024 * 1024 * 1024;
892 - if (strchr("Mm", end[0]) && strchr("Bb", end[1]) && !end[2])
893 - needed *= 1024 * 1024;
894 - if (strchr("Kk", end[0]) && strchr("Bb", end[1]) && !end[2])
897 - /* assume Mb if no units given */
898 - needed *= 1024 * 1024;
901 - needed = BLOCK_ROUND(needed, dsi->f_bsize);
902 - x = (dsi->f_bavail - needed);
904 - if ((req->cr_relflags & REL_LT) && x < 0)
906 - else if ((req->cr_relflags & REL_GT) && x > 0)
908 - else if ((req->cr_relflags & REL_EQ) && x == 0)
920 int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
922 struct pm_rpm *pm = pm_rpm;
923 @@ -331,11 +236,6 @@ int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
924 if (rpmioaccess_satisfies(req))
928 - if (rpmdiskspace_satisfies(req))
932 if (pm->caps == NULL)
933 if ((pm->caps = load_internal_caps(pm_rpm)) == NULL)
939 From ec43fec423b9e577d7b5698185fb3b993dab57ed Mon Sep 17 00:00:00 2001
940 From: Marcin Banasiak <marcin.banasiak@gmail.com>
941 Date: Fri, 31 Aug 2012 15:48:52 +0200
942 Subject: [PATCH 4/5] Adjust autogen.sh and make snap for git
945 Makefile.extra | 26 ++++++++++----------------
946 autogen.sh | 13 +++----------
947 2 files changed, 13 insertions(+), 26 deletions(-)
949 diff --git a/Makefile.extra b/Makefile.extra
950 index 2c97511..9debaa1 100644
956 PROJ_DIR=$(shell pwd)
959 - ./getlib.sh trurlib copy
960 - ./getlib.sh tndb copy
963 - ./getlib.sh trurlib link
964 - ./getlib.sh tndb link
966 + git submodule update
968 -tarball: copylibs dist removelibs
969 -tarball-bz2: copylibs dist-bzip2 removelibs
970 +tarball: copylibs dist
971 +tarball-bz2: copylibs dist-bzip2
973 rpm-package: tarball-bz2
974 rpmbuild -tb $(distdir).tar.bz2
975 @@ -50,21 +44,21 @@ backup:
981 -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
984 $(MAKE) -C . backup cparch=1 backupdir=/z
987 - @dts=`date +%Y%m%d.%H` && rm -rf $(PACKAGE)-cvs$$dts* && \
988 + @dts=`date +%Y%m%d.%H` && rm -rf $(PACKAGE)-git$$dts* && \
989 tar xpjf $(distdir).tar.bz2 && \
990 echo "$$dts" > $(distdir)/0_THIS_IS_SNAPSHOT && \
991 perl -pi -e "s/VERSION_STATUS=.+$$/VERSION_STATUS=\"snap$$dts\"/" $(distdir)/configure $(distdir)/configure.in; \
992 - mv -f $(distdir) $(PACKAGE)-$(VERSION)-cvs$$dts && \
993 - tar cpjf $(PACKAGE)-$(VERSION)-cvs$$dts.tar.bz2 $(PACKAGE)-$(VERSION)-cvs$$dts && \
994 - rm -rf $(PACKAGE)-$(VERSION)-cvs$$dts && \
995 - echo "$(PACKAGE)-$(VERSION)-cvs$$dts.tar.bz2"
996 + mv -f $(distdir) $(PACKAGE)-$(VERSION)-git$$dts && \
997 + tar cpjf $(PACKAGE)-$(VERSION)-git$$dts.tar.bz2 $(PACKAGE)-$(VERSION)-git$$dts && \
998 + rm -rf $(PACKAGE)-$(VERSION)-git$$dts && \
999 + echo "$(PACKAGE)-$(VERSION)-git$$dts.tar.bz2"
1001 snap-rpm-package: snap
1002 dts=`date +%Y%m%d.%H` && echo $$dts && ls -l $(PACKAGE)-$(VERSION)-cvs$$dts.tar.bz2 &&\
1003 diff --git a/autogen.sh b/autogen.sh
1004 index 6ec65b6..7248be0 100755
1011 if [ ! -f capreq.h ]; then
1013 @@ -19,16 +18,10 @@ runcmd () {
1016 CONFOPTS="--enable-maintainer-mode --enable-compile-warnings"
1019 -if [ -n "$1" -a "$1" = "makedist" ]; then
1020 - rm -f trurlib tndb
1024 CONFOPTS="$CONFOPTS $@"
1025 -runcmd ./getlib.sh trurlib $getlib_mode
1026 -runcmd ./getlib.sh tndb $getlib_mode
1028 +runcmd git submodule init
1029 +runcmd git submodule update
1031 # generate po/POTFILES.in
1032 make -f Makefile.extra POTFILES_in
1037 From c26ae4cfeb59d6529e8c8a0b545f88811ca14c58 Mon Sep 17 00:00:00 2001
1038 From: Marcin Banasiak <marcin.banasiak@gmail.com>
1039 Date: Fri, 31 Aug 2012 16:31:48 +0200
1040 Subject: [PATCH 5/5] rpm 5.x has RPMTAG_* in rpmtag.h
1043 configure.ac | 65 +++++++++++++++++++++++++++++++++++-------------------------
1044 1 file changed, 38 insertions(+), 27 deletions(-)
1046 diff --git a/configure.ac b/configure.ac
1047 index 5f14b64..1519149 100644
1050 @@ -197,21 +197,15 @@ AC_CHECK_HEADERS([sys/filio.h])
1052 dnl RH rpm needs this
1053 CPPFLAGS="-I/usr/include/rpm $CPPFLAGS"
1054 -AC_CHECK_HEADER([rpm/rpmdb.h],,AC_MSG_ERROR(["missing required rpmlib.h"]))
1056 -AC_CHECK_TYPE([rpmmi],
1057 - [AC_DEFINE([HAVE_RPMMI], 1, [rpm with database iterator])],
1059 - [[#include <rpm/rpmtypes.h>]])
1060 +AC_CHECK_HEADER([rpm/rpmdb.h], [], AC_MSG_ERROR(["missing required rpmdb.h"]))
1062 AC_MSG_CHECKING([for rpm 4.x])
1065 - [#include <rpm/rpmlib.h>
1066 - #ifdef RPMDBI_PACKAGES
1069 - ], is_rpm4=yes, is_rpm4=no)
1070 + [#include <rpm/rpmlib.h>
1071 + #ifdef RPMDBI_PACKAGES
1074 + ], is_rpm4=yes, is_rpm4=no)
1076 if test "${is_rpm4}." = "no." ; then
1078 @@ -242,17 +236,36 @@ else
1079 [ #include <rpm/rpmlib.h>
1080 ], have_tag_pubkeys=yes, have_tag_pubkeys=no)
1082 - if test "${have_tag_pubkeys}." = "yes." ; then
1083 - AC_DEFINE([HAVE_RPMTAG_PUBKEYS],1,["rpm with RPMTAG_PUBKEYS"])
1086 AC_EGREP_CPP(RPMTAG_SUGGESTS,
1087 [ #include <rpm/rpmlib.h>
1088 ], have_tag_suggests=yes, have_tag_suggests=no)
1091 - if test "${have_tag_suggests}." = "yes." ; then
1092 - AC_DEFINE([HAVE_RPMTAG_SUGGESTS],1,["rpm with RPMTAG_SUGGESTS support"])
1094 +AC_MSG_CHECKING([for rpm 5.x])
1096 +PKG_CHECK_EXISTS([rpm >= 5.0], [is_rpm5=yes], [is_rpm5=no])
1098 +if test "${is_rpm5}." = "yes."; then
1099 + AC_MSG_RESULT(yes)
1100 + AC_EGREP_CPP(RPMTAG_PUBKEYS,
1101 + [ #include <rpm/rpmtag.h>
1102 + ], have_tag_pubkeys=yes, have_tag_pubkeys=no)
1104 + AC_EGREP_CPP(RPMTAG_SUGGESTS,
1105 + [ #include <rpm/rpmtag.h>
1106 + ], have_tag_suggests=yes, have_tag_suggests=no)
1108 + AC_DEFINE([HAVE_RPM_5], [1], [])
1113 +if test "${have_tag_pubkeys}." = "yes." ; then
1114 + AC_DEFINE([HAVE_RPMTAG_PUBKEYS], 1, [rpm with RPMTAG_PUBKEYS])
1117 +if test "${have_tag_suggests}." = "yes." ; then
1118 + AC_DEFINE([HAVE_RPMTAG_SUGGESTS], 1, [rpm with RPMTAG_SUGGESTS support])
1121 dnl Checks for libraries.
1122 @@ -361,22 +374,20 @@ AC_CHECK_FUNCS(_rpmvercmp)
1124 AC_CHECK_HEADERS([rpm/rpmevr.h])
1128 dnl fnpyKey provider
1129 AC_CHECK_HEADERS([rpm/rpmcb.h])
1130 AC_CHECK_FUNCS(rpmpkgRead)
1131 -AC_MSG_CHECKING([for rpm 5.x])
1132 -if test "$ac_cv_func_rpmpkgRead." != "yes."; then
1135 - AC_DEFINE([HAVE_RPM_5], [1], [])
1136 - AC_MSG_RESULT(yes)
1139 AC_CHECK_FUNCS(headerNVR) # removed since 5.0
1140 AC_CHECK_FUNCS(headerNEVRA)
1141 AC_CHECK_FUNCS(rpmErrorString)
1143 +AC_CHECK_TYPE([rpmmi],
1144 + [AC_DEFINE([HAVE_RPMMI], 1, [rpm with database iterator])],
1146 + [[#include <rpm/rpmtypes.h>]])
1148 dnl - removed enum (not macro) HEADER_MAGIC_YES
1149 if test "${is_rpm4}." = "yes." ; then
1150 AC_EGREP_CPP(HEADER_MAGIC_YES,