Skip to content

Commit

Permalink
Fix simultaneous source and binary package install
Browse files Browse the repository at this point in the history
rpmInstallSourcePackage() grabs the transaction element with the index
of 0, which only works correctly if the src.rpm package is the only one
in the set.  That's not the case if some binary packages have been part
of the same install command in rpmInstall() so we need to make sure the
set is emptied beforehand.

Add a test to go with.
  • Loading branch information
dmnks committed Dec 9, 2024
1 parent d535dca commit 1622862
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rpminstall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
rpmcliProgressState = 0;
rpmcliProgressTotal = 0;
rpmcliProgressCurrent = 0;
rpmtsEmpty(ts);
for (i = 0; i < eiu->numSRPMS; i++) {
if (eiu->sourceURL[i] != NULL) {
rc = RPMRC_OK;
Expand Down
27 changes: 27 additions & 0 deletions tests/rpmi.at
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,33 @@ hello.spec
[])
RPMTEST_CLEANUP

# ------------------------------
# Check if rpm -i *.src.rpm *.rpm works
AT_SETUP([rpm -i *.src.rpm *.rpm])
AT_KEYWORDS([install])
RPMTEST_CHECK([
RPMDB_INIT

runroot rpm \
--define "_topdir /tmp/build" \
--ignorearch --ignoreos --nodeps \
-i /data/SRPMS/hello-1.0-1.src.rpm \
/data/RPMS/hello-2.0-1.x86_64.rpm
runroot rpm -q hello; echo
runroot_other sh -c 'ls /tmp/build/*'
],
[0],
[hello-2.0-1.x86_64

/tmp/build/SOURCES:
hello-1.0.tar.gz

/tmp/build/SPECS:
hello.spec
],
[])
RPMTEST_CLEANUP

# ------------------------------
# Various error behavior tests
#
Expand Down

0 comments on commit 1622862

Please sign in to comment.