#11 Accept files without trailing new-line and with empty lines
Merged 3 years ago by onosek. Opened 3 years ago by onosek.
onosek/fedpkg-minimal sources_format  into  master

file modified
+1 -1
@@ -1,6 +1,6 @@ 

  # fedpkg-minimal

  Helper script for Fedora buildystem to fetch sources. Project is hosted on

- [Fedora Hosted](https://fedorahosted.org/fedpkg-minimal/).

+ [Pagure](https://pagure.io/fedpkg-minimal).

  

  

  ## Authors

file modified
+10 -4
@@ -29,16 +29,22 @@ 

          #   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

+         while read -r _ filename _ hash || [[ -n "$filename" && -n "$hash" ]]; do

+             if [ -z "$filename" ] || [ -z "$hash" ]; then

+                 continue

+             fi

              # Remove parenthesis around tarball name

- 	    filename=${filename#(}

- 	    tarball=${filename%)}

+             filename=${filename#(}

+             tarball=${filename%)}

              curl -L -H Pragma: -o "./$tarball" -R -S --fail --retry 5 --max-time 15 "$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

+         while read -r md5sum tarball || [[ -n "$md5sum" && -n "$tarball" ]]; do

+             if [ -z "$md5sum" ] || [ -z "$tarball" ]; then

+                 continue

+             fi

              curl -L -H Pragma: -o "./$tarball" -R -S --fail --retry 5 --max-time 15 "$baseurl/$pkgname/$tarball/$md5sum/$tarball"

          done < sources

          md5sum -c sources

@@ -0,0 +1,2 @@ 

+ curl -L -H Pragma: -o ./github-linguist-4.8.18.gem -R -S --fail --retry 5 --max-time 15 https://src.fedoraproject.org/repo/pkgs/test_md5_bsd_empty_line/github-linguist-4.8.18.gem/md5/192de5f33807d72e573c54f61892fc69/github-linguist-4.8.18.gem

+ md5sum -c sources

@@ -0,0 +1,2 @@ 

+ MD5 (github-linguist-4.8.18.gem) = 192de5f33807d72e573c54f61892fc69

+ 

@@ -0,0 +1,2 @@ 

+ curl -L -H Pragma: -o ./github-linguist-4.8.18.gem -R -S --fail --retry 5 --max-time 15 https://src.fedoraproject.org/repo/pkgs/test_md5_bsd_missing_endline/github-linguist-4.8.18.gem/md5/192de5f33807d72e573c54f61892fc69/github-linguist-4.8.18.gem

+ md5sum -c sources

@@ -0,0 +1,1 @@ 

+ MD5 (github-linguist-4.8.18.gem) = 192de5f33807d72e573c54f61892fc69 

\ No newline at end of file

@@ -0,0 +1,2 @@ 

+ curl -L -H Pragma: -o ./entr-3.6.tar.gz -R -S --fail --retry 5 --max-time 15 https://src.fedoraproject.org/repo/pkgs/test_md5_old_empty_line/entr-3.6.tar.gz/072eed7153296a8fae6ebdedefed9fd4/entr-3.6.tar.gz

+ md5sum -c sources

@@ -0,0 +1,2 @@ 

+ 072eed7153296a8fae6ebdedefed9fd4  entr-3.6.tar.gz

+ 

@@ -0,0 +1,2 @@ 

+ curl -L -H Pragma: -o ./entr-3.6.tar.gz -R -S --fail --retry 5 --max-time 15 https://src.fedoraproject.org/repo/pkgs/test_md5_old_missing_endline/entr-3.6.tar.gz/072eed7153296a8fae6ebdedefed9fd4/entr-3.6.tar.gz

+ md5sum -c sources

@@ -0,0 +1,1 @@ 

+ 072eed7153296a8fae6ebdedefed9fd4  entr-3.6.tar.gz 

\ No newline at end of file

@@ -0,0 +1,2 @@ 

+ curl -L -H Pragma: -o ./github-linguist-4.8.18.gem -R -S --fail --retry 5 --max-time 15 https://src.fedoraproject.org/repo/pkgs/test_sha512_bsd_empty_line/github-linguist-4.8.18.gem/sha512/d556ffe0062bc2c745c46e94929eab18c79fd221ffc1dd0c0ea5868428bd130d7b15eec618e9c3940b50c27559923911135770792864f3330a606132dc8819c0/github-linguist-4.8.18.gem

+ sha512sum -c sources

@@ -0,0 +1,2 @@ 

+ SHA512 (github-linguist-4.8.18.gem) = d556ffe0062bc2c745c46e94929eab18c79fd221ffc1dd0c0ea5868428bd130d7b15eec618e9c3940b50c27559923911135770792864f3330a606132dc8819c0

+ 

@@ -0,0 +1,2 @@ 

+ curl -L -H Pragma: -o ./github-linguist-4.8.18.gem -R -S --fail --retry 5 --max-time 15 https://src.fedoraproject.org/repo/pkgs/test_sha512_bsd_missing_endline/github-linguist-4.8.18.gem/sha512/d556ffe0062bc2c745c46e94929eab18c79fd221ffc1dd0c0ea5868428bd130d7b15eec618e9c3940b50c27559923911135770792864f3330a606132dc8819c0/github-linguist-4.8.18.gem

+ sha512sum -c sources

@@ -0,0 +1,1 @@ 

+ SHA512 (github-linguist-4.8.18.gem) = d556ffe0062bc2c745c46e94929eab18c79fd221ffc1dd0c0ea5868428bd130d7b15eec618e9c3940b50c27559923911135770792864f3330a606132dc8819c0 

\ No newline at end of file

There are two corresponding (slightly modified) commits originated from rhpkg-simple that makes fedpkg-minimal more tolerant to 'sources' file format. Now it will handle an additional empty line(s) and missing 'endline' characters as well.

2 new commits added

  • Accept files without trailing new-line
  • Handle empty lines in sources file
3 years ago

2 new commits added

  • Accept files without trailing new-line
  • Handle empty lines in sources file
3 years ago

Pull-Request has been merged by onosek

3 years ago