Skip to content

Commit

Permalink
Add option the select option --builtrpms to rpmspec(rhbz:961833)
Browse files Browse the repository at this point in the history
When --builtrpms is used then rpmspec operates only on the binary
package headers of packages which would be built from spec. That means
ignoring package headers of packages that won't be built from spec
i. e. ignoring package headers of packages without file section.
  • Loading branch information
Lubos Kardos committed Mar 9, 2016
1 parent cc61141 commit 5490887
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
16 changes: 7 additions & 9 deletions build/spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,17 +452,15 @@ int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg)
goto exit;
}

if (qva->qva_source == RPMQV_SPECRPMS) {
if (qva->qva_source == RPMQV_SPECRPMS ||
qva->qva_source == RPMQV_SPECBUILTRPMS) {

res = 0;
for (Package pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
#if 0
/*
* XXX FIXME: whether to show all or just the packages that
* would be built needs to be made caller specifiable, for now
* revert to "traditional" behavior as existing tools rely on this.
*/
if (pkg->fileList == NULL) continue;
#endif

if (qva->qva_source == RPMQV_SPECBUILTRPMS && pkg->fileList == NULL)
continue;

res += qva->qva_showPackage(qva, ts, pkg->header);
}
} else {
Expand Down
6 changes: 4 additions & 2 deletions doc/rpmspec.8
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ See \fBrpm(8)\fR for details.
.SS "SELECT OPTIONS"
.PP
\fB--rpms\fR
Operate on the binary package header(s).
Operate on the all binary package headers generated from spec.
\fB--builtrpms\fR
Operate only on the binary package headers of packages which would be built from spec. That means ignoring package headers of packages that won't be built from spec i. e. ignoring package headers of packages without file section.
\fB--srpm\fR
Operate on the source package header(s).
Operate on the source package header(s) generated from spec.

.SH "SEE ALSO"
.nf
Expand Down
1 change: 1 addition & 0 deletions lib/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
break;
}
case RPMQV_SPECRPMS:
case RPMQV_SPECBUILTRPMS:
case RPMQV_SPECSRPM:
for (ARGV_const_t arg = argv; arg && *arg; arg++) {
ec += ((qva->qva_specQuery != NULL)
Expand Down
1 change: 1 addition & 0 deletions lib/rpmcli.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ enum rpmQVSources_e {
RPMQV_WHATSUGGESTS, /*!< ... from suggests db search. */
RPMQV_WHATSUPPLEMENTS, /*!< ... from supplements db search. */
RPMQV_WHATENHANCES, /*!< ... from enhances db search. */
RPMQV_SPECBUILTRPMS, /*!< ... from pkgs which would be built from spec */
};

typedef rpmFlags rpmQVSources;
Expand Down
2 changes: 2 additions & 0 deletions rpmspec.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ static struct poptOption specOptsTable[] = {
N_("query spec file(s)"), NULL },
{ "rpms", 0, POPT_ARG_VAL, &source, RPMQV_SPECRPMS,
N_("operate on binary rpms generated by spec (default)"), NULL },
{ "builtrpms", 0, POPT_ARG_VAL, &source, RPMQV_SPECBUILTRPMS,
N_("operate on binary rpms that would be built from spec"), NULL },
{ "srpm", 0, POPT_ARG_VAL, &source, RPMQV_SPECSRPM,
N_("operate on source rpm generated by spec"), NULL },
{ "target", 0, POPT_ARG_STRING, &target, 0,
Expand Down

0 comments on commit 5490887

Please sign in to comment.