Packaging

git-build-rpm is a tool (that installs itself as a git subcommand) for packaging RPM’s. Conveniently, it handles submodules while tito and rpkg do not. First, grab the dependencies:

sudo dnf install git rpm-build perl-rpm-build-perl perl-IPC-System-Simple \
            perl-Path-Class perl-Test-Pod perl-Module-Build
pip3 install --user git-archive-all

Then build and install:

perl Build.PL
./Build
./bin/git-build-rpm --package-name git-build-rpm
sudo dnf install git-build-rpm*.rpm

At the time of writing, it does not copy over SRPM’s (which is what we really want to upload to COPR), so apply this patch:

diff --git a/bin/git-build-rpm b/bin/git-build-rpm
index 69bea6f..1d18c47 100755
--- a/bin/git-build-rpm
+++ b/bin/git-build-rpm
@@ -128,11 +128,20 @@ runx 'rpmbuild', '-ba', '--define', "_topdir $dir",
 $dir->subdir('RPMS')->recurse(callback => sub {
     my $rpm = shift;
     my $bn = $rpm->basename;
-    return if $bn !~ /[.]rpm$/;
+    return if $bn !~ /rpm$/;
     move $rpm, $bn;
     print "* Copy $bn\n" unless $opts{quiet};
 });

+$dir->subdir('SRPMS')->recurse(callback => sub {
+    my $rpm = shift;
+    my $bn = $rpm->basename;
+    return if $bn !~ /rpm$/;
+    move $rpm, $bn;
+    print "* Copy $bn\n" unless $opts{quiet};
+});
+
+
 sub _pod2usage {
     require Pod::Usage;
     Pod::Usage::pod2usage(

Now you should be able to build the SRPM and upload it to COPR like so:

git build-rpm --spec example.spec --package-name example
copr-cli build your-project /path/to/srpm.src.rpm