From 80bf4b9396f91d2932b2f9accd644b8189a42b31 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Dec 08 2016 14:56:55 +0000 Subject: add patch to support new sources format Signed-off-by: Dennis Gilmore --- diff --git a/1.patch b/1.patch new file mode 100644 index 0000000..fdb644c --- /dev/null +++ b/1.patch @@ -0,0 +1,62 @@ +From 46742b119b95230093b9b3b894aab8ba2210c038 Mon Sep 17 00:00:00 2001 +From: Lubomír Sedlář +Date: Dec 08 2016 14:02:53 +0000 +Subject: Read BSD formatted sources + + +This patch adds logic to test format of the file and then constructs the +URL appropriately. The command to verify downloaded files is updated to +check the actually used hash. + +Signed-off-by: Lubomír Sedlář + +--- + +diff --git a/AUTHORS.md b/AUTHORS.md +index c1658b1..654b506 100644 +--- a/AUTHORS.md ++++ b/AUTHORS.md +@@ -2,3 +2,4 @@ Dennis Gilmore + Pavol Babincak + Jesse Keating + Till Maas ++Lubomír Sedlář +diff --git a/bin/fedpkg b/bin/fedpkg +index f85c789..be16b27 100755 +--- a/bin/fedpkg ++++ b/bin/fedpkg +@@ -19,10 +19,28 @@ + set -e + + baseurl=http://pkgs.fedoraproject.org/repo/pkgs +-pkgname=$(basename $PWD) ++pkgname=$(basename "$PWD") + if [[ -s sources ]]; then +- while read md5sum tarball; do +- curl -H Pragma: -o ./$tarball -R -S --fail $baseurl/$pkgname/$tarball/$md5sum/$tarball +- done < sources +- md5sum -c sources ++ # Read first word of first line. For old MD5 format it's the 32 character ++ # hash. Otherwise let's assume the sources have the BSD format where lines ++ # start with hash type. ++ hashtype="$(head -n1 sources | cut -d' ' -f1 | tr '[:upper:]' '[:lower:]')" ++ if [ "${#hashtype}" -ne 32 ]; then ++ # The format is ++ # SHA512 (filename) = ABCDEF ++ # We don't care about the equals sign. We also assume all hashes are ++ # the same type, so we don't need to read it again for each line. ++ while read -r _ filename _ hash; do ++ # Remove parenthesis around tarball name ++ tarball=${filename:1:-1} ++ curl -H Pragma: -o "./$tarball" -R -S --fail "$baseurl/$pkgname/$tarball/$hashtype/$hash/$tarball" ++ done < sources ++ "${hashtype}sum" -c sources ++ else ++ # Ok, we're working with MD5. ++ while read -r md5sum tarball; do ++ curl -H Pragma: -o "./$tarball" -R -S --fail "$baseurl/$pkgname/$tarball/$md5sum/$tarball" ++ done < sources ++ md5sum -c sources ++ fi + fi + diff --git a/fedpkg-minimal.spec b/fedpkg-minimal.spec index b441dd2..8f185da 100644 --- a/fedpkg-minimal.spec +++ b/fedpkg-minimal.spec @@ -1,13 +1,13 @@ Name: fedpkg-minimal Version: 1.1.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Script to allow fedpkg fetch to work Group: Applications/System License: GPLv2+ -URL: https://fedorahosted.org/%{name} -Source0: http://fedorahosted.org/releases/f/e/%{name}/%{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +URL: https://pagure.io/%{name} +Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.gz +Patch0: 1.patch BuildArch: noarch @@ -21,6 +21,7 @@ Script for use in Koji to allow sources to be fetched %prep %setup -q +%patch0 -p1 %build @@ -34,6 +35,9 @@ install -pm 755 bin/fedpkg %{buildroot}%{_bindir}/fedpkg %{_bindir}/fedpkg %changelog +* Thu Dec 08 2016 Dennis Gilmore - 1.1.0-4 +- add patch to support new sources format + * Wed Feb 03 2016 Fedora Release Engineering - 1.1.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild