From e0e0a755b917d358d38003a3da2f46d83fb70265 Mon Sep 17 00:00:00 2001 From: jbj Date: Sun, 19 Sep 1999 15:27:37 +0000 Subject: [PATCH] When comparing EVR with missing epoch, package with epoch is considered newer. Free providesEVR from added package index. python: shared module linked correctly. CVS patchset: 3305 CVS date: 1999/09/19 15:27:37 --- lib/depends.c | 9 ++++++++- lib/depends.h | 4 ++-- po/rpm.pot | 14 +++++++------- python/Makefile.am | 11 +++++++---- python/Makefile.in | 22 +++++++++++----------- python/rpmmodule.c | 24 +++++++++++++++++++++++- 6 files changed, 58 insertions(+), 26 deletions(-) diff --git a/lib/depends.c b/lib/depends.c index 485755e..2fd44ea 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -106,6 +106,8 @@ static void alFree(/*@only@*/struct availableList * al) for (i = 0; i < al->size; i++) { if (al->list[i].provides) free(al->list[i].provides); + if (al->list[i].providesEVR) + free(al->list[i].providesEVR); if (al->list[i].files) free(al->list[i].files); headerFree(al->list[i].h); @@ -333,7 +335,12 @@ static int rangesOverlap(const char *AName, const char *AEVR, int AFlags, parseEVR(bEVR, &bE, &bV, &bR); /* Compare {A,B} [epoch:]version[-release] */ - sense = ((aE && *aE && bE && *bE) ? rpmvercmp(aE, bE) : 0); + if (aE && *aE && bE && *bE) + sense = rpmvercmp(aE, bE); + else if (aE && *aE) + sense = 1; + else if (bE && *bE) + sense = -1; if (sense == 0) { sense = rpmvercmp(aV, bV); if (sense == 0 && aR && *aR && bR && *bR) { diff --git a/lib/depends.h b/lib/depends.h index 1f23275..786f4f9 100644 --- a/lib/depends.h +++ b/lib/depends.h @@ -14,9 +14,9 @@ struct availablePackage { /*@dependent@*/ const char * release; /*@dependent@*/ int_32 *epoch; int providesCount, filesCount; - /*@owned@*/ const void * key; + /*@dependent@*/ const void * key; rpmRelocation * relocs; - /*@owned@*/ FD_t fd; + /*@dependent@*/ FD_t fd; } ; enum indexEntryType { IET_NAME, IET_PROVIDES, IET_FILE }; diff --git a/po/rpm.pot b/po/rpm.pot index 9427886..f826719 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-09-18 20:22-0400\n" +"POT-Creation-Date: 1999-09-19 11:24-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1972,33 +1972,33 @@ msgstr "" msgid "error removing record %s into %s" msgstr "" -#: ../lib/depends.c:448 +#: ../lib/depends.c:455 msgid "dbrecMatchesDepFlags() failed to read header" msgstr "" -#: ../lib/depends.c:715 +#: ../lib/depends.c:722 #, c-format msgid "dependencies: looking for %s\n" msgstr "" #. requirements are not satisfied. -#: ../lib/depends.c:854 +#: ../lib/depends.c:861 #, c-format msgid "package %s require not satisfied: %s\n" msgstr "" #. conflicts exist. -#: ../lib/depends.c:916 +#: ../lib/depends.c:923 #, c-format msgid "package %s conflicts: %s\n" msgstr "" -#: ../lib/depends.c:971 ../lib/depends.c:1278 +#: ../lib/depends.c:978 ../lib/depends.c:1285 #, c-format msgid "cannot read header at %d for dependency check" msgstr "" -#: ../lib/depends.c:1066 +#: ../lib/depends.c:1073 #, c-format msgid "loop in prerequisite chain: %s" msgstr "" diff --git a/python/Makefile.am b/python/Makefile.am index 90f361a..5010502 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -9,17 +9,20 @@ INCLUDES = \ -I/usr/include/python1.5 \ @INCPATH@ +EXTRA_DIST = hash.h upgrade.h mylibs= \ $(top_builddir)/lib/librpm.la \ $(top_builddir)/popt/libpopt.la +LDADD = + pythondir = $(prefix)/lib/python1.5/site-packages python_PROGRAMS = rpmmodule.so +rpmmodule_so_SOURCES = +rpmmodule_so_LDFLAGS = -lrpm -lpopt $(LIBS) -shared -Wl,-soname,rpmmodule.so noinst_LTLIBRARIES = librpmmodule.la -EXTRA_DIST = hash.h upgrade.h librpmmodule_la_SOURCES = rpmmodule.c hash.c upgrade.c -rpmmodule.so: rpmmodule.lo - gcc -shared rpmmodule.lo -lrpm -ldb1 @BZIP2LIB@ -L/usr/local/lib -lz -lc -o $@ - +rpmmodule.so: $(librpmmodule_la_OBJECTS) + $(CC) -o $@ $^ $(rpmmodule_so_LDFLAGS) diff --git a/python/Makefile.in b/python/Makefile.in index 32e08b0..534c9a5 100644 --- a/python/Makefile.in +++ b/python/Makefile.in @@ -71,7 +71,6 @@ AS = @AS@ AWK = @AWK@ BUILD_RPMCONVERT = @BUILD_RPMCONVERT@ BZIP2BIN = @BZIP2BIN@ -BZIP2LIB = @BZIP2LIB@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ @@ -150,14 +149,18 @@ AUTOMAKE_OPTIONS = 1.4 foreign INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/popt -I/usr/include/python1.5 @INCPATH@ +EXTRA_DIST = hash.h upgrade.h mylibs = $(top_builddir)/lib/librpm.la $(top_builddir)/popt/libpopt.la +LDADD = + pythondir = $(prefix)/lib/python1.5/site-packages python_PROGRAMS = rpmmodule.so +rpmmodule_so_SOURCES = +rpmmodule_so_LDFLAGS = -lrpm -lpopt $(LIBS) -shared -Wl,-soname,rpmmodule.so noinst_LTLIBRARIES = librpmmodule.la -EXTRA_DIST = hash.h upgrade.h librpmmodule_la_SOURCES = rpmmodule.c hash.c upgrade.c mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h @@ -173,11 +176,9 @@ librpmmodule_la_LIBADD = librpmmodule_la_OBJECTS = rpmmodule.lo hash.lo upgrade.lo PROGRAMS = $(python_PROGRAMS) -rpmmodule_so_SOURCES = rpmmodule.so.c -rpmmodule_so_OBJECTS = rpmmodule.so.o +rpmmodule_so_OBJECTS = rpmmodule_so_LDADD = $(LDADD) rpmmodule_so_DEPENDENCIES = -rpmmodule_so_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -190,10 +191,9 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best -DEP_FILES = .deps/hash.P .deps/rpmmodule.P .deps/rpmmodule.so.P \ -.deps/upgrade.P -SOURCES = $(librpmmodule_la_SOURCES) rpmmodule.so.c -OBJECTS = $(librpmmodule_la_OBJECTS) rpmmodule.so.o +DEP_FILES = .deps/hash.P .deps/rpmmodule.P .deps/upgrade.P +SOURCES = $(librpmmodule_la_SOURCES) $(rpmmodule_so_SOURCES) +OBJECTS = $(librpmmodule_la_OBJECTS) $(rpmmodule_so_OBJECTS) all: all-redirect .SUFFIXES: @@ -439,8 +439,8 @@ distclean-generic clean-generic maintainer-clean-generic clean \ mostlyclean distclean maintainer-clean -rpmmodule.so: rpmmodule.lo - gcc -shared rpmmodule.lo -lrpm -ldb1 @BZIP2LIB@ -L/usr/local/lib -lz -lc -o $@ +rpmmodule.so: $(librpmmodule_la_OBJECTS) + $(CC) -o $@ $^ $(rpmmodule_so_LDFLAGS) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/python/rpmmodule.c b/python/rpmmodule.c index 640b72e..b45ac3a 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -309,6 +309,27 @@ void initrpm(void) { PyInt_FromLong(RPMCALLBACK_UNINST_START)); PyDict_SetItemString(d, "RPMCALLBACK_UNINST_STOP", PyInt_FromLong(RPMCALLBACK_UNINST_STOP)); + + PyDict_SetItemString(d, "RPMPROB_BADARCH", + PyInt_FromLong(RPMPROB_BADARCH)); + PyDict_SetItemString(d, "RPMPROB_BADOS", + PyInt_FromLong(RPMPROB_BADOS)); + PyDict_SetItemString(d, "RPMPROB_PKG_INSTALLED", + PyInt_FromLong(RPMPROB_PKG_INSTALLED)); + PyDict_SetItemString(d, "RPMPROB_BADRELOCATE", + PyInt_FromLong(RPMPROB_BADRELOCATE)); + PyDict_SetItemString(d, "RPMPROB_REQUIRES", + PyInt_FromLong(RPMPROB_REQUIRES)); + PyDict_SetItemString(d, "RPMPROB_CONFLICT", + PyInt_FromLong(RPMPROB_CONFLICT)); + PyDict_SetItemString(d, "RPMPROB_NEW_FILE_CONFLICT", + PyInt_FromLong(RPMPROB_NEW_FILE_CONFLICT)); + PyDict_SetItemString(d, "RPMPROB_FILE_CONFLICT", + PyInt_FromLong(RPMPROB_FILE_CONFLICT)); + PyDict_SetItemString(d, "RPMPROB_OLDPACKAGE", + PyInt_FromLong(RPMPROB_OLDPACKAGE)); + PyDict_SetItemString(d, "RPMPROB_DISKSPACE", + PyInt_FromLong(RPMPROB_DISKSPACE)); } @@ -1385,7 +1406,8 @@ static PyObject * rpmtransRun(rpmtransObject * s, PyObject * args) { } if (rc < 0) { - return Py_BuildValue("i", rc); + list = PyList_New(0); + return list; } else if (!rc) { Py_INCREF(Py_None); return Py_None; -- 2.7.4