From 87c15895a05f100b8a6eb26c17f8742f2b1b3df2 Mon Sep 17 00:00:00 2001 From: jbj Date: Sun, 13 May 2001 17:55:58 +0000 Subject: [PATCH] - add cron/logrotate scripts to save installed package filenames. CVS patchset: 4777 CVS date: 2001/05/13 17:55:58 --- CHANGES | 1 + Makefile.am | 12 ++++----- db3/.cvsignore | 3 +++ lib/psm.c | 3 +++ macros.in | 77 ++++++++++++++++++++++++++++++++++++++--------------- rpm.spec.in | 18 +++++++++++++ rpmdb/rpmdb.c | 9 ++++++- scripts/Makefile.am | 2 ++ 8 files changed, 96 insertions(+), 29 deletions(-) diff --git a/CHANGES b/CHANGES index 7b175b2..ee3a20d 100644 --- a/CHANGES +++ b/CHANGES @@ -55,6 +55,7 @@ - add DBI_WRITECURSOR to map to db3 flags with CDB database model. - add rpmdbSetIteratorRewrite to warn of pending lazy (re-)writes. - harden rpmdb iterators from damaged header instance segfaults. + - add cron/logrotate scripts to save installed package filenames. 4.0 -> 4.0.[12] - add doxygen and lclint annotations most everywhere. diff --git a/Makefile.am b/Makefile.am index 8d3978c..fedf5d5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -166,14 +166,14 @@ install-data-local: setperms: @for f in $(rpmbin_PROGRAMS) ; do\ $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(rpmbindir)/$$f ;\ - $(__CHMOD) u+s $(DESTDIR)$(rpmbindir)/$$f ;\ + $(__CHMOD) g+s $(DESTDIR)$(rpmbindir)/$$f ;\ done @for f in $(bin_PROGRAMS) ; do\ $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(bindir)/$$f ;\ done @for f in $(pkglib_PROGRAMS) ; do\ $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\ - $(__CHMOD) u+s $(DESTDIR)$(pkglibdir)/$$f ;\ + $(__CHMOD) g+s $(DESTDIR)$(pkglibdir)/$$f ;\ done @for f in $(pkglib_SCRIPTS) ; do\ $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\ @@ -185,13 +185,13 @@ setperms: -@$(__CHMOD) 0755 $(DESTDIR)$(varprefix)/lib/rpm/Desktop -@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.* -.PHONY: unsetuid -unsetuid: +.PHONY: unsetgid +unsetgid: @for f in $(rpmbin_PROGRAMS) ; do\ - $(__CHMOD) u-s $(DESTDIR)$(rpmbindir)/$$f ;\ + $(__CHMOD) g-s $(DESTDIR)$(rpmbindir)/$$f ;\ done @for f in $(pkglib_PROGRAMS) ; do\ - $(__CHMOD) u-s $(DESTDIR)$(pkglibdir)/$$f ;\ + $(__CHMOD) g-s $(DESTDIR)$(pkglibdir)/$$f ;\ done .PHONY: tar diff --git a/db3/.cvsignore b/db3/.cvsignore index 5e8a5f0..8a13c4f 100644 --- a/db3/.cvsignore +++ b/db3/.cvsignore @@ -5,6 +5,7 @@ Makefile.in .libs *.la *.lo +config.cache config.log db_config.h libtool @@ -12,6 +13,7 @@ config.status include.tcl db.h db_int.h +berkeley_db_svc db_archive db_checkpoint db_deadlock @@ -22,3 +24,4 @@ db_recover db_stat db_upgrade db_verify +db_lib_objs diff --git a/lib/psm.c b/lib/psm.c index 778a8e4..b2cb9df 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -1847,6 +1847,9 @@ assert(psm->mi == NULL); fi->h = rpmdbNextIterator(psm->mi); if (fi->h) fi->h = headerLink(fi->h); +else { +fprintf(stderr, "*** PSM_RDB_LOAD: header #%u not found\n", fi->record); +} psm->mi = rpmdbFreeIterator(psm->mi); rc = (fi->h ? RPMRC_OK : RPMRC_FAIL); break; diff --git a/macros.in b/macros.in index 36cb4d2..97180d5 100644 --- a/macros.in +++ b/macros.in @@ -1,7 +1,7 @@ #/*! \page config_macros Default configuration: /usr/lib/rpm/macros # \verbatim # -# $Id: macros.in,v 1.75 2001/05/09 22:58:56 jbj Exp $ +# $Id: macros.in,v 1.76 2001/05/13 17:55:58 jbj Exp $ # # This is a global RPM configuration file. All changes made here will # be lost when the rpm package is upgraded. Any per-system configuration @@ -278,60 +278,93 @@ %_dbapi_rebuild 3 # -# token Berkeley db flag or value -# ================================================= +# token works? Berkeley db flag or value +#================================================== +#---------------------- DBENV->open flags: +# create DB_CREATE +# joinenv DB_JOIN_ENV +# mpool DB_INIT_MPOOL +# cdb ~~~ DB_INIT_CDB +# txn ??? DB_INIT_TXN +# log ??? DB_INIT_LOG +# lock ??? DB_INIT_LOCK +# recover ??? DB_RECOVER +# recover_fatal ??? DB_RECOVER_FATAL +# private ~~~ DB_PRIVATE +# lockdown ??? DB_LOCKDOWN +# shared ~~~ DB_INIT_SYSTEM_MEM +# thread ??? DB_THREAD (useless w/o posix mutexes on linux) +#---------------------- DB->open flags: +# excl ??? DB_EXCL +# nommap ??? DB_NOMMAP +# rdonly DB_RDONLY +#---------------------- DB->open types: +# btree ~~~ DB_BTREE # hash DB_HASH -# btree DB_BTREE -# unknown DB_UNKNOWN +# recno ??? DB_RECNO +# queue ??? DB_QUEUE +# unknown ~~~ DB_UNKNOWN # # See the db3-devel package, or http://www.sleepycat.com for Berkeley db-3.x # documentation. # # Always on in rpm configuration: -# usecursors Should DB3 cursors be used in get/put/del ? -# lockdbfd Should the file be locked using fcntl shared/exclusive locks? +# usecursors (always on) Should DB3 cursors be used in get/put/del ? +# lockdbfd (always on Packages) Should fcnt;(2) locking be used ? # # Other tokens: # nofsync Should fsync(2) be done after every write? # temporaray Remove index when closing rpm database. # -# XXX This is what's coming down the pike ... -#%__dbi_other usedbenv create joinenv cdb mpool shared \ +# XXX Use a CDB model database for concurrent access (under development, +# cursor teardown with signals needs work, and much more.) +#%__dbi_other usedbenv create joinenv cdb mpool \ # mp_mmapsize=8Mb mp_size=512Kb usecursors +# XXX Use transactions and logs for rpmdb durability (no clue yet): +#%__dbi_other usedbenv create joinenv mpool txn log \ +# mp_mmapsize=8Mb mp_size=512Kb usecursors + +# XXX The "traditional" rpmdb shared/exclusive fcntl(2) lock on Packages: %__dbi_other usecursors +# Note: adding nofsync here speeds up --rebuilddb a lot. %__dbi_rebuild nofsync !log !txn !cdb %__dbi_transient %{__dbi_rebuild} temporary %__dbi_perms perms=0644 +# This is a colon (or white space) separated list of tokens for Berkeley +# dbi configuration. The configuration is conditioned on an internal +# %{_rpmdb_rebuild} switch to permit rebuilding with a different configuration. +# + +# +#--- Hash database configuration %__dbi_htconfig \ hash \ %{__dbi_other}\ %{__dbi_perms}\ %{nil} +%__dbi_htconfig_current %{__dbi_htconfig} +%__dbi_htconfig_rebuild %{__dbi_htconfig} %{__dbi_rebuild} + +%_dbi_htconfig \ + %{?_rpmdb_rebuild:%{__dbi_htconfig_rebuild}}\ + %{!?_rpmdb_rebuild:%{__dbi_htconfig_current}}\ +%{nil} + +# +#--- Btree database configuration %__dbi_btconfig \ btree bt_dup bt_dupsort\ %{__dbi_other}\ %{__dbi_perms}\ %{nil} -%__dbi_htconfig_current %{__dbi_htconfig} -%__dbi_htconfig_rebuild %{__dbi_htconfig} %{__dbi_rebuild} - %__dbi_btconfig_current %{__dbi_btconfig} %__dbi_btconfig_rebuild %{__dbi_btconfig} %{__dbi_rebuild} -# This is a colon (or white space) separated list of tokens for Berkeley -# dbi configuration. The configuration is conditioned on an internal -# %{_rpmdb_rebuild} switch to permit rebuilding with a different configuration. -# -%_dbi_htconfig \ - %{?_rpmdb_rebuild:%{__dbi_htconfig_rebuild}}\ - %{!?_rpmdb_rebuild:%{__dbi_htconfig_current}}\ -%{nil} - %_dbi_btconfig \ %{?_rpmdb_rebuild:%{__dbi_btconfig_rebuild}}\ %{!?_rpmdb_rebuild:%{__dbi_btconfig_current}}\ @@ -343,7 +376,7 @@ # The list of tags for which indices will be built. %_dbi_tags Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Removetid:Depends -# "Packages" needs fcntl shared/exclusive lock. +# "Packages" should have shared/exclusive fcntl(2) lock using "lockdbfd". %_dbi_config_Packages %{_dbi_htconfig} lockdbfd # "Depends" is a per-transaction cache of known dependency resolutions. diff --git a/rpm.spec.in b/rpm.spec.in index 5e547a4..d4ba89e 100644 --- a/rpm.spec.in +++ b/rpm.spec.in @@ -131,11 +131,22 @@ rm -rf $RPM_BUILD_ROOT make DESTDIR="$RPM_BUILD_ROOT" install +%ifos linux + +# Save list of packages through cron +mkdir -p ${RPM_BUILD_ROOT}/etc/cron.daily +install -m 755 scripts/rpm.daily ${RPM_BUILD_ROOT}/etc/cron.daily/rpm + +mkdir -p ${RPM_BUILD_ROOT}/etc/logrotate.d +install -m 755 scripts/rpm.log ${RPM_BUILD_ROOT}/etc/logrotate.d/rpm + mkdir -p $RPM_BUILD_ROOT/etc/rpm cat << E_O_F > $RPM_BUILD_ROOT/etc/rpm/macros.db1 %%_dbapi 1 E_O_F +%endif + %if %{with_apidocs} gzip -9n apidocs/man/man*/* || : %endif @@ -208,8 +219,14 @@ fi %defattr(-,root,root) %doc RPM-PGP-KEY RPM-GPG-KEY CHANGES GROUPS doc/manual/[a-z]* %attr(0755, @RPMUSER@, @RPMGROUP@) /bin/rpm + +%ifos linux +%config(missingok) /etc/cron.daily/rpm +%config(missingok) /etc/logrotate.d/rpm %dir /etc/rpm %config(missingok) /etc/rpm/macros.db1 +%endif + %attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/rpm2cpio %attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/gendiff %attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/rpmdb @@ -228,6 +245,7 @@ fi %attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/convertrpmrc.sh %attr(0644, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/macros %attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/mkinstalldirs +%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpm.* %attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpm[deiukqv] %attr(0644, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpmpopt* %attr(0644, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpmrc diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 37f9824..8d8b768 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -26,7 +26,7 @@ static int _debug = 0; extern int _noDirTokens; static int _rebuildinprogress = 0; -static int _db_filter_dups = 0; +static int _db_filter_dups = 1; /*@-exportlocal@*/ int _filterDbDups = 0; /* Filter duplicate entries ? (bug in pre rpm-3.0.4) */ @@ -1074,6 +1074,13 @@ int rpmdbCountPackages(rpmdb rpmdb, const char * name) int rc = -1; int xx; + /* XXX + * There's a segfault here with CDB access, let's treat the symptom + * while diagnosing the disease. + */ + if (name == NULL || *name == '\0') + return 0; + dbi = dbiOpen(rpmdb, RPMTAG_NAME, 0); if (dbi) { DBC * dbcursor = NULL; diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 2b2a764..0c3d264 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -9,6 +9,7 @@ EXTRA_DIST = \ find-prov.pl find-req.pl cpanflute find-provides.perl \ find-requires.perl get_magic.pl getpo.sh http.req \ magic.prov magic.req perl.prov perl.req rpmdiff rpmdiff.cgi \ + rpm.daily rpm.log rpm.xinetd \ sql.prov sql.req tcl.req trpm u_pkg.sh \ vpkg-provides.sh vpkg-provides2.sh @@ -24,5 +25,6 @@ config_SCRIPTS = \ find-prov.pl find-req.pl cpanflute find-provides.perl \ find-requires.perl get_magic.pl getpo.sh http.req \ magic.prov magic.req perl.prov perl.req rpmdiff rpmdiff.cgi \ + rpm.daily rpm.log rpm.xinetd \ sql.prov sql.req tcl.req u_pkg.sh \ vpkg-provides.sh vpkg-provides2.sh -- 2.7.4