Add --excludeartifacts install option
Like docs, configs etc, excluding artifacts from installation might sometimes be desireable to eg save space. Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=1848199
This commit is contained in:
parent
1870f4df16
commit
07ed169da3
|
@ -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).
|
||||
|
|
|
@ -133,6 +133,9 @@ struct poptOption rpmInstallPoptTable[] = {
|
|||
{ "erase", 'e', POPT_BIT_SET,
|
||||
&rpmIArgs.installInterfaceFlags, INSTALL_ERASE,
|
||||
N_("erase (uninstall) package"), N_("<package>+") },
|
||||
{ "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},
|
||||
|
|
|
@ -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 */
|
||||
};
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue