Bug 2224998

Summary: Fedpkg fails in non-repo
Product: [Fedora] Fedora Reporter: Jakub Čajka <jcajka>
Component: fedpkgAssignee: Ondřej Nosek <onosek>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: cqi, lsedlar, onosek, philip.wyett
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-25 13:51:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jakub Čajka 2023-07-24 08:24:30 UTC
Fedpkg can't be used outside of (official) repository checkout. This makes working on new or not official, like copr, packages hard.

Reproducible: Always

Steps to Reproduce:
1. Write some super-cool-new-package.spec
2. spectool -g super-cool-new-package.spec
3. fedpkg --release rawhide srpm
Actual Results:  
Failed to get repository name from Git url or pushurl
Failed to get ns from Git url or pushurl
Using super-cool-new-package.spec
Could not execute srpm: reference 'refs/heads/master' not found

Expected Results:  
Failed to get repository name from Git url or pushurl
Failed to get ns from Git url or pushurl
Using super-cool-new-package.spec
setting SOURCE_DATE_EPOCH=1686009600
Wrote: /home/packager/fedora/super-cool-new-package/super-cool-new-package-1.0.1-1.fc39.src.rpm

Comment 1 Jakub Čajka 2023-07-24 08:27:10 UTC
For the record this is with fedpkg-1.44-4.fc38.noarch and git init makes no difference.

Comment 2 Ondřej Nosek 2023-07-25 11:33:12 UTC
Hi Jakub,

I tried to recreate your issue. But so far I wasn't successful - I mean it works for me.
Maybe I didn't understand the issue or my setup is different from yours.
I chose some random code from GitHub and I made srpm from it. I didn't see the git issue you are describing.
Did I miss something or do you see some difference?



onosek@6c0f05e61fa7:/repo$ mkdir spotify-cli-linux
onosek@6c0f05e61fa7:/repo$ cd spotify-cli-linux/
onosek@6c0f05e61fa7:/repo/spotify-cli-linux$ rpm -q fedpkg
fedpkg-1.44-4.fc38.noarch
onosek@6c0f05e61fa7:/repo/spotify-cli-linux$ rpm -q python3-rpkg
python3-rpkg-1.66-8.fc38.noarch
onosek@6c0f05e61fa7:/repo/spotify-cli-linux$ mv ../xx/spotify-cli-linux.spec .
onosek@6c0f05e61fa7:/repo/spotify-cli-linux$ ls
spotify-cli-linux.spec
onosek@6c0f05e61fa7:/repo/spotify-cli-linux$ ls -l .git
ls: cannot access '.git': No such file or directory
onosek@6c0f05e61fa7:/repo/spotify-cli-linux$ spectool -g spotify-cli-linux.spec
Downloading: https://github.com/pwittchen/spotify-cli-linux/archive/refs/tags/v1.8.1.tar.gz
|  18.5 KiB Elapsed Time: 0:00:00                                                                                                                                                    
Downloaded: v1.8.1.tar.gz
onosek@6c0f05e61fa7:/repo/spotify-cli-linux$ ls
spotify-cli-linux.spec  v1.8.1.tar.gz
onosek@6c0f05e61fa7:/repo/spotify-cli-linux$ fedpkg -v --release rawhide srpm
Creating repo object from /repo/spotify-cli-linux
Failed to get repository name from Git url or pushurl
Creating repo object from /repo/spotify-cli-linux
Failed to get ns from Git url or pushurl
Initiating a koji session to https://koji.fedoraproject.org/kojihub
sources file doesn't exist. Source files download skipped.
Running: rpmbuild --define _sourcedir /repo/spotify-cli-linux --define _specdir /repo/spotify-cli-linux --define _builddir /repo/spotify-cli-linux --define _srcrpmdir /repo/spotify-cli-linux --define _rpmdir /repo/spotify-cli-linux --define _rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm --define dist %{?distprefix}.fc39 --define fedora 39 --eval %undefine rhel --define fc39 1 --nodeps -bs /repo/spotify-cli-linux/spotify-cli-linux.spec

setting SOURCE_DATE_EPOCH=1686528000
Wrote: /repo/spotify-cli-linux/spotify-cli-linux-1.8.1-2.fc39.src.rpm
onosek@6c0f05e61fa7:/repo/spotify-cli-linux$ ls
spotify-cli-linux-1.8.1-2.fc39.src.rpm  spotify-cli-linux.spec  v1.8.1.tar.gz

=============================================
My specfile looks like:

Name:           spotify-cli-linux
Version:        1.8.1
Release:        2%{?dist}

Summary:        Some cli
License:        GPLv2+ and LGPLv2
URL:            https://pagure.io/rpkg
BuildArch:      noarch
Source0:        https://github.com/pwittchen/%{name}/archive/refs/tags/v%{version}.tar.gz


%description -n %{name}
Description of the tool

Summary:        %{summary}


%prep
%autosetup -p1

%build

%install

%check

%files -n %{name}

%changelog
* Mon Jun 12 2023 Ondřej Nosek <onosek> - 1.8.1
- Rebuilt from GitHub

Comment 3 Jakub Čajka 2023-07-25 13:51:17 UTC
Interestingly I can't reproduce it now too, it works even with no explicit release set. I'm not aware that I have polluted my env anyway. Only significant change is 'dnf update' today. Closing for now, will reopen if I will be able to reproduce it again. Thank you for quick reply.