#10 Enable namespaced package name
Closed 5 years ago by kevin. Opened 6 years ago by cqi.
Unknown source enable-ns-pkgname  into  master

file added
+2
@@ -0,0 +1,2 @@

+ *.swp

+ *~

file modified
+15 -5
@@ -18,7 +18,17 @@

  # Abort on errors

  set -e

  

- pkgname=$(basename "$PWD")

+ # Defaults to namespace rpms

+ ns_pkgname="rpms/$(basename "$PWD")"

+ # Then, if fedpkg-minimal runs inside a package repository, namespaced

+ # package name is retrieved from remote url. That assumes there is only one

+ # remote, the origin, in this repository. E.g.

+ #     url = ssh://pkgs.fedoraproject.org/rpms/fedpkg.git

+ # ns_pkgname is rpms/fedpkg

+ if [ -r .git/config ]; then

+     ns_pkgname=$(grep " *url *= *" .git/config | rev | cut -d'/' -f1-2 | rev | cut -d'.' -f1)

This doesn't work if the URL does not end with .git.

Apparently I'm wrong and this is not a problem.

+ fi

+ 

  if [[ -s sources ]]; then

      # 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
@@ -31,15 +41,15 @@

          # 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

- 	    filename=${filename#(}

- 	    tarball=${filename%)}

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

+             filename=${filename#(}

+             tarball=${filename%)}

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

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

          done < sources

          md5sum -c sources

      fi

file modified
+1 -1
@@ -18,4 +18,4 @@

  # Abort on errors

  set -e

  

- baseurl=https://src.stg.fedoraproject.org/repo/pkgs fedpkg-base $@

+ baseurl=https://src.stg.fedoraproject.org/repo/rpkgs fedpkg-base $@

file modified
+2
@@ -11,6 +11,7 @@

      output=$(mktemp)

      diff=$(mktemp)

      cd "$t"

+     test -e git && cp -r git/ .git/

      fedpkg sources >"$output"

      if diff -u expected "$output" >"$diff"; then

          printf "%-40s 0K\n" "$(basename "$t")"
@@ -21,6 +22,7 @@

          echo ""

          RET=$((RET + 1))

      fi

+     test -e .git && rm -rf .git

      cd "$HERE"

      rm -f "$output" "$diff"

  done

file modified
+1 -1
@@ -1,2 +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/github-linguist-4.8.18.gem/md5/192de5f33807d72e573c54f61892fc69/github-linguist-4.8.18.gem

+ 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/rpms/test_md5_bsd/github-linguist-4.8.18.gem/md5/192de5f33807d72e573c54f61892fc69/github-linguist-4.8.18.gem

  md5sum -c sources

file modified
+1 -1
@@ -1,2 +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/entr-3.6.tar.gz/072eed7153296a8fae6ebdedefed9fd4/entr-3.6.tar.gz

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

  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/container/ansible/github-linguist-4.8.18.gem/sha512/d556ffe0062bc2c745c46e94929eab18c79fd221ffc1dd0c0ea5868428bd130d7b15eec618e9c3940b50c27559923911135770792864f3330a606132dc8819c0/github-linguist-4.8.18.gem

+ sha512sum -c sources

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

+ [remote "origin"]

+         url = ssh://cqi@pkgs.fedoraproject.org/container/ansible.git

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

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

@@ -1,2 +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/github-linguist-4.8.18.gem/sha512/d556ffe0062bc2c745c46e94929eab18c79fd221ffc1dd0c0ea5868428bd130d7b15eec618e9c3940b50c27559923911135770792864f3330a606132dc8819c0/github-linguist-4.8.18.gem

+ 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/rpms/test_sha512_bsd/github-linguist-4.8.18.gem/sha512/d556ffe0062bc2c745c46e94929eab18c79fd221ffc1dd0c0ea5868428bd130d7b15eec618e9c3940b50c27559923911135770792864f3330a606132dc8819c0/github-linguist-4.8.18.gem

  sha512sum -c sources

Signed-off-by: Chenxiong Qi cqi@redhat.com

I think in case of Fedora dist-git the pkgs component should remain in the URL.

This is current URL: https://src.fedoraproject.org/repo/pkgs/compose-utils/compose-utils-0.1.16.tar.bz2/sha512/…/compose-utils-0.1.16.tar.bz2.

If the pkgs path is removed, I'm getting 404, but https://src.fedoraproject.org/repo/pkgs/rpms/compose-utils/compose-utils-0.1.16.tar.bz2/sha512/…/compose-utils-0.1.16.tar.bz2 works.

There's one .swp file included in the PR.

Also there is a problem with the tests: the ones for the namespace expect .git/config file, but it's missing. I updated the rhpkg-simple patch to include those.

rebased onto a31f07d

6 years ago

rebased onto e841a3b

6 years ago

@lsedlar Fixed above issues. PTAL.

URL looks correct and sources for package in rpms namespace can be downloaded. The tests still don't pass for me:

$ ./tests/run-tests.sh 
test_md5_bsd                             0K
test_md5_old                             0K
test_ns_pkgname                          FAIL
DIFF:
--- expected    2017-09-25 14:34:58.473644723 +0200
+++ /tmp/tmp.ipXfesx1Mj 2017-09-25 14:37:01.089631624 +0200
@@ -1,2 +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/container/fedpkg-minimal/github-linguist-4.8.18.gem/sha512/d556ffe0062bc2c745c46e94929eab18c79fd221ffc1dd0c0ea5868428bd130d7b15eec618e9c3940b50c27559923911135770792864f3330a606132dc8819c0/github-linguist-4.8.18.gem
+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/rpms/test_ns_pkgname/github-linguist-4.8.18.gem/sha512/d556ffe0062bc2c745c46e94929eab18c79fd221ffc1dd0c0ea5868428bd130d7b15eec618e9c3940b50c27559923911135770792864f3330a606132dc8819c0/github-linguist-4.8.18.gem
 sha512sum -c sources

test_sha512_bsd                          0K

2 new commits added

  • Enable namespaced package name
  • Add .gitignore
6 years ago

Similar method is used. Now, git/config is included and copied to .git when run test. This time it should work.

Now the tests pass for me. I think this approach works, so :thumbsup: from me. Maybe it would be nice to get someone else to review as well, just to be sure.

This doesn't work if the URL does not end with .git.

Apparently I'm wrong and this is not a problem.

Is this pr still useful? Do we need to keep it opening or just close it?

I'm actually not sure. As far as I know, there was no one on Fedora side asking for lookaside in different namespaces, and so this is probably not really needed.

Yeah, I think we don't have plans for this, so I am going to just close it.

Feel free to file a new one if there's a need.

:information_source:

Pull-Request has been closed by kevin

5 years ago