From 1aa5f47639bd8dc36a45a9c420576f86e800eff8 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Jun 18 2019 00:47:41 +0000 Subject: Backport fix for 'updates download' with multiple packages (#3324) --- diff --git a/0001-Fix-downloading-packages-for-updates-with-multiple-b.patch b/0001-Fix-downloading-packages-for-updates-with-multiple-b.patch new file mode 100644 index 0000000..f9558fb --- /dev/null +++ b/0001-Fix-downloading-packages-for-updates-with-multiple-b.patch @@ -0,0 +1,49 @@ +From b720d8c0ad556557f2a615b541f229abc595c9e3 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Mon, 17 Jun 2019 17:39:41 -0700 +Subject: [PATCH] Fix downloading packages for updates with multiple builds + +I inadvertently broke this in #3148 - sorry. I tried to make +the handling of the args list cleaner in that commit, but +overlooked that initializing it outside of the `for build in` +loop meant it'd just keep getting appended to, it doesn't get +recreated for each build - so by the time you get to the second +build in an update, you're trying to do something like: + +koji download-build foo-1.0-1 bar-1.0-1 + +which isn't allowed (that's why we run one command per build in +the first place, life would be easier if Koji let us pass it +multiple NVRs...) + +Fix this simply by (re)initializing `args` inside the loop, not +outside it. + +Signed-off-by: Adam Williamson +--- + bodhi/client/__init__.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/bodhi/client/__init__.py b/bodhi/client/__init__.py +index f5e4eb27..d3170002 100644 +--- a/bodhi/client/__init__.py ++++ b/bodhi/client/__init__.py +@@ -738,12 +738,12 @@ def download(url, **kwargs): + # Not sure if we need a check for > expecteds, I don't + # *think* that should ever be possible for these opts. + +- args = ['koji', 'download-build'] +- if debuginfo: +- args.append('--debuginfo') + for update in resp.updates: + click.echo(f"Downloading packages from {update['alias']}") + for build in update['builds']: ++ args = ['koji', 'download-build'] ++ if debuginfo: ++ args.append('--debuginfo') + # subprocess is icky, but koji module doesn't + # expose this in any usable way, and we don't want + # to rewrite it here. +-- +2.21.0 + diff --git a/bodhi.spec b/bodhi.spec index 91297f6..c8c082e 100644 --- a/bodhi.spec +++ b/bodhi.spec @@ -4,7 +4,7 @@ Name: bodhi Version: 4.0.2 -Release: 1%{?dist} +Release: 2%{?dist} BuildArch: noarch License: GPLv2+ @@ -12,6 +12,10 @@ Summary: A modular framework that facilitates publishing software updates URL: https://github.com/fedora-infra/bodhi Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +# Fix 'bodhi updates download' for updates with more than one package +# https://github.com/fedora-infra/bodhi/pull/3324 +Patch0: 0001-Fix-downloading-packages-for-updates-with-multiple-b.patch + BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: %{py3_dist alembic} @@ -308,6 +312,9 @@ install -pm0644 docs/_build/man/*.1 %{buildroot}%{_mandir}/man1/ %changelog +* Mon Jun 17 2019 Adam Williamson - 4.0.2-2 +- Backport fix for 'updates download' with multiple packages (#3324) + * Mon Jun 03 2019 Randy Barlow - 4.0.2-1 - Update to 4.0.2 (#1715576). - https://github.com/fedora-infra/bodhi/releases/tag/4.0.2