Skip to content

Commit

Permalink
Set SOURCERPM when querying SPEC files
Browse files Browse the repository at this point in the history
Avoid packages being detected as srpms erroneously

Resolves: rpm-software-management#2819
  • Loading branch information
ffesti committed Mar 26, 2024
1 parent bdf3646 commit 9283c6e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build/spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg)

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

genSourceRpmName(spec);
headerPutString(pkg->header, RPMTAG_SOURCERPM, spec->sourceRpmName);
res += qva->qva_showPackage(qva, ts, pkg->header);
}
} else {
Expand Down
29 changes: 29 additions & 0 deletions tests/rpmquery.at
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,35 @@ runroot rpmspec \
[])
RPMTEST_CLEANUP

AT_SETUP([rpmspec -q --rpms])
AT_KEYWORDS([query])
RPMTEST_CHECK([
RPMDB_INIT
runroot rpmspec --rpms \
-q /data/SPECS/hello.spec | grep src
runroot rpmspec --rpms \
-q /data/SPECS/hello.spec | cut -d. -f-2
],
[0],
[hello-1.0-1
],
[])
RPMTEST_CLEANUP

AT_SETUP([rpmspec -q --srpm])
AT_KEYWORDS([query])
RPMTEST_CHECK([
RPMDB_INIT
runroot rpmspec --srpm \
-q /data/SPECS/hello.spec
],
[0],
[hello-1.0-1.src
],
[])
RPMTEST_CLEANUP


# ------------------------------
AT_SETUP([rpm -ql -p *.i386.rpm])
AT_KEYWORDS([query])
Expand Down

0 comments on commit 9283c6e

Please sign in to comment.