diff --git a/doc/rpm.8 b/doc/rpm.8 index af495d9ed..80055b675 100644 --- a/doc/rpm.8 +++ b/doc/rpm.8 @@ -263,6 +263,10 @@ included in the binary package relocation hint(s). Don't install files whose name begins with \fIOLDPATH\fR. .TP +\fB--excludeartifacts\fR +Don't install any files which are marked as artifacts, +such as build-id links. +.TP \fB--excludedocs\fR Don't install any files which are marked as documentation (which includes man pages and texinfo documents). diff --git a/lib/poptI.c b/lib/poptI.c index f655f7862..e475924bf 100644 --- a/lib/poptI.c +++ b/lib/poptI.c @@ -133,6 +133,9 @@ struct poptOption rpmInstallPoptTable[] = { { "erase", 'e', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags, INSTALL_ERASE, N_("erase (uninstall) package"), N_("+") }, + { "excludeartifacts", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmIArgs.transFlags, RPMTRANS_FLAG_NOARTIFACTS, + N_("do not install artifacts"), NULL}, { "excludeconfigs", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags, RPMTRANS_FLAG_NOCONFIGS, N_("do not install configuration files"), NULL}, diff --git a/lib/rpmts.h b/lib/rpmts.h index c13ffadb2..4f88bc867 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -51,7 +51,8 @@ enum rpmtransFlags_e { /* bit 26 unused */ RPMTRANS_FLAG_NOMD5 = (1 << 27), /*!< from --nomd5 */ RPMTRANS_FLAG_NOFILEDIGEST = (1 << 27), /*!< from --nofiledigest (alias to --nomd5) */ - /* bits 28-29 unused */ + /* bit 28 unused */ + RPMTRANS_FLAG_NOARTIFACTS = (1 << 29), /*!< from --noartifacts */ RPMTRANS_FLAG_NOCONFIGS = (1 << 30), /*!< from --noconfigs */ RPMTRANS_FLAG_DEPLOOPS = (1 << 31) /*!< from --deploops */ }; diff --git a/lib/transaction.c b/lib/transaction.c index 9fea7b06b..893fb3ae7 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -825,6 +825,7 @@ static void skipInstallFiles(const rpmts ts, rpmfiles files, rpmfs fs) rpm_color_t FColor; int noConfigs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONFIGS); int noDocs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NODOCS); + int noArtifacts = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOARTIFACTS); int * drc; char * dff; int dc; @@ -924,6 +925,13 @@ static void skipInstallFiles(const rpmts ts, rpmfiles files, rpmfs fs) rpmfsSetAction(fs, i, FA_SKIPNSTATE); continue; } + + /* Skip artifacts if requested. */ + if (noArtifacts && (rpmfiFFlags(fi) & RPMFILE_ARTIFACT)) { + drc[ix]--; dff[ix] = 1; + rpmfsSetAction(fs, i, FA_SKIPNSTATE); + continue; + } } /* Skip (now empty) directories that had skipped files. */ diff --git a/tests/rpmi.at b/tests/rpmi.at index a7a18c756..a55a50116 100644 --- a/tests/rpmi.at +++ b/tests/rpmi.at @@ -666,3 +666,20 @@ runroot rpm -e testdoc []) AT_CLEANUP +AT_SETUP([rpm -i --excludeartifacts]) +AT_KEYWORDS([install]) +RPMDB_INIT +runroot rpmbuild --quiet -bb /data/SPECS/vattrtest.spec + +AT_CHECK([ +RPMDB_INIT +runroot rpm -i --excludeartifacts /build/RPMS/noarch/vattrtest-1.0-1.noarch.rpm +test -e ${RPMTEST}/opt/vattrtest/a && exit 1 +runroot rpm -e vattrtest +runroot rpm -i /build/RPMS/noarch/vattrtest-1.0-1.noarch.rpm +test -e ${RPMTEST}/opt/vattrtest/a || exit 1 +], +[0], +[], +[]) +AT_CLEANUP