When forking Fedora RPM Git repositories for example to GitHub, one needs to use a unique name as the last component. If one uses prefixes to organize that namespace, either as the URL or the push URL for origin, for example inserting fedora-rpms- before a package name, fedpkg will not work in several aspects.
origin
fedora-rpms-
fedpkg
For example, sources fails:
sources
[tim@passepartout ~]$ cd "$(mktemp -d)" [tim@passepartout /tmp/tmp.CcYujAcfPB]$ fedpkg clone -a fedpkg . Klone nach '.' ... remote: Counting objects: 391, done. remote: Compressing objects: 100% (386/386), done. remote: Total 391 (delta 144), reused 65 (delta 2) Empfange Objekte: 100% (391/391), 82.61 KiB | 462.00 KiB/s, Fertig. Löse Unterschiede auf: 100% (144/144), Fertig. [tim@passepartout /tmp/tmp.CcYujAcfPB]$ git config remote.origin.pushurl git@github.com:scfc/fedora-rpms-fedpkg.git [tim@passepartout /tmp/tmp.CcYujAcfPB]$ fedpkg -v sources Creating repo object from /tmp/tmp.CcYujAcfPB Downloading fedpkg-1.35.tar.bz2 Full url: https://src.fedoraproject.org/repo/pkgs/git@github.com:scfc/fedora-rpms-fedpkg/fedpkg-1.35.tar.bz2/sha512/53ae1a6f9d2e2a8c9513ffcd10f90fbf56849e0141808f4bdabdc15711b0ca39fc09196f056a8c6210a713d029d34517f042683768d26c551fbf37c6412ddb3c/fedpkg-1.35.tar.bz2 ######################################################################## 100.0% Remove downloaded invalid file ./fedpkg-1.35.tar.bz2 Could not execute sources: Server returned status code 404 Traceback (most recent call last): File "/usr/bin/fedpkg", line 11, in <module> load_entry_point('fedpkg==1.35', 'console_scripts', 'fedpkg')() File "/usr/lib/python2.7/site-packages/fedpkg/__main__.py", line 94, in main sys.exit(client.args.command()) File "/usr/lib/python2.7/site-packages/pyrpkg/cli.py", line 2245, in sources self.cmd.sources(outdir) File "/usr/lib/python2.7/site-packages/pyrpkg/__init__.py", line 2030, in sources hashtype=entry.hashtype, **args) File "/usr/lib/python2.7/site-packages/pyrpkg/lookaside.py", line 193, in download raise DownloadError('Server returned status code %d' % status) pyrpkg.errors.DownloadError: Server returned status code 404 [tim@passepartout /tmp/tmp.CcYujAcfPB]$
As does mockbuild:
mockbuild
[tim@passepartout /tmp/tmp.CcYujAcfPB]$ wget https://src.fedoraproject.org/repo/pkgs/fedpkg/fedpkg-1.35.tar.bz2/sha512/53ae1a6f9d2e2a8c9513ffcd10f90fbf56849e0141808f4bdabdc15711b0ca39fc09196f056a8c6210a713d029d34517f042683768d26c551fbf37c6412ddb3c/fedpkg-1.35.tar.bz2 --2018-12-28 05:39:21-- https://src.fedoraproject.org/repo/pkgs/fedpkg/fedpkg-1.35.tar.bz2/sha512/53ae1a6f9d2e2a8c9513ffcd10f90fbf56849e0141808f4bdabdc15711b0ca39fc09196f056a8c6210a713d029d34517f042683768d26c551fbf37c6412ddb3c/fedpkg-1.35.tar.bz2 Auflösen des Hostnamens src.fedoraproject.org (src.fedoraproject.org)… 209.132.181.16, 209.132.181.15 Verbindungsaufbau zu src.fedoraproject.org (src.fedoraproject.org)|209.132.181.16|:443 … verbunden. HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK Länge: 50873 (50K) [application/x-bzip2] Wird in »fedpkg-1.35.tar.bz2« gespeichert. fedpkg-1.35.tar.bz2 100%[=====================================================================================>] 49,68K 141KB/s in 0,4s 2018-12-28 05:39:23 (141 KB/s) - »fedpkg-1.35.tar.bz2« gespeichert [50873/50873] [tim@passepartout /tmp/tmp.CcYujAcfPB]$ fedpkg mockbuild Erstellt: /tmp/tmp.CcYujAcfPB/fedpkg-1.35-2.fc30.src.rpm INFO: mock.py version 1.4.13 starting (python version = 3.6.7)... Start: init plugins INFO: selinux disabled Finish: init plugins Start: run ERROR: Cannot find/open srpm: /tmp/tmp.CcYujAcfPB/fedora-rpms-fedpkg-1.35-2.fc30.src.rpm. Error: [Errno 2] No such file or directory: '/tmp/tmp.CcYujAcfPB/fedora-rpms-fedpkg-1.35-2.fc30.src.rpm' Could not execute mockbuild: Failed to execute command. [tim@passepartout /tmp/tmp.CcYujAcfPB]$
Here the SRPM is successfully created with the name specified by the Name: tag and then looked up with a name derived from the push URL, but the EVR from the spec file (!).
Name:
What is interesting is that rpkg's Commands.load_repo_name() seems to have code to set repo_name from the spec file, but for Git repositories, whether they use an explicit push URL or not, repo_name is always set from the Git (push) URL.
rpkg
Commands.load_repo_name()
repo_name
Unfortunately, there are no comments in the code why for example in Commands.srpm() self.srpmname is constructed using self.repo_name and not the more natural self._package_name_spec.
Commands.srpm()
self.srpmname
self.repo_name
self._package_name_spec
If I recall correctly, the issue with getting name from spec file was that it sometimes gave wrong results. To parse the name, rpm needs to be invoked, and it expands macros based on local definitions. This is fine for a majority of packages, but was breaking with some packages there were using macros in name. I vaguely remembered it was related to software collections adding prefixes to the name or something like that.
rpm
Thanks @lsedlar for explaining the reason. @scfc I decided to not modify this case. At least for now. Maybe, there could be a solution by defining a whitelist of targets for method load_repo_name, but It would be just a question of time it would require another modification. Additionally, 3 components should be changed for this. There is a --name argument that can be used for changing the module name. If this still makes you troubles, we could consider it later again.
--name
Metadata Update from @onosek: - Issue close_status updated to: Won't fix - Issue status updated to: Closed (was: Open)
Since it is now possible to fork Fedora Git repositories on src.fedoraproject.org even for non-packagers, I'm no longer affected by this bug.