From 81d60b470679acaab73d37f6a2f3f2dc6b3cba60 Mon Sep 17 00:00:00 2001 From: jbj Date: Sat, 2 Feb 2002 22:45:41 +0000 Subject: [PATCH] Sync with rpm-4.0.4 rollbacks. CVS patchset: 5293 CVS date: 2002/02/02 22:45:41 --- CHANGES | 2 + lib/psm.c | 45 +++++++--- lib/rpminstall.c | 10 +++ lib/signature.c | 4 +- lib/trb.c | 144 ------------------------------ platform.in | 6 +- po/rpm.pot | 224 +++++++++++++++++++++++------------------------ rpm.spec.in | 2 + rpmdb/header.c | 116 +++++++++++------------- rpmqv.c | 36 ++++---- 10 files changed, 237 insertions(+), 352 deletions(-) diff --git a/CHANGES b/CHANGES index fb70f6e35..c54d88ad9 100644 --- a/CHANGES +++ b/CHANGES @@ -115,6 +115,8 @@ - perl.req: don't mis-generate dependencies like perl(::path/to/foo.pl). - permit args to be hidden within %__find_{requires,provides}. - a couple more perl.{prov,req} fiddles. + - macro for %files, always include %defattr(), redhat config only. + - fix: drop header region when writing repackaged legacy header. 4.0.2 -> 4.0.3: - update per-interpreter dependency scripts, add sql/tcl (#20295). diff --git a/lib/psm.c b/lib/psm.c index 594cd70b3..27bcad6d0 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -1383,16 +1383,34 @@ assert(psm->mi == NULL); if (headerGetEntry(fi->h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc)) { psm->oh = headerCopyLoad(uh); uh = hfd(uh, uht); - } else { - psm->oh = headerLink(fi->h, "PSM_PKGSAVE_PRE)"); - } - } + } else + if (headerGetEntry(fi->h, RPMTAG_HEADERIMAGE, &uht, &uh, &uhc)) + { + HeaderIterator hi; + int_32 tag, type, count; + hPTR_t ptr; + Header oh; - /* Add remove transaction id to header. */ - if (psm->oh) - { int_32 tid = ts->id; - xx = headerAddEntry(psm->oh, RPMTAG_REMOVETID, - RPM_INT32_TYPE, &tid, 1); + /* Load the original header from the blob. */ + oh = headerCopyLoad(uh); + + /* XXX this is headerCopy w/o headerReload() */ + psm->oh = headerNew(); + + /*@-branchstate@*/ + for (hi = headerInitIterator(oh); + headerNextIterator(hi, &tag, &type, &ptr, &count); + ptr = headerFreeData((void *)ptr, type)) + { + if (ptr) (void) headerAddEntry(psm->oh, tag, type, ptr, count); + } + hi = headerFreeIterator(hi); + /*@=branchstate@*/ + + headerFree(oh, NULL); + uh = hfd(uh, uht); + } else + break; /* XXX shouldn't ever happen */ } /* Retrieve type of payload compression. */ @@ -1412,7 +1430,7 @@ assert(psm->mi == NULL); memset(&lead, 0, sizeof(lead)); /* XXX Set package version conditioned on noDirTokens. */ - lead.major = 4; + lead.major = 3; lead.minor = 0; lead.type = RPMLEAD_BINARY; lead.archnum = archnum; @@ -1437,6 +1455,13 @@ assert(psm->mi == NULL); if (rc) break; } + /* Add remove transaction id to header. */ + if (psm->oh) + { int_32 tid = ts->id; + xx = headerAddEntry(psm->oh, RPMTAG_REMOVETID, + RPM_INT32_TYPE, &tid, 1); + } + /* Write the metadata section into the package. */ rc = headerWrite(psm->fd, psm->oh, HEADER_MAGIC_YES); if (rc) break; diff --git a/lib/rpminstall.c b/lib/rpminstall.c index df46f6ebc..4052ccbae 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -915,6 +915,7 @@ int rpmRollback(rpmTransactionSet ts, IDT ip; int niids = 0; int rc = 0; + int i; if (argv != NULL && *argv != NULL) { rc = -1; @@ -1045,7 +1046,16 @@ int rpmRollback(rpmTransactionSet ts, rpmProblemSetPrint(stderr, probs); if (probs != NULL) rpmProblemSetFree(probs); probs = NULL; + } + if (rc) goto exit; + + /* Clean up after successful rollback. */ + for (i = 0; i < rtids->nidt; i++) { + IDT rrp = rtids->idt + i; + if (rrp->val.u32 != thistid) + continue; + (void) unlink(rrp->key); } } while (1); diff --git a/lib/signature.c b/lib/signature.c index 580c339a0..bd65217db 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -122,12 +122,12 @@ static inline rpmRC checkSize(FD_t fd, int siglen, int pad, int datalen) rc = (((sizeof(struct rpmlead) + siglen + pad + datalen) - st.st_size) ? RPMRC_BADSIZE : RPMRC_OK); - rpmMessage((rc == RPMRC_OK ? RPMMESS_DEBUG : RPMMESS_WARNING), + rpmMessage((rc == RPMRC_OK ? RPMMESS_DEBUG : RPMMESS_DEBUG), _("Expected size: %12d = lead(%d)+sigs(%d)+pad(%d)+data(%d)\n"), (int)sizeof(struct rpmlead)+siglen+pad+datalen, (int)sizeof(struct rpmlead), siglen, pad, datalen); /*@=sizeoftype@*/ - rpmMessage((rc == RPMRC_OK ? RPMMESS_DEBUG : RPMMESS_WARNING), + rpmMessage((rc == RPMRC_OK ? RPMMESS_DEBUG : RPMMESS_DEBUG), _(" Actual size: %12d\n"), (int)st.st_size); return rc; diff --git a/lib/trb.c b/lib/trb.c index 01f4073b6..900b2e7aa 100644 --- a/lib/trb.c +++ b/lib/trb.c @@ -6,150 +6,6 @@ #define UP2DATEGLOB "/var/spool/up2date/*.rpm" -#ifdef DYING -static int XrpmRollback(struct rpmInstallArguments_s * ia, const char ** argv) -{ - rpmdb db = NULL; - rpmTransactionSet ts = NULL; - rpmProblemSet probs = NULL; - IDTX itids = NULL; - IDTX rtids = NULL; - unsigned thistid = 0xffffffff; - unsigned prevtid; - time_t tid; - IDT rp; - IDT ip; - int rc; - - if (argv != NULL && *argv != NULL) { - rc = -1; - goto exit; - } - - rc = rpmdbOpen(ia->rootdir, &db, O_RDWR, 0644); - if (rc != 0) - goto exit; - - itids = IDTXload(db, RPMTAG_INSTALLTID); - ip = (itids != NULL && itids->nidt > 0) ? itids->idt : NULL; - - { const char * globstr = rpmExpand("%{_repackage_dir}/*.rpm", NULL); - if (globstr == NULL || *globstr == '%') { - globstr = _free(globstr); - rc = -1; - goto exit; - } - rtids = IDTXglob(globstr, RPMTAG_REMOVETID); - rp = (rtids != NULL && rtids->nidt > 0) ? rtids->idt : NULL; - globstr = _free(globstr); - } - - /* Run transactions until rollback goal is achieved. */ - do { - prevtid = thistid; - rc = 0; - packagesTotal = 0; - - /* Find larger of the remaining install/erase transaction id's. */ - thistid = 0; - if (ip != NULL && ip->val.u32 > thistid) - thistid = ip->val.u32; - if (rp != NULL && rp->val.u32 > thistid) - thistid = rp->val.u32; - - /* If we've achieved the rollback goal, then we're done. */ - if (thistid == 0 || thistid < ia->rbtid) - break; - - ts = rpmtransCreateSet(db, ia->rootdir); - - /* Install the previously erased packages for this transaction. */ - while (rp != NULL && rp->val.u32 == thistid) { - - rpmMessage(RPMMESS_DEBUG, "\t+++ %s\n", rp->key); - - rc = rpmtransAddPackage(ts, rp->h, NULL, rp->key, - (ia->installInterfaceFlags & INSTALL_UPGRADE) != 0, - ia->relocations); - if (rc != 0) - goto exit; - - packagesTotal++; - - rp->h = headerFree(rp->h); - rtids->nidt--; - if (rtids->nidt > 0) - rp++; - else - rp = NULL; - } - - /* Erase the previously installed packages for this transaction. */ - while (ip != NULL && ip->val.u32 == thistid) { - - rpmMessage(RPMMESS_DEBUG, - "\t--- rpmdb instance #%u\n", ip->instance); - - rc = rpmtransRemovePackage(ts, ip->instance); - if (rc != 0) - goto exit; - - packagesTotal++; - - ip->instance = 0; - itids->nidt--; - if (itids->nidt > 0) - ip++; - else - ip = NULL; - } - - /* Anything to do? */ - if (packagesTotal <= 0) - break; - - tid = (time_t)thistid; - rpmMessage(RPMMESS_DEBUG, _("rollback %d packages to %s"), - packagesTotal, ctime(&tid)); - - rc = rpmdepOrder(ts); - if (rc != 0) - goto exit; - - probs = NULL; - rc = rpmRunTransactions(ts, rpmShowProgress, - (void *) ((long)ia->installInterfaceFlags), - NULL, &probs, ia->transFlags, - (ia->probFilter|RPMPROB_FILTER_OLDPACKAGE)); - if (rc > 0) { - rpmProblemSetPrint(stderr, probs); - goto exit; - } - - if (probs != NULL) { - rpmProblemSetFree(probs); - probs = NULL; - } - ts = rpmtransFree(ts); - - } while (1); - -exit: - if (probs != NULL) { - rpmProblemSetFree(probs); - probs = NULL; - } - ts = rpmtransFree(ts); - - if (db != NULL) (void) rpmdbClose(db); - - rtids = IDTXfree(rtids); - itids = IDTXfree(itids); - - return rc; -} -#endif - static struct poptOption optionsTable[] = { { "verbose", 'v', 0, 0, 'v', N_("provide more detailed output"), NULL}, diff --git a/platform.in b/platform.in index 1f6abd8e0..5c94ee451 100644 --- a/platform.in +++ b/platform.in @@ -39,7 +39,6 @@ CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \ - %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} ; \ ./configure %{_target_platform} \\\ --prefix=%{_prefix} \\\ --exec-prefix=%{_exec_prefix} \\\ @@ -112,6 +111,11 @@ @redhat@%_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root @redhat@%_fixgroup [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} @ROOT_GROUP@ @redhat@%_fixperms %{__chmod} -Rf @FIXPERMS@ +@redhat@#--------------------------------------------------------------------- +@redhat@# Always use %defattr(-,root,root) in %files (added in rpm-4.0.4) +@redhat@# +@redhat@%files(n:f:) %%files%{?-f: -f %{-f*}}%{?-n: -n %{-n*}} %{?1}\ +@redhat@%defattr(-,root,root,-) @mandrake@#--------------------------------------------------------------------- @mandrake@# Mandrake vendor specific macros diff --git a/po/rpm.pot b/po/rpm.pot index 42cd361c3..783e818c1 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2002-02-01 10:09-0500\n" +"POT-Creation-Date: 2002-02-02 17:37-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -78,353 +78,353 @@ msgstr "" msgid "cannot re-open payload: %s\n" msgstr "" -#: rpmqv.c:109 +#: rpmqv.c:108 msgid "print the version of rpm being used" msgstr "" -#: rpmqv.c:112 +#: rpmqv.c:111 msgid "provide less detailed output" msgstr "" -#: rpmqv.c:114 +#: rpmqv.c:113 msgid "provide more detailed output" msgstr "" -#: rpmqv.c:116 +#: rpmqv.c:115 msgid "define macro with value " msgstr "" -#: rpmqv.c:117 +#: rpmqv.c:116 msgid "' '" msgstr "" -#: rpmqv.c:119 +#: rpmqv.c:118 msgid "print macro expansion of +" msgstr "" -#: rpmqv.c:120 +#: rpmqv.c:119 msgid "+" msgstr "" -#: rpmqv.c:122 +#: rpmqv.c:121 msgid "send stdout to " msgstr "" -#: rpmqv.c:123 +#: rpmqv.c:122 msgid "" msgstr "" -#: rpmqv.c:125 +#: rpmqv.c:124 msgid "use as the top level directory" msgstr "" -#: lib/poptI.c:210 rpmqv.c:126 +#: lib/poptI.c:210 rpmqv.c:125 msgid "" msgstr "" -#: rpmqv.c:128 +#: rpmqv.c:127 msgid "read instead of default macro file(s)" msgstr "" -#: rpmqv.c:129 rpmqv.c:133 rpmqv.c:137 +#: rpmqv.c:128 rpmqv.c:132 rpmqv.c:136 msgid "" msgstr "" -#: rpmqv.c:132 rpmqv.c:136 +#: rpmqv.c:131 rpmqv.c:135 msgid "read instead of default rpmrc file(s)" msgstr "" -#: rpmqv.c:140 +#: rpmqv.c:139 msgid "display final rpmrc and macro configuration" msgstr "" -#: rpmqv.c:145 +#: rpmqv.c:144 msgid "disable use of libio(3) API" msgstr "" -#: rpmqv.c:148 +#: rpmqv.c:147 msgid "debug protocol data stream" msgstr "" -#: rpmqv.c:150 +#: rpmqv.c:149 msgid "debug rpmio I/O" msgstr "" -#: rpmqv.c:152 +#: rpmqv.c:151 msgid "debug URL cache handling" msgstr "" -#: rpmqv.c:172 +#: rpmqv.c:171 msgid "Query options (with -q or --query):" msgstr "" -#: rpmqv.c:175 +#: rpmqv.c:174 msgid "Verify options (with -V or --verify):" msgstr "" -#: rpmqv.c:181 +#: rpmqv.c:180 msgid "Signature options:" msgstr "" -#: rpmqv.c:187 +#: rpmqv.c:186 msgid "Database options:" msgstr "" -#: rpmqv.c:193 +#: rpmqv.c:192 msgid "Build options with [ | | ]:" msgstr "" -#: rpmqv.c:199 +#: rpmqv.c:198 msgid "Install/Upgrade/Erase options:" msgstr "" -#: rpmqv.c:204 +#: rpmqv.c:203 msgid "Common options for all rpm modes:" msgstr "" #. @-modfilesys -globs @ -#: lib/poptI.c:27 rpmqv.c:221 +#: lib/poptI.c:27 rpmqv.c:220 #, c-format msgid "%s: %s\n" msgstr "" -#: rpmqv.c:229 +#: rpmqv.c:228 #, c-format msgid "RPM version %s\n" msgstr "" -#: rpmqv.c:236 +#: rpmqv.c:235 msgid "Copyright (C) 1998-2000 - Red Hat, Inc." msgstr "" -#: rpmqv.c:237 +#: rpmqv.c:236 msgid "This program may be freely redistributed under the terms of the GNU GPL" msgstr "" -#: rpmqv.c:249 +#: rpmqv.c:248 #, c-format msgid "Usage: %s {--help}\n" msgstr "" -#: rpmqv.c:589 +#: rpmqv.c:588 msgid "The --rcfile option has been eliminated.\n" msgstr "" -#: rpmqv.c:590 +#: rpmqv.c:589 msgid "Use \"--macros \" instead.\n" msgstr "" -#: rpmqv.c:596 +#: rpmqv.c:595 #, c-format msgid "Internal error in argument processing (%d) :-(\n" msgstr "" -#: rpmqv.c:637 rpmqv.c:643 rpmqv.c:649 rpmqv.c:687 +#: rpmqv.c:636 rpmqv.c:642 rpmqv.c:648 rpmqv.c:686 msgid "only one major mode may be specified" msgstr "" -#: rpmqv.c:666 +#: rpmqv.c:665 msgid "one type of query/verify may be performed at a time" msgstr "" -#: rpmqv.c:670 +#: rpmqv.c:669 msgid "unexpected query flags" msgstr "" -#: rpmqv.c:673 +#: rpmqv.c:672 msgid "unexpected query format" msgstr "" -#: rpmqv.c:676 +#: rpmqv.c:675 msgid "unexpected query source" msgstr "" -#: rpmqv.c:717 +#: rpmqv.c:716 msgid "--dbpath given for operation that does not use a database" msgstr "" -#: rpmqv.c:723 +#: rpmqv.c:722 msgid "only installation, upgrading, rmsource and rmspec may be forced" msgstr "" -#: rpmqv.c:725 +#: rpmqv.c:724 msgid "files may only be relocated during package installation" msgstr "" -#: rpmqv.c:728 +#: rpmqv.c:727 msgid "only one of --prefix or --relocate may be used" msgstr "" -#: rpmqv.c:731 +#: rpmqv.c:730 msgid "" "--relocate and --excludepath may only be used when installing new packages" msgstr "" -#: rpmqv.c:734 +#: rpmqv.c:733 msgid "--prefix may only be used when installing new packages" msgstr "" -#: rpmqv.c:737 +#: rpmqv.c:736 msgid "arguments to --prefix must begin with a /" msgstr "" -#: rpmqv.c:740 +#: rpmqv.c:739 msgid "--hash (-h) may only be specified during package installation" msgstr "" -#: rpmqv.c:744 +#: rpmqv.c:743 msgid "--percent may only be specified during package installation" msgstr "" -#: rpmqv.c:749 +#: rpmqv.c:748 msgid "--replacefiles may only be specified during package installation" msgstr "" -#: rpmqv.c:753 +#: rpmqv.c:752 msgid "--replacepkgs may only be specified during package installation" msgstr "" -#: rpmqv.c:757 +#: rpmqv.c:756 msgid "--excludedocs may only be specified during package installation" msgstr "" -#: rpmqv.c:761 +#: rpmqv.c:760 msgid "--includedocs may only be specified during package installation" msgstr "" -#: rpmqv.c:765 +#: rpmqv.c:764 msgid "only one of --excludedocs and --includedocs may be specified" msgstr "" -#: rpmqv.c:769 +#: rpmqv.c:768 msgid "--ignorearch may only be specified during package installation" msgstr "" -#: rpmqv.c:773 +#: rpmqv.c:772 msgid "--ignoreos may only be specified during package installation" msgstr "" -#: rpmqv.c:778 +#: rpmqv.c:777 msgid "--ignoresize may only be specified during package installation" msgstr "" -#: rpmqv.c:782 +#: rpmqv.c:781 msgid "--allmatches may only be specified during package erasure" msgstr "" -#: rpmqv.c:786 +#: rpmqv.c:785 msgid "--allfiles may only be specified during package installation" msgstr "" -#: rpmqv.c:791 +#: rpmqv.c:790 msgid "--justdb may only be specified during package installation and erasure" msgstr "" -#: rpmqv.c:796 +#: rpmqv.c:795 msgid "" "script disabling options may only be specified during package installation " "and erasure" msgstr "" -#: rpmqv.c:801 +#: rpmqv.c:800 msgid "" "trigger disabling options may only be specified during package installation " "and erasure" msgstr "" -#: rpmqv.c:805 +#: rpmqv.c:804 msgid "" "--nodeps may only be specified during package building, rebuilding, " "recompilation, installation,erasure, and verification" msgstr "" -#: rpmqv.c:810 +#: rpmqv.c:809 msgid "" "--test may only be specified during package installation, erasure, and " "building" msgstr "" -#: rpmqv.c:815 +#: rpmqv.c:814 msgid "" "--root (-r) may only be specified during installation, erasure, querying, " "and database rebuilds" msgstr "" -#: rpmqv.c:827 +#: rpmqv.c:826 msgid "arguments to --root (-r) must begin with a /" msgstr "" -#: rpmqv.c:851 +#: rpmqv.c:850 msgid "no files to sign\n" msgstr "" -#: rpmqv.c:856 +#: rpmqv.c:855 #, c-format msgid "cannot access file %s\n" msgstr "" -#: rpmqv.c:875 +#: rpmqv.c:874 msgid "pgp not found: " msgstr "" -#: rpmqv.c:880 +#: rpmqv.c:879 msgid "Enter pass phrase: " msgstr "" -#: rpmqv.c:882 +#: rpmqv.c:881 msgid "Pass phrase check failed\n" msgstr "" -#: rpmqv.c:886 +#: rpmqv.c:885 msgid "Pass phrase is good.\n" msgstr "" -#: rpmqv.c:891 +#: rpmqv.c:890 #, c-format msgid "Invalid %%_signature spec in macro file.\n" msgstr "" -#: rpmqv.c:898 +#: rpmqv.c:897 msgid "--sign may only be used during package building" msgstr "" -#: rpmqv.c:915 +#: rpmqv.c:914 msgid "exec failed\n" msgstr "" -#: rpmqv.c:947 +#: rpmqv.c:946 msgid "no packages files given for rebuild" msgstr "" -#: rpmqv.c:1015 +#: rpmqv.c:1014 msgid "no spec files given for build" msgstr "" -#: rpmqv.c:1017 +#: rpmqv.c:1016 msgid "no tar files given for build" msgstr "" -#: rpmqv.c:1036 +#: rpmqv.c:1038 msgid "no packages given for erase" msgstr "" -#: rpmqv.c:1047 +#: rpmqv.c:1078 msgid "no packages given for install" msgstr "" -#: rpmqv.c:1093 +#: rpmqv.c:1094 msgid "no arguments given for query" msgstr "" -#: rpmqv.c:1106 +#: rpmqv.c:1107 msgid "no arguments given for verify" msgstr "" -#: rpmqv.c:1114 +#: rpmqv.c:1115 msgid "unexpected arguments to --querytags " msgstr "" -#: rpmqv.c:1130 +#: rpmqv.c:1131 msgid "no arguments given" msgstr "" @@ -815,7 +815,7 @@ msgstr "" msgid "Could not open %s: %s\n" msgstr "" -#: build/pack.c:603 lib/psm.c:1426 +#: build/pack.c:603 lib/psm.c:1444 #, c-format msgid "Unable to write package: %s\n" msgstr "" @@ -845,7 +845,7 @@ msgstr "" msgid "Unable to write payload to %s: %s\n" msgstr "" -#: build/pack.c:683 lib/psm.c:1700 +#: build/pack.c:683 lib/psm.c:1725 #, c-format msgid "Wrote: %s\n" msgstr "" @@ -1497,7 +1497,7 @@ msgid "rpmdepOrder failed, %d elements remain\n" msgstr "" #: lib/formats.c:29 lib/formats.c:53 lib/formats.c:84 lib/formats.c:281 -#: rpmdb/header.c:2965 rpmdb/header.c:2986 rpmdb/header.c:3008 +#: rpmdb/header.c:2951 rpmdb/header.c:2972 rpmdb/header.c:2994 msgid "(not a number)" msgstr "" @@ -2092,7 +2092,7 @@ msgid "is needed by" msgstr "" #. @-modfilesys@ -#: lib/psm.c:247 rpmdb/header.c:384 rpmdb/header_internal.c:161 +#: lib/psm.c:247 rpmdb/header.c:383 rpmdb/header_internal.c:161 #, c-format msgid "Data type %d not supported\n" msgstr "" @@ -2140,31 +2140,31 @@ msgstr "" msgid "%s: %s scriptlet failed (%d), skipping %s\n" msgstr "" -#: lib/psm.c:1468 +#: lib/psm.c:1493 #, c-format msgid "user %s does not exist - using root\n" msgstr "" -#: lib/psm.c:1477 +#: lib/psm.c:1502 #, c-format msgid "group %s does not exist - using root\n" msgstr "" -#: lib/psm.c:1519 +#: lib/psm.c:1544 #, c-format msgid "unpacking of archive failed%s%s: %s\n" msgstr "" -#: lib/psm.c:1520 +#: lib/psm.c:1545 msgid " on file " msgstr "" -#: lib/psm.c:1708 +#: lib/psm.c:1733 #, c-format msgid "%s failed on file %s: %s\n" msgstr "" -#: lib/psm.c:1711 +#: lib/psm.c:1736 #, c-format msgid "%s failed: %s\n" msgstr "" @@ -2431,7 +2431,7 @@ msgstr "" msgid "found %d source and %d binary packages\n" msgstr "" -#: lib/rpminstall.c:521 lib/rpminstall.c:1029 +#: lib/rpminstall.c:521 lib/rpminstall.c:1030 msgid "failed dependencies:\n" msgstr "" @@ -2463,7 +2463,7 @@ msgstr "" msgid "Installing %s\n" msgstr "" -#: lib/rpminstall.c:1022 +#: lib/rpminstall.c:1023 #, c-format msgid "rollback %d packages to %s" msgstr "" @@ -2869,82 +2869,82 @@ msgstr "" #. This should not be allowed #. @-modfilesys@ -#: rpmdb/header.c:347 +#: rpmdb/header.c:346 msgid "dataLength() RPM_STRING_TYPE count must be 1.\n" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2222 +#: rpmdb/header.c:2208 #, c-format msgid "missing { after %" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2252 +#: rpmdb/header.c:2238 msgid "missing } after %{" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2266 +#: rpmdb/header.c:2252 msgid "empty tag format" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2280 +#: rpmdb/header.c:2266 msgid "empty tag name" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2297 +#: rpmdb/header.c:2283 msgid "unknown tag" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2324 +#: rpmdb/header.c:2310 msgid "] expected at end of array" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2342 +#: rpmdb/header.c:2328 msgid "unexpected ]" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2346 +#: rpmdb/header.c:2332 msgid "unexpected }" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2412 +#: rpmdb/header.c:2398 msgid "? expected in expression" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2421 +#: rpmdb/header.c:2407 msgid "{ expected after ? in expression" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2434 rpmdb/header.c:2476 +#: rpmdb/header.c:2420 rpmdb/header.c:2462 msgid "} expected in expression" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2444 +#: rpmdb/header.c:2430 msgid ": expected following ? subexpression" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2461 +#: rpmdb/header.c:2447 msgid "{ expected after : in expression" msgstr "" #. @-observertrans -readonlytrans@ -#: rpmdb/header.c:2486 +#: rpmdb/header.c:2472 msgid "| expected at end of expression" msgstr "" -#: rpmdb/header.c:2709 +#: rpmdb/header.c:2695 msgid "(unknown type)" msgstr "" diff --git a/rpm.spec.in b/rpm.spec.in index 2605276ea..b9aea1625 100644 --- a/rpm.spec.in +++ b/rpm.spec.in @@ -627,3 +627,5 @@ fi - perl.req: don't mis-generate dependencies like perl(::path/to/foo.pl). - permit args to be hidden within %%__find_{requires,provides}. - a couple more perl.{prov,req} fiddles. +- macro for %files, always include %defattr(), redhat config only. +- fix: drop header region when writing repackaged legacy header. diff --git a/rpmdb/header.c b/rpmdb/header.c index f2113780f..866936fa7 100644 --- a/rpmdb/header.c +++ b/rpmdb/header.c @@ -13,7 +13,6 @@ #define __HEADER_PROTOTYPES__ #include -#define HSTATIC static #include "debug.h" @@ -98,7 +97,7 @@ _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/ * @param h header * @return referenced header instance */ -HSTATIC +static Header XheaderLink(Header h, /*@null@*/ const char * msg, const char * fn, unsigned ln) /*@modifies h @*/ @@ -118,7 +117,7 @@ fprintf(stderr, "--> h %p ++ %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), * @param h header * @return NULL always */ -HSTATIC /*@null@*/ +static /*@null@*/ Header XheaderUnlink(/*@killref@*/ /*@null@*/ Header h, /*@null@*/ const char * msg, const char * fn, unsigned ln) /*@modifies h @*/ @@ -136,7 +135,7 @@ fprintf(stderr, "--> h %p -- %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), * @param h header * @return NULL always */ -HSTATIC /*@null@*/ +static /*@null@*/ Header XheaderFree(/*@killref@*/ /*@null@*/ Header h, /*@null@*/ const char * msg, const char * fn, unsigned ln) /*@modifies h @*/ @@ -174,7 +173,7 @@ Header XheaderFree(/*@killref@*/ /*@null@*/ Header h, * Create new (empty) header instance. * @return header */ -HSTATIC +static Header headerNew(void) /*@*/ { @@ -212,7 +211,7 @@ static int indexCmp(const void * avp, const void * bvp) /*@*/ * Sort tags in header. * @param h header */ -HSTATIC +static void headerSort(Header h) /*@modifies h @*/ { @@ -245,7 +244,7 @@ static int offsetCmp(const void * avp, const void * bvp) /*@*/ * Restore tags in header to original ordering. * @param h header */ -HSTATIC +static void headerUnsort(Header h) /*@modifies h @*/ { @@ -258,7 +257,7 @@ void headerUnsort(Header h) * @param magicp include size of 8 bytes for (magic, 0)? * @return size of on-disk header */ -HSTATIC +static unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp) /*@modifies h @*/ { @@ -466,7 +465,7 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl, tprev = dataStart; /* XXX HEADER_IMAGE tags don't include region sub-tag. */ /*@-sizeoftype@*/ - if (ie.info.tag != HEADER_IMMUTABLE) + if (ie.info.tag == HEADER_IMAGE) tprev -= REGION_TAG_COUNT; /*@=sizeoftype@*/ } @@ -511,33 +510,6 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl, return dl; } -#if 0 -static int headerDrips(const Header h) -{ - indexEntry entry; - int i; - - for (i = 0, entry = h->index; i < h->indexUsed; i++, entry++) { - if (ENTRY_IS_REGION(entry)) { - int rid = entry->info.offset; - - for (; i < h->indexUsed && entry->info.offset <= rid+1; i++, entry++) { - if (entry->info.offset <= rid) - continue; - } - i--; - entry--; - continue; - } - - /* Ignore deleted drips. */ - if (entry->data == NULL || entry->length <= 0) - continue; - } - return 0; -} -#endif - /** \ingroup header */ static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h, @@ -793,7 +765,7 @@ errxit: * @param h header (with pointers) * @return on-disk header blob (i.e. with offsets) */ -HSTATIC /*@only@*/ /*@null@*/ +static /*@only@*/ /*@null@*/ void * headerUnload(Header h) /*@modifies h @*/ { @@ -857,7 +829,7 @@ indexEntry findEntry(/*@null@*/ Header h, int_32 tag, int_32 type) * @param tag tag * @return 0 on success, 1 on failure (INCONSISTENT) */ -HSTATIC +static int headerRemoveEntry(Header h, int_32 tag) /*@modifies h @*/ { @@ -901,7 +873,7 @@ int headerRemoveEntry(Header h, int_32 tag) * @param uh on-disk header blob (i.e. with offsets) * @return header */ -HSTATIC /*@null@*/ +static /*@null@*/ Header headerLoad(/*@kept@*/ void * uh) /*@modifies uh @*/ { @@ -1085,7 +1057,7 @@ errxit: * @param tag region tag * @return on-disk header (with offsets) */ -HSTATIC /*@null@*/ +static /*@null@*/ Header headerReload(/*@only@*/ Header h, int tag) /*@modifies h @*/ { @@ -1118,7 +1090,7 @@ Header headerReload(/*@only@*/ Header h, int tag) * @param uh on-disk header blob (i.e. with offsets) * @return header */ -HSTATIC /*@null@*/ +static /*@null@*/ Header headerCopyLoad(const void * uh) /*@*/ { @@ -1153,7 +1125,7 @@ Header headerCopyLoad(const void * uh) * @param magicp read (and verify) 8 bytes of (magic, 0)? * @return header (or NULL on error) */ -HSTATIC /*@null@*/ +static /*@null@*/ Header headerRead(FD_t fd, enum hMagic magicp) /*@modifies fd @*/ { @@ -1186,8 +1158,8 @@ Header headerRead(FD_t fd, enum hMagic magicp) reserved = block[i++]; } - il = ntohl(block[i++]); - dl = ntohl(block[i++]); + il = ntohl(block[i]); i++; + dl = ntohl(block[i]); i++; /*@-sizeoftype@*/ len = sizeof(il) + sizeof(dl) + (il * sizeof(struct entryInfo)) + dl; @@ -1228,7 +1200,7 @@ exit: * @param magicp prefix write with 8 bytes of (magic, 0)? * @return 0 on success, 1 on error */ -HSTATIC +static int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp) /*@globals fileSystem @*/ /*@modifies fd, h, fileSystem @*/ @@ -1269,7 +1241,7 @@ exit: * @param tag tag * @return 1 on success, 0 on failure */ -HSTATIC +static int headerIsEntry(/*@null@*/Header h, int_32 tag) /*@*/ { @@ -1301,7 +1273,12 @@ static int copyEntry(const indexEntry entry, if (p) switch (entry->info.type) { case RPM_BIN_TYPE: - /* XXX this only works for HEADER_IMMUTABLE */ + /* + * XXX This only works for + * XXX "sealed" HEADER_IMMUTABLE/HEADER_SIGNATURES/HEADER_IMAGE. + * XXX This will *not* work for unsealed legacy HEADER_IMAGE (i.e. + * XXX a legacy header freshly read, but not yet unloaded to the rpmdb). + */ if (ENTRY_IS_REGION(entry)) { int_32 * ei = ((int_32 *)entry->data) - 2; /*@-castexpose@*/ @@ -1312,17 +1289,26 @@ static int copyEntry(const indexEntry entry, int_32 ril = rdl/sizeof(*pe); /*@-sizeoftype@*/ - count = 2 * sizeof(*ei) + (ril * sizeof(*pe)) + - entry->rdlen + REGION_TAG_COUNT; + rdl = entry->rdlen; + count = 2 * sizeof(*ei) + (ril * sizeof(*pe)) + rdl; + if (entry->info.tag == HEADER_IMAGE) { + ril -= 1; + pe += 1; + } else { + count += REGION_TAG_COUNT; + rdl += REGION_TAG_COUNT; + } + *p = xmalloc(count); ei = (int_32 *) *p; ei[0] = htonl(ril); - ei[1] = htonl(entry->rdlen + REGION_TAG_COUNT); + ei[1] = htonl(rdl); + /*@-castexpose@*/ pe = (entryInfo) memcpy(ei + 2, pe, (ril * sizeof(*pe))); /*@=castexpose@*/ - dataStart = (char *) memcpy(pe + ril, dataStart, - (entry->rdlen + REGION_TAG_COUNT)); + + dataStart = (char *) memcpy(pe + ril, dataStart, rdl); /*@=sizeoftype@*/ rc = regionSwab(NULL, ril, 0, pe, dataStart, 0); @@ -1599,7 +1585,7 @@ static /*@null@*/ void * headerFreeTag(/*@unused@*/ Header h, * @retval c address of number of values (or NULL) * @return 1 on success, 0 on failure */ -HSTATIC +static int headerGetEntry(Header h, int_32 tag, /*@null@*/ /*@out@*/ hTYP_t type, /*@null@*/ /*@out@*/ void ** p, @@ -1621,7 +1607,7 @@ int headerGetEntry(Header h, int_32 tag, * @retval c address of number of values (or NULL) * @return 1 on success, 0 on failure */ -HSTATIC +static int headerGetEntryMinMemory(Header h, int_32 tag, /*@null@*/ /*@out@*/ hTYP_t type, /*@null@*/ /*@out@*/ hPTR_t * p, @@ -1724,7 +1710,7 @@ static void * grabData(int_32 type, hPTR_t p, int_32 c, * @param c number of values * @return 1 on success, 0 on failure */ -HSTATIC +static int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c) /*@modifies h @*/ { @@ -1769,7 +1755,7 @@ int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c) * @param c number of values * @return 1 on success, 0 on failure */ -HSTATIC +static int headerAppendEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c) /*@modifies h @*/ @@ -1816,7 +1802,7 @@ int headerAppendEntry(Header h, int_32 tag, int_32 type, * @param c number of values * @return 1 on success, 0 on failure */ -HSTATIC +static int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c) /*@modifies h @*/ @@ -1846,7 +1832,7 @@ int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type, * @param lang locale * @return 1 on success, 0 on failure */ -HSTATIC +static int headerAddI18NString(Header h, int_32 tag, const char * string, const char * lang) /*@modifies h @*/ @@ -1991,7 +1977,7 @@ int headerAddI18NString(Header h, int_32 tag, const char * string, * @param c number of values * @return 1 on success, 0 on failure */ -HSTATIC +static int headerModifyEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c) /*@modifies h @*/ @@ -2889,7 +2875,7 @@ freeExtensionCache(const headerSprintfExtension extensions, * @retval errmsg error message (if any) * @return formatted output string (malloc'ed) */ -HSTATIC /*@only@*/ /*@null@*/ +static /*@only@*/ /*@null@*/ char * headerSprintf(Header h, const char * fmt, const struct headerTagTableEntry_s * tbltags, const struct headerSprintfExtension_s * extensions, @@ -3105,7 +3091,7 @@ const struct headerSprintfExtension_s headerDefaultFormats[] = { * @param headerTo destination header * @param tagstocopy array of tags that are copied */ -HSTATIC +static void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy) /*@modifies headerTo @*/ { @@ -3141,7 +3127,7 @@ struct headerIteratorS { * @param hi header tag iterator * @return NULL always */ -HSTATIC /*@null@*/ +static /*@null@*/ HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi) /*@modifies hi @*/ { @@ -3155,7 +3141,7 @@ HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi) * @param h header * @return header tag iterator */ -HSTATIC +static HeaderIterator headerInitIterator(Header h) /*@modifies h */ { @@ -3177,7 +3163,7 @@ HeaderIterator headerInitIterator(Header h) * @retval c address of number of values * @return 1 on success, 0 on failure */ -HSTATIC +static int headerNextIterator(HeaderIterator hi, /*@null@*/ /*@out@*/ hTAG_t tag, /*@null@*/ /*@out@*/ hTYP_t type, @@ -3216,7 +3202,7 @@ int headerNextIterator(HeaderIterator hi, * @param h header * @return new header instance */ -HSTATIC /*@null@*/ +static /*@null@*/ Header headerCopy(Header h) /*@modifies h @*/ { diff --git a/rpmqv.c b/rpmqv.c index d51bd313a..4ace5e195 100755 --- a/rpmqv.c +++ b/rpmqv.c @@ -47,8 +47,7 @@ enum modes { MODE_INSTALL = (1 << 1), MODE_ERASE = (1 << 2), - MODE_ROLLBACK = (1 << 14), -#define MODES_IE (MODE_INSTALL | MODE_ERASE | MODE_ROLLBACK) +#define MODES_IE (MODE_INSTALL | MODE_ERASE) MODE_BUILD = (1 << 4), MODE_REBUILD = (1 << 5), @@ -1032,20 +1031,20 @@ int main(int argc, const char ** argv) #ifdef IAM_RPMEIU case MODE_ERASE: - if (!poptPeekArg(optCon)) - argerror(_("no packages given for erase")); - if (ia->noDeps) ia->eraseInterfaceFlags |= UNINSTALL_NODEPS; - ec = rpmErase(ts, (const char **)poptGetArgs(optCon), + if (!poptPeekArg(optCon)) { + if (ia->rbtid == 0) + argerror(_("no packages given for erase")); + ec += rpmRollback(ts, ia, NULL); + } else { + ec += rpmErase(ts, (const char **)poptGetArgs(optCon), ia->transFlags, ia->eraseInterfaceFlags); + } break; case MODE_INSTALL: - if (!poptPeekArg(optCon)) - argerror(_("no packages given for install")); - /* RPMTRANS_FLAG_BUILD_PROBS */ /* RPMTRANS_FLAG_KEEPOBSOLETE */ @@ -1074,17 +1073,19 @@ int main(int argc, const char ** argv) } /*@=branchstate@*/ - /*@-compdef@*/ /* FIX: ia->relocations[0].newPath undefined */ - ec += rpmInstall(ts, (const char **)poptGetArgs(optCon), - ia->transFlags, ia->installInterfaceFlags, ia->probFilter, - ia->relocations); + if (!poptPeekArg(optCon)) { + if (ia->rbtid == 0) + argerror(_("no packages given for install")); + ec += rpmRollback(ts, ia, NULL); + } else { + /*@-compdef@*/ /* FIX: ia->relocations[0].newPath undefined */ + ec += rpmInstall(ts, (const char **)poptGetArgs(optCon), + ia->transFlags, ia->installInterfaceFlags, + ia->probFilter, ia->relocations); + } /*@=compdef@*/ break; - case MODE_ROLLBACK: - ec += rpmRollback(ts, ia, (const char **)poptGetArgs(optCon)); - break; - #endif /* IAM_RPMEIU */ #ifdef IAM_RPMQV @@ -1158,7 +1159,6 @@ int main(int argc, const char ** argv) #if !defined(IAM_RPMEIU) case MODE_INSTALL: case MODE_ERASE: - case MODE_ROLLBACK: #endif case MODE_UNKNOWN: if (!showVersion && !help && !noUsageMsg) printUsage();