diff options
Diffstat (limited to '0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch')
-rw-r--r-- | 0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch b/0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch new file mode 100644 index 0000000..e252038 --- /dev/null +++ b/0004-Process-source-URLs-with-fragment-in-pre-push-hook.patch @@ -0,0 +1,42 @@ +From 6d813d40aff91345b171323512b3ae641a168d45 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com> +Date: Mon, 27 Feb 2023 08:36:20 +0100 +Subject: [PATCH] Process source URLs with fragment in pre-push hook +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some download services do not have the actual filename in the URL. +Packagers work around that by adding a fragment to the URL. This is then +ignored by any server, but tricks RPM into getting the correct filename. + +Example: + + Source0: https://crates.io/api/v1/crates/actix/0.13.0/download#/actix-0.13.0.crate + +The filename is obviously `actix-0.13.0.crate`, but rpkg without this +patch will come up with `download`. + +Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com> +--- + pyrpkg/__init__.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py +index 6a0e9eb..c650851 100644 +--- a/pyrpkg/__init__.py ++++ b/pyrpkg/__init__.py +@@ -4464,7 +4464,9 @@ class Commands(object): + # find out the format of the source file path. From URL use just the file name. + # We want to keep hierarchy of the files if possible + res = urllib.parse.urlparse(file_location) +- if res.scheme and res.netloc: ++ if res.scheme and res.fragment: ++ source_files.append(os.path.basename(res.fragment)) ++ elif res.scheme and res.netloc: + source_files.append(os.path.basename(res.path)) + else: + source_files.append(file_location) +-- +2.39.2 + |