Is there a command to tell rpkg to automatically download the source code archive from .spec informations?

$ git clone https://github.com/gumieri/copr.git
$ cd copr/nvim-packer
$ rpkg local
Wrote: /tmp/rpkg/nvim-packer-3-d61nffze/nvim-packer.spec
setting SOURCE_DATE_EPOCH=1651104000
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.C8SQY8
+ umask 022
+ cd /tmp/rpkg/nvim-packer-3-d61nffze
+ cd /tmp/rpkg/nvim-packer-3-d61nffze
+ rm -rf nvim-packer-master
+ /usr/lib/rpm/rpmuncompress -x /tmp/rpkg/nvim-packer-3-d61nffze/master.tar.gz
error: File /tmp/rpkg/nvim-packer-3-d61nffze/master.tar.gz: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.C8SQY8 (%prep)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.C8SQY8 (%prep)

Question: is there a command to tell rpkg to automatically download the archive from url and source0 parameter?

1 Like

I’m not sure about rpkg commands, but since that spec file does not use any {{{ ... }}} rpkg macros, you can use normal rpm tools like spectool (from rpmdevtools package).

spectool -g downloads all sources and patches in a spec file, or -gS for sources only.

2 Likes

spectool -g downloads all sources and patches in a spec file, or -gS for sources only.

@jn64 thanks, it works :slightly_smiling_face:

Now, I have this error:

$ spectool --get-files nvim-packer.spec
Downloading: https://github.com/wbthomason/packer.nvim/archive/master.tar.gz
|  66.3 KiB Elapsed Time: 0:00:00
Downloaded: master.tar.gz

$ rpkg local
Wrote: /tmp/rpkg/nvim-packer-6-wzxaphk6/nvim-packer.spec
setting SOURCE_DATE_EPOCH=1651104000
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.mamrGU
+ umask 022
+ cd /tmp/rpkg/nvim-packer-6-wzxaphk6
+ cd /tmp/rpkg/nvim-packer-6-wzxaphk6
+ rm -rf nvim-packer-master
+ /usr/lib/rpm/rpmuncompress -x /tmp/rpkg/nvim-packer-6-wzxaphk6/master.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd nvim-packer-master
/var/tmp/rpm-tmp.mamrGU: line 39: cd: nvim-packer-master: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.mamrGU (%prep)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.mamrGU (%prep)

:thinking:

The %autosetup macro is extracting Source0 and cd-ing into the given name.

From the spec file:

%autosetup -n %{name}-master

which evaluates to:

%autosetup -n nvim-packer-master

That is where the cd nvim-packer-master comes from.

But that does not match the name of the top-level dir in the Source0 tarball. If you open the tarball yourself and check, the top-level dir should be packer.nvim-master. That’s how GitHub creates their archives, the name is in this format <project name>-<git reference>.

So, you should change that line in the spec file to:

%autosetup -n packer.nvim-master
2 Likes