Bug 2224998 - Fedpkg fails in non-repo
Summary: Fedpkg fails in non-repo
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: fedpkg
Version: 38
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Ondřej Nosek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-24 08:24 UTC by Jakub Čajka
Modified: 2023-07-25 13:51 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-25 13:51:17 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.