From 26bfd64822198d5cc2f517736c2aeef41a0c9a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 25 Jan 2021 12:40:27 +0100 Subject: [PATCH] spectool: Download text as text --- 77.patch | 33 +++++++++++++++++++++++++++++++++ rpmdevtools.spec | 9 ++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 77.patch diff --git a/77.patch b/77.patch new file mode 100644 index 0000000..ff603cf --- /dev/null +++ b/77.patch @@ -0,0 +1,33 @@ +From 6a582f49fa958e4ba3e374d0e77d814524111dfb Mon Sep 17 00:00:00 2001 +From: Miro Hrončok +Date: Jan 23 2021 13:15:35 +0000 +Subject: Use Accept-Encoding: identity together with decode_content=False + + +This should fix both the issues: + + - gzips decompressed: https://pagure.io/rpmdevtools/issue/72 + - texts compressed: https://pagure.io/rpmdevtools/issue/76 + + $ file tor-0.4.5.4-rc.tar.gz tor-0.4.5.4-rc.tar.gz.asc xrootd-5.0.3.tar.gz + tor-0.4.5.4-rc.tar.gz: gzip compressed data, max compression, from Unix, original size modulo 2^32 35962880 + tor-0.4.5.4-rc.tar.gz.asc: PGP signature Signature (old) + xrootd-5.0.3.tar.gz: gzip compressed data, max compression, from Unix, original size modulo 2^32 981462405 + +--- + +diff --git a/rpmdev-spectool b/rpmdev-spectool +index 56a2d43..a324fab 100755 +--- a/rpmdev-spectool ++++ b/rpmdev-spectool +@@ -239,6 +239,9 @@ def download(url, target, headers=None, tracker: Optional[ProgressTracker] = Non + headers = {} + + headers.setdefault("User-Agent", "rpmdev-spectool") ++ # identity should prevent servers from sending gzip-compressed text ++ # which would later not be decompressed because we set decode_content=False ++ headers.setdefault("Accept-Encoding", "identity") + + ret = requests.get(url, headers=headers, stream=True) + ret.raise_for_status() + diff --git a/rpmdevtools.spec b/rpmdevtools.spec index 0bd9b05..91d86ce 100644 --- a/rpmdevtools.spec +++ b/rpmdevtools.spec @@ -1,6 +1,6 @@ Name: rpmdevtools Version: 9.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: RPM Development Tools # rpmdev-setuptree is GPLv2, everything else GPLv2+ @@ -8,6 +8,10 @@ License: GPLv2+ and GPLv2 URL: https://pagure.io/rpmdevtools Source0: https://releases.pagure.org/rpmdevtools/%{name}-%{version}.tar.xz +# Use Accept-Encoding: identity together with decode_content=False +# This is to avoid text files downloaded gzipped +Patch1: https://pagure.io/rpmdevtools/pull-request/77.patch + # Fedora-specific downstream patches ## Force legacy datestamp by default until rhbz#1715412 is resolved Patch1001: 0001-Force-legacy-datestamp-while-RHBZ-1715412-is-still-a.patch @@ -116,6 +120,9 @@ echo ".so man1/rpmdev-spectool.1" > %{buildroot}%{_mandir}/man1/spectool.1 %changelog +* Mon Jan 25 2021 Miro Hrončok - 9.3-3 +- spectool: Download text as text + * Fri Jan 22 2021 Michal Domonkos - 9.3-2 - Replace requests-download dependency with requests