summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2021-04-27 04:37:52 +0200
committerAllan McRae <allan@archlinux.org>2021-05-01 04:08:14 +0200
commit0ff94ae85d40efdc177e1852ef58848f82d14156 (patch)
treef647590d0803d9082b2b326be4fc6356cdf9d09e
parent8faf749fd19aff0eb35eb7108d2fd379d3c9c3b9 (diff)
downloadpacman-0ff94ae85d40efdc177e1852ef58848f82d14156.tar.gz
pacman-0ff94ae85d40efdc177e1852ef58848f82d14156.tar.xz
fix downloading multiple urls with XferCommand
An extra break causes _alpm_download to break out of the payload loop as soon as it sees a successful url download with XferCommand. Fixes: FS#70608 - -U fails to download all files with XferCommand Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
-rw-r--r--lib/libalpm/dload.c1
-rw-r--r--test/pacman/meson.build2
-rw-r--r--test/pacman/tests/upgrade-download-with-xfercommand.py26
3 files changed, 28 insertions, 1 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 70ec318a..9ed1a02a 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -880,7 +880,6 @@ int _alpm_download(alpm_handle_t *handle,
if(payload->fileurl) {
if (handle->fetchcb(handle->fetchcb_ctx, payload->fileurl, localpath, payload->force) != -1) {
success = 1;
- break;
}
} else {
for(s = payload->servers; s; s = s->next) {
diff --git a/test/pacman/meson.build b/test/pacman/meson.build
index 6c28bd7d..0e75b3ee 100644
--- a/test/pacman/meson.build
+++ b/test/pacman/meson.build
@@ -333,6 +333,7 @@ pacman_tests = [
'tests/upgrade-download-404.py',
'tests/upgrade-download-pkg-and-sig-with-filename.py',
'tests/upgrade-download-pkg-and-sig-without-filename.py',
+ 'tests/upgrade-download-with-xfercommand.py',
]
xfail_tests = {
@@ -344,6 +345,7 @@ xfail_tests = {
'tests/sync403.py': true,
'tests/sync406.py': true,
'tests/upgrade078.py': true,
+ 'tests/upgrade-download-with-xfercommand.py': true,
}
foreach input : pacman_tests
diff --git a/test/pacman/tests/upgrade-download-with-xfercommand.py b/test/pacman/tests/upgrade-download-with-xfercommand.py
new file mode 100644
index 00000000..03ce4819
--- /dev/null
+++ b/test/pacman/tests/upgrade-download-with-xfercommand.py
@@ -0,0 +1,26 @@
+self.description = "--upgrade remote packages with XferCommand"
+
+self.option['XferCommand'] = ['/usr/bin/curl %u -o %o']
+
+p1 = pmpkg('pkg1', '1.0-1')
+self.addpkg(p1)
+
+p2 = pmpkg('pkg2', '2.0-2')
+self.addpkg(p2)
+
+url = self.add_simple_http_server({
+ '/{}'.format(p1.filename()): p1.makepkg_bytes(),
+ '/{}'.format(p2.filename()): p2.makepkg_bytes(),
+})
+
+self.args = '-U {url}/{} {url}/{}'.format(p1.filename(), p2.filename(), url=url)
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("CACHE_EXISTS=pkg1|1.0-1")
+self.addrule("CACHE_EXISTS=pkg2|2.0-2")
+
+# --upgrade fails hard with XferCommand because the fetch callback has no way
+# to return the file path to alpm
+self.expectfailure = True