Merge rpm-4.0.4 changes.

CVS patchset: 1256
CVS date: 1997/01/01 01:30:08
This commit is contained in:
jbj 1997-01-01 01:30:08 +00:00
parent 931f010d2d
commit 7dbc73fec6
7 changed files with 3401 additions and 0 deletions

47
python/Makefile.am Normal file
View File

@ -0,0 +1,47 @@
# Makefile for rpm library.
AUTOMAKE_OPTIONS = 1.4 foreign
PYVER= @WITH_PYTHON_VERSION@
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/rpmdb \
-I$(top_srcdir)/rpmio \
-I$(top_srcdir)/beecrypt \
-I$(top_srcdir)/popt \
-I/usr/include/python${PYVER} \
@INCPATH@
EXTRA_DIST = db-py.h hash.h header-py.h upgrade.h
mylibs= \
$(top_builddir)/lib/librpm.la \
$(top_builddir)/rpmdb/librpmdb.la \
$(top_builddir)/rpmio/librpmio.la \
$(top_builddir)/popt/libpopt.la
LDADD =
pythondir = $(prefix)/lib/python${PYVER}/site-packages
python_PROGRAMS = rpmmodule.so poptmodule.so
rpmmodule_so_SOURCES =
rpmmodule_so_LDFLAGS = $(mylibs) $(LIBS) -shared -Wl,-soname,rpmmodule.so
poptmodule_so_SOURCES = poptmodule.c
poptmodule_so_LDFLAGS = $(mylibs) $(LIBS) -shared -Wl,-soname,poptmodule.so
noinst_LTLIBRARIES = librpmmodule.la
librpmmodule_la_SOURCES = rpmmodule.c hash.c upgrade.c header-py.c db-py.c
rpmmodule.so$(EXEEXT): $(librpmmodule_la_OBJECTS)
$(LINK) -o $@ $(librpmmodule_la_OBJECTS) $(rpmmodule_so_LDFLAGS)
poptmodule.so$(EXEEXT): $(poptmodule_so_OBJECTS)
$(LINK) -o $@ $(poptmodule_so_OBJECTS) $(poptmodule_so_LDFLAGS)
.PHONY: lclint
lclint:
lclint $(DEFS) $(INCLUDES) $(librpmmodule_la_SOURCES)

509
python/Makefile.in Normal file
View File

@ -0,0 +1,509 @@
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile for rpm library.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_alias = @build_alias@
build_triplet = @build@
host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AWK = @AWK@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
BUILD_RPMNLSTOOLS = @BUILD_RPMNLSTOOLS@
BZIP2BIN = @BZIP2BIN@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CXX = @CXX@
DATADIRNAME = @DATADIRNAME@
DBLIBOBJS = @DBLIBOBJS@
DBLIBSRCS = @DBLIBSRCS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
FINDPROVIDES = @FINDPROVIDES@
FINDREQUIRES = @FINDREQUIRES@
FIXPERMS = @FIXPERMS@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GMSGFMT = @GMSGFMT@
GZIPBIN = @GZIPBIN@
HAVE_LIB = @HAVE_LIB@
INCPATH = @INCPATH@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLBISON = @INTLBISON@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
LDFLAGS_STATIC = @LDFLAGS_STATIC@
LIB = @LIB@
LIBDIR = @LIBDIR@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBMISC = @LIBMISC@
LIBOBJS = @LIBOBJS@
LIBRPMALIAS_FILENAME = @LIBRPMALIAS_FILENAME@
LIBRPMRC_FILENAME = @LIBRPMRC_FILENAME@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LOCALEDIR = @LOCALEDIR@
LTLIB = @LTLIB@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
MACROFILES = @MACROFILES@
MKDIR = @MKDIR@
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PGPBIN = @PGPBIN@
POSUB = @POSUB@
RANLIB = @RANLIB@
ROOT_GROUP = @ROOT_GROUP@
RPM = @RPM@
RPMCANONARCH = @RPMCANONARCH@
RPMCANONOS = @RPMCANONOS@
RPMCANONVENDOR = @RPMCANONVENDOR@
RPMCONFIGDIR = @RPMCONFIGDIR@
RPMGID = @RPMGID@
RPMGROUP = @RPMGROUP@
RPMUID = @RPMUID@
RPMUSER = @RPMUSER@
STRIP = @STRIP@
SYSCONFIGDIR = @SYSCONFIGDIR@
U = @U@
UNZIPBIN = @UNZIPBIN@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WITH_APIDOCS = @WITH_APIDOCS@
WITH_APIDOCS_TARGET = @WITH_APIDOCS_TARGET@
WITH_BZIP2 = @WITH_BZIP2@
WITH_DB_SUBDIR = @WITH_DB_SUBDIR@
WITH_INTERNAL_DB = @WITH_INTERNAL_DB@
WITH_PYTHON_SUBDIR = @WITH_PYTHON_SUBDIR@
WITH_PYTHON_SUBPACKAGE = @WITH_PYTHON_SUBPACKAGE@
WITH_PYTHON_VERSION = @WITH_PYTHON_VERSION@
WITH_ZLIB_INCLUDE = @WITH_ZLIB_INCLUDE@
WITH_ZLIB_LIB = @WITH_ZLIB_LIB@
WITH_ZLIB_SUBDIR = @WITH_ZLIB_SUBDIR@
__CAT = @__CAT@
__CHGRP = @__CHGRP@
__CHGRP_RHF = @__CHGRP_RHF@
__CHMOD = @__CHMOD@
__CHOWN = @__CHOWN@
__CHOWN_RHF = @__CHOWN_RHF@
__CP = @__CP@
__CPIO = @__CPIO@
__DOXYGEN = @__DOXYGEN@
__FILE = @__FILE@
__GPG = @__GPG@
__GREP = @__GREP@
__ID = @__ID@
__ID_U = @__ID_U@
__INSTALL = @__INSTALL@
__LD = @__LD@
__MAKE = @__MAKE@
__MKDIR = @__MKDIR@
__MV = @__MV@
__NM = @__NM@
__OBJCOPY = @__OBJCOPY@
__OBJDUMP = @__OBJDUMP@
__PATCH = @__PATCH@
__PERL = @__PERL@
__PYTHON = @__PYTHON@
__RM = @__RM@
__RSH = @__RSH@
__SED = @__SED@
__SSH = @__SSH@
__STRIP = @__STRIP@
__TAR = @__TAR@
am__include = @am__include@
am__quote = @am__quote@
install_sh = @install_sh@
libdb3 = @libdb3@
libdb3a = @libdb3a@
testdir = @testdir@
tmpdir = @tmpdir@
varprefix = @varprefix@
AUTOMAKE_OPTIONS = 1.4 foreign
PYVER = @WITH_PYTHON_VERSION@
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/rpmdb \
-I$(top_srcdir)/rpmio \
-I$(top_srcdir)/beecrypt \
-I$(top_srcdir)/popt \
-I/usr/include/python${PYVER} \
@INCPATH@
EXTRA_DIST = db-py.h hash.h header-py.h upgrade.h
mylibs = \
$(top_builddir)/lib/librpm.la \
$(top_builddir)/rpmdb/librpmdb.la \
$(top_builddir)/rpmio/librpmio.la \
$(top_builddir)/popt/libpopt.la
LDADD =
pythondir = $(prefix)/lib/python${PYVER}/site-packages
python_PROGRAMS = rpmmodule.so poptmodule.so
rpmmodule_so_SOURCES =
rpmmodule_so_LDFLAGS = $(mylibs) $(LIBS) -shared -Wl,-soname,rpmmodule.so
poptmodule_so_SOURCES = poptmodule.c
poptmodule_so_LDFLAGS = $(mylibs) $(LIBS) -shared -Wl,-soname,poptmodule.so
noinst_LTLIBRARIES = librpmmodule.la
librpmmodule_la_SOURCES = rpmmodule.c hash.c upgrade.c header-py.c db-py.c
subdir = python
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
librpmmodule_la_LDFLAGS =
librpmmodule_la_LIBADD =
am_librpmmodule_la_OBJECTS = rpmmodule.lo hash.lo upgrade.lo \
header-py.lo db-py.lo
librpmmodule_la_OBJECTS = $(am_librpmmodule_la_OBJECTS)
python_PROGRAMS = rpmmodule.so$(EXEEXT) poptmodule.so$(EXEEXT)
PROGRAMS = $(python_PROGRAMS)
am_poptmodule_so_OBJECTS = poptmodule.$(OBJEXT)
poptmodule_so_OBJECTS = $(am_poptmodule_so_OBJECTS)
poptmodule_so_LDADD = $(LDADD)
poptmodule_so_DEPENDENCIES =
am_rpmmodule_so_OBJECTS =
rpmmodule_so_OBJECTS = $(am_rpmmodule_so_OBJECTS)
rpmmodule_so_LDADD = $(LDADD)
rpmmodule_so_DEPENDENCIES =
DEFS = @DEFS@
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/db-py.Plo $(DEPDIR)/hash.Plo \
@AMDEP_TRUE@ $(DEPDIR)/header-py.Plo $(DEPDIR)/poptmodule.Po \
@AMDEP_TRUE@ $(DEPDIR)/rpmmodule.Plo $(DEPDIR)/upgrade.Plo
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(librpmmodule_la_SOURCES) $(poptmodule_so_SOURCES) \
$(rpmmodule_so_SOURCES)
DIST_COMMON = ChangeLog Makefile.am Makefile.in
SOURCES = $(librpmmodule_la_SOURCES) $(poptmodule_so_SOURCES) $(rpmmodule_so_SOURCES)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign python/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && \
CONFIG_HEADERS= CONFIG_LINKS= \
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
librpmmodule.la: $(librpmmodule_la_OBJECTS) $(librpmmodule_la_DEPENDENCIES)
$(LINK) $(librpmmodule_la_LDFLAGS) $(librpmmodule_la_OBJECTS) $(librpmmodule_la_LIBADD) $(LIBS)
install-pythonPROGRAMS: $(python_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(pythondir)
@list='$(python_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pythondir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pythondir)/$$f; \
else :; fi; \
done
uninstall-pythonPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(python_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(pythondir)/$$f"; \
rm -f $(DESTDIR)$(pythondir)/$$f; \
done
clean-pythonPROGRAMS:
-test -z "$(python_PROGRAMS)" || rm -f $(python_PROGRAMS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/db-py.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/hash.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/header-py.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/poptmodule.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/rpmmodule.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/upgrade.Plo@am__quote@
distclean-depend:
-rm -rf $(DEPDIR)
.c.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
.c.obj:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `cygpath -w $<`
.c.lo:
@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
CCDEPMODE = @CCDEPMODE@
uninstall-info-am:
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
GTAGS:
here=`CDPATH=: && cd $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
$(mkinstalldirs) "$(distdir)/$$dir"; \
fi; \
if test -d $$d/$$file; then \
cp -pR $$d/$$file $(distdir) \
|| exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(pythondir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
clean-pythonPROGRAMS mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-pythonPROGRAMS
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
uninstall-am: uninstall-info-am uninstall-pythonPROGRAMS
.PHONY: GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES clean-pythonPROGRAMS \
distclean distclean-compile distclean-depend distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-pythonPROGRAMS install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool tags uninstall \
uninstall-am uninstall-info-am uninstall-pythonPROGRAMS
rpmmodule.so$(EXEEXT): $(librpmmodule_la_OBJECTS)
$(LINK) -o $@ $(librpmmodule_la_OBJECTS) $(rpmmodule_so_LDFLAGS)
poptmodule.so$(EXEEXT): $(poptmodule_so_OBJECTS)
$(LINK) -o $@ $(poptmodule_so_OBJECTS) $(poptmodule_so_LDFLAGS)
.PHONY: lclint
lclint:
lclint $(DEFS) $(INCLUDES) $(librpmmodule_la_SOURCES)
# 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.
.NOEXPORT:

499
python/db-py.c Normal file
View File

@ -0,0 +1,499 @@
/** \ingroup python
* \file python/db-py.c
*/
#include <fcntl.h>
#include <unistd.h>
#include "Python.h"
#include "rpmio_internal.h"
#include "rpmcli.h" /* XXX for rpmCheckSig */
#include "misc.h"
#include "header_internal.h"
#include "upgrade.h"
#include "db-py.h"
#include "header-py.h"
/** \ingroup python
*/
typedef struct rpmdbMIObject_s rpmdbMIObject;
/** \ingroup python
* \class rpmdbMatchIterator
* \brief A python rpmdbMatchIterator object represents the result of an RPM
* database query.
*/
/** \ingroup python
* \name Class: rpmdbMatchIterator
*/
/*@{*/
/** \ingroup python
*/
struct rpmdbMIObject_s {
PyObject_HEAD;
rpmdbObject *db;
rpmdbMatchIterator mi;
} ;
/** \ingroup python
*/
static PyObject *
rpmdbMINext(rpmdbMIObject * s, PyObject * args) {
/* XXX assume header? */
Header h;
hdrObject * ho;
if (!PyArg_ParseTuple (args, "")) return NULL;
h = rpmdbNextIterator(s->mi);
if (!h) {
Py_INCREF(Py_None);
return Py_None;
}
ho = createHeaderObject(h);
return (PyObject *) ho;
}
/** \ingroup python
*/
static PyObject *
rpmdbMIpattern(rpmdbMIObject * s, PyObject * args) {
PyObject *index = NULL;
int type;
char * pattern;
int tag;
if (!PyArg_ParseTuple(args, "Ois", &index, &type, &pattern))
return NULL;
if (index == NULL)
tag = 0;
else if ((tag = tagNumFromPyObject (index)) == -1) {
PyErr_SetString(PyExc_TypeError, "unknown tag type");
return NULL;
}
rpmdbSetIteratorRE(s->mi, tag, type, pattern);
Py_INCREF (Py_None);
return Py_None;
}
/** \ingroup python
*/
static struct PyMethodDef rpmdbMIMethods[] = {
{"next", (PyCFunction) rpmdbMINext, 1 },
{"pattern", (PyCFunction) rpmdbMIpattern, 1 },
{NULL, NULL} /* sentinel */
};
/** \ingroup python
*/
static PyObject * rpmdbMIGetAttr (rpmdbObject *s, char *name) {
return Py_FindMethod (rpmdbMIMethods, (PyObject *) s, name);
}
/** \ingroup python
*/
static void rpmdbMIDealloc(rpmdbMIObject * s) {
if (s && s->mi) {
rpmdbFreeIterator(s->mi);
}
Py_DECREF (s->db);
PyMem_DEL(s);
}
/** \ingroup python
*/
PyTypeObject rpmdbMIType = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
"rpmdbMatchIterator", /* tp_name */
sizeof(rpmdbMIObject), /* tp_size */
0, /* tp_itemsize */
(destructor) rpmdbMIDealloc, /* tp_dealloc */
0, /* tp_print */
(getattrfunc) rpmdbMIGetAttr, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
};
/*@}*/
/** \ingroup python
* \class rpmdb
* \brief A python rpmdb object represents an RPM database.
*
* Instances of the rpmdb object provide access to the records of a
* RPM database. The records are accessed by index number. To
* retrieve the header data in the RPM database, the rpmdb object is
* subscripted as you would access members of a list.
*
* The rpmdb class contains the following methods:
*
* - firstkey() Returns the index of the first record in the database.
* @deprecated Legacy, use rpmdbMatchIterator instead.
*
* - nextkey(index) Returns the index of the next record after "index" in the
* database.
* @param index current rpmdb location
* @deprecated Legacy, use rpmdbMatchIterator instead.
*
* - findbyfile(file) Returns a list of the indexes to records that own file
* "file".
* @param file absolute path to file
*
* - findbyname(name) Returns a list of the indexes to records for packages
* named "name".
* @param name package name
*
* - findbyprovides(dep) Returns a list of the indexes to records for packages
* that provide "dep".
* @param dep provided dependency string
*
* To obtain a rpmdb object, the opendb function in the rpm module
* must be called. The opendb function takes two optional arguments.
* The first optional argument is a boolean flag that specifies if the
* database is to be opened for read/write access or read-only access.
* The second argument specifies an alternate root directory for RPM
* to use.
*
* An example of opening a database and retrieving the first header in
* the database, then printing the name of the package that the header
* represents:
* \code
* import rpm
* rpmdb = rpm.opendb()
* index = rpmdb.firstkey()
* header = rpmdb[index]
* print header[rpm.RPMTAG_NAME]
* \endcode
* To print all of the packages in the database that match a package
* name, the code will look like this:
* \code
* import rpm
* rpmdb = rpm.opendb()
* indexes = rpmdb.findbyname("foo")
* for index in indexes:
* header = rpmdb[index]
* print "%s-%s-%s" % (header[rpm.RPMTAG_NAME],
* header[rpm.RPMTAG_VERSION],
* header[rpm.RPMTAG_RELEASE])
* \endcode
*/
/** \ingroup python
* \name Class: rpmdb
*/
/*@{*/
/**
*/
static PyObject * rpmdbFirst(rpmdbObject * s, PyObject * args) {
int first;
if (!PyArg_ParseTuple (args, "")) return NULL;
/* Acquire all offsets in one fell swoop. */
if (s->offsets == NULL || s->noffs <= 0) {
rpmdbMatchIterator mi;
Header h;
if (s->offsets)
free(s->offsets);
s->offsets = NULL;
s->noffs = 0;
mi = rpmdbInitIterator(s->db, RPMDBI_PACKAGES, NULL, 0);
while ((h = rpmdbNextIterator(mi)) != NULL) {
s->noffs++;
s->offsets = realloc(s->offsets, s->noffs * sizeof(s->offsets[0]));
s->offsets[s->noffs-1] = rpmdbGetIteratorOffset(mi);
}
rpmdbFreeIterator(mi);
}
s->offx = 0;
if (s->offsets != NULL && s->offx < s->noffs)
first = s->offsets[s->offx++];
else
first = 0;
if (!first) {
PyErr_SetString(pyrpmError, "cannot find first entry in database\n");
return NULL;
}
return Py_BuildValue("i", first);
}
/**
*/
static PyObject * rpmdbNext(rpmdbObject * s, PyObject * args) {
int where;
if (!PyArg_ParseTuple (args, "i", &where)) return NULL;
if (s->offsets == NULL || s->offx >= s->noffs) {
Py_INCREF(Py_None);
return Py_None;
}
where = s->offsets[s->offx++];
if (!where) {
Py_INCREF(Py_None);
return Py_None;
}
return Py_BuildValue("i", where);
}
/**
*/
static PyObject * handleDbResult(rpmdbMatchIterator mi) {
PyObject * list, *o;
list = PyList_New(0);
/* XXX FIXME: unnecessary header mallocs are side effect here */
if (mi != NULL) {
while (rpmdbNextIterator(mi)) {
PyList_Append(list, o=PyInt_FromLong(rpmdbGetIteratorOffset(mi)));
Py_DECREF(o);
}
rpmdbFreeIterator(mi);
}
return list;
}
/**
*/
static PyObject * rpmdbByFile(rpmdbObject * s, PyObject * args) {
char * str;
if (!PyArg_ParseTuple(args, "s", &str)) return NULL;
return handleDbResult(rpmdbInitIterator(s->db, RPMTAG_BASENAMES, str, 0));
}
/**
*/
static PyObject * rpmdbByName(rpmdbObject * s, PyObject * args) {
char * str;
if (!PyArg_ParseTuple(args, "s", &str)) return NULL;
return handleDbResult(rpmdbInitIterator(s->db, RPMTAG_NAME, str, 0));
}
/**
*/
static PyObject * rpmdbByProvides(rpmdbObject * s, PyObject * args) {
char * str;
if (!PyArg_ParseTuple(args, "s", &str)) return NULL;
return handleDbResult(rpmdbInitIterator(s->db, RPMTAG_PROVIDENAME, str, 0));
}
/**
*/
static rpmdbMIObject *
py_rpmdbInitIterator (rpmdbObject * s, PyObject * args) {
PyObject *index = NULL;
char *key = NULL;
int len = 0, tag = -1;
rpmdbMIObject * mio;
if (!PyArg_ParseTuple(args, "|Ozi", &index, &key, &len))
return NULL;
if (index == NULL)
tag = 0;
else if ((tag = tagNumFromPyObject (index)) == -1) {
PyErr_SetString(PyExc_TypeError, "unknown tag type");
return NULL;
}
mio = (rpmdbMIObject *) PyObject_NEW(rpmdbMIObject, &rpmdbMIType);
if (mio == NULL) {
PyErr_SetString(pyrpmError, "out of memory creating rpmdbMIObject");
return NULL;
}
mio->mi = rpmdbInitIterator(s->db, tag, key, len);
mio->db = s;
Py_INCREF (mio->db);
return mio;
}
/**
*/
static struct PyMethodDef rpmdbMethods[] = {
{"firstkey", (PyCFunction) rpmdbFirst, 1 },
{"nextkey", (PyCFunction) rpmdbNext, 1 },
{"findbyfile", (PyCFunction) rpmdbByFile, 1 },
{"findbyname", (PyCFunction) rpmdbByName, 1 },
{"findbyprovides", (PyCFunction) rpmdbByProvides, 1 },
{"match", (PyCFunction) py_rpmdbInitIterator, 1 },
{NULL, NULL} /* sentinel */
};
/**
*/
static PyObject * rpmdbGetAttr(rpmdbObject * s, char * name) {
return Py_FindMethod(rpmdbMethods, (PyObject * ) s, name);
}
/**
*/
static void rpmdbDealloc(rpmdbObject * s) {
if (s->offsets) {
free(s->offsets);
}
if (s->db) {
rpmdbClose(s->db);
}
PyMem_DEL(s);
}
#ifndef DYINGSOON /* XXX OK, when? */
/**
*/
static int
rpmdbLength(rpmdbObject * s) {
int count = 0;
{ rpmdbMatchIterator mi;
/* RPMDBI_PACKAGES */
mi = rpmdbInitIterator(s->db, RPMDBI_PACKAGES, NULL, 0);
while (rpmdbNextIterator(mi) != NULL)
count++;
rpmdbFreeIterator(mi);
}
return count;
}
/**
*/
static hdrObject *
rpmdbSubscript(rpmdbObject * s, PyObject * key) {
int offset;
hdrObject * ho;
Header h;
rpmdbMatchIterator mi;
if (!PyInt_Check(key)) {
PyErr_SetString(PyExc_TypeError, "integer expected");
return NULL;
}
offset = (int) PyInt_AsLong(key);
mi = rpmdbInitIterator(s->db, RPMDBI_PACKAGES, &offset, sizeof(offset));
if (!(h = rpmdbNextIterator(mi))) {
rpmdbFreeIterator(mi);
PyErr_SetString(pyrpmError, "cannot read rpmdb entry");
return NULL;
}
ho = createHeaderObject(h);
headerFree(h, NULL);
return ho;
}
/**
*/
static PyMappingMethods rpmdbAsMapping = {
(inquiry) rpmdbLength, /* mp_length */
(binaryfunc) rpmdbSubscript, /* mp_subscript */
(objobjargproc)0, /* mp_ass_subscript */
};
#endif
/**
*/
PyTypeObject rpmdbType = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
"rpmdb", /* tp_name */
sizeof(rpmdbObject), /* tp_size */
0, /* tp_itemsize */
(destructor) rpmdbDealloc, /* tp_dealloc */
0, /* tp_print */
(getattrfunc) rpmdbGetAttr, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
#ifndef DYINGSOON
&rpmdbAsMapping, /* tp_as_mapping */
#else
0,
#endif
};
rpmdb dbFromDb(rpmdbObject * db) {
return db->db;
}
/**
*/
rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) {
rpmdbObject * o;
char * root = "";
int forWrite = 0;
if (!PyArg_ParseTuple(args, "|is", &forWrite, &root)) return NULL;
o = PyObject_NEW(rpmdbObject, &rpmdbType);
o->db = NULL;
o->offx = 0;
o->noffs = 0;
o->offsets = NULL;
if (rpmdbOpen(root, &o->db, forWrite ? O_RDWR | O_CREAT: O_RDONLY, 0644)) {
char * errmsg = "cannot open database in %s";
char * errstr = NULL;
int errsize;
Py_DECREF(o);
/* PyErr_SetString should take varargs... */
errsize = strlen(errmsg) + *root == '\0' ? 15 /* "/var/lib/rpm" */ : strlen(root);
errstr = alloca(errsize);
snprintf(errstr, errsize, errmsg, *root == '\0' ? "/var/lib/rpm" : root);
PyErr_SetString(pyrpmError, errstr);
return NULL;
}
return o;
}
/**
*/
PyObject * rebuildDB (PyObject * self, PyObject * args) {
char * root = "";
if (!PyArg_ParseTuple(args, "s", &root)) return NULL;
return Py_BuildValue("i", rpmdbRebuild(root));
}
/*@}*/

29
python/db-py.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef RPMPYTHON_DB
#define RPMPYTHON_DB
/** \ingroup python
* \file python/db-py.h
*/
/** \ingroup python
*/
struct rpmdbObject_s {
PyObject_HEAD;
rpmdb db;
int offx;
int noffs;
int *offsets;
} ;
/** \ingroup python
*/
typedef struct rpmdbObject_s rpmdbObject;
extern PyTypeObject rpmdbType;
PyTypeObject rpmdbMIType;
rpmdb dbFromDb(rpmdbObject * db);
rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args);
PyObject * rebuildDB (PyObject * self, PyObject * args);
#endif

1116
python/header-py.c Normal file

File diff suppressed because it is too large Load Diff

31
python/header-py.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef RPMPYTHON_HEADER
#define RPMPYTHON_HEADER
/** \ingroup python
* \file python/header-py.h
*/
/** \ingroup python
*/
typedef struct hdrObject_s hdrObject;
extern PyTypeObject hdrType;
/** \ingroup python
*/
PyObject * pyrpmError;
hdrObject * createHeaderObject(Header h);
Header hdrGetHeader(hdrObject * h);
PyObject * labelCompare (PyObject * self, PyObject * args);
PyObject * versionCompare (PyObject * self, PyObject * args);
PyObject * rpmMergeHeadersFromFD(PyObject * self, PyObject * args);
int rpmMergeHeaders(PyObject * list, FD_t fd, int matchTag);
PyObject * rpmHeaderFromFile(PyObject * self, PyObject * args);
PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args);
PyObject * rpmReadHeaders (FD_t fd);
PyObject * rhnLoad(PyObject * self, PyObject * args);
PyObject * hdrLoad(PyObject * self, PyObject * args);
PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args);
long tagNumFromPyObject (PyObject *item);
#endif

1170
python/rpmmodule.c Normal file

File diff suppressed because it is too large Load Diff