Skip to content

Commit

Permalink
COPR SCM/"make srpm" support
Browse files Browse the repository at this point in the history
This adds a Makefile that adds support for the Fedora COPR service to
build packages for Avocado-VT, right out of a Git repo.  To do so,
create your project, and in "Builds" tab, select "New Build".

On "1. Select source type" section, select "SCM".  On section
"2. Provide the source", under "Clone url" add the URL of your repo.
For instance, this has been tested with:

  https://github.com/clebergnu/avocado-vt

Under "Committish", enter a reference to a given commit.  For instance, this
has been tested with the name of this branch: "copr_makefile".

Under "3. How to build SRPM from the source", select "make srpm".
Finally, select the appropriate Chroots.  It's better not to have
"Enable internet access during this build" option checked.

Finally, it's advisable to not attempt to run this Makefile locally,
as it's designed to be run on the environment that CORP provides, that
is, a mock based chroot with super user privileges.

Signed-off-by: Cleber Rosa <[email protected]>
  • Loading branch information
clebergnu committed Feb 8, 2019
1 parent ea224a3 commit cd67a68
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .copr/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pkg_install := $(shell dnf -y install git rpm-build)
commit := $(shell git log --pretty=format:'%H' -n 1)
commit_date := $(shell git log --pretty='format:%cd' --date='format:%Y%m%d' -n 1)
short_commit := $(shell git log --pretty=format:'%h' -n 1)

srpm:
if test ! -d SOURCES; then mkdir SOURCES; fi
if test ! -d SPEC; then mkdir SPEC; fi
git archive --prefix="avocado-vt-$(commit)/" -o "SOURCES/avocado-vt-$(short_commit).tar.gz" HEAD
cp avocado-plugins-vt.spec SPEC
sed -i -e 's/\%global rel_build .*/\%global rel_build 0/' SPEC/avocado-plugins-vt.spec
sed -i -e 's/\%global commit .*/\%global commit $(commit)/' SPEC/avocado-plugins-vt.spec
sed -i -e 's/\%global commit_date .*/\%global commit_date $(commit_date)/' SPEC/avocado-plugins-vt.spec
rpmbuild -D '_topdir .' -bs SPEC/avocado-plugins-vt.spec
mv SRPMS/*.src.rpm $(outdir)

0 comments on commit cd67a68

Please sign in to comment.