Skip to content

Commit

Permalink
Makefile: use Makefile.include from Avocado
Browse files Browse the repository at this point in the history
To allow for a better development/packaging experience, let's use the
same rules accross Avocado projects.  This syncs Makefile.include to
the exact same version proposed on Avocado.

Signed-off-by: Cleber Rosa <[email protected]>
  • Loading branch information
clebergnu committed Feb 8, 2019
1 parent fe5b55a commit ea224a3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
36 changes: 7 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ RELEASE_COMMIT=$(shell git log --abbrev=8 --pretty=format:'%H' -n 1 $(VERSION))
RELEASE_SHORT_COMMIT=$(shell git log --abbrev=8 --pretty=format:'%h' -n 1 $(VERSION))

COMMIT=$(shell git log --abbrev=8 --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 --abbrev=8 --pretty=format:'%h' -n 1)
MOCK_CONFIG=default
ARCHIVE_BASE_NAME=avocado-vt
RPM_BASE_NAME=avocado-plugins-vt

include Makefile.include

all:
@echo
Expand All @@ -35,35 +41,7 @@ all:
@echo "rpm-release: Generate binary RPMs for the latest tagged release"
@echo


source: clean
if test ! -d SOURCES; then mkdir SOURCES; fi
git archive --prefix="avocado-vt-$(COMMIT)/" -o "SOURCES/avocado-vt-$(VERSION)-$(SHORT_COMMIT).tar.gz" HEAD

source-release: clean
if test ! -d SOURCES; then mkdir SOURCES; fi
git archive --prefix="avocado-plugins-vt-$(RELEASE_COMMIT)/" -o "SOURCES/avocado-plugins-vt-$(VERSION)-$(RELEASE_SHORT_COMMIT).tar.gz" $(VERSION)

install:
$(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)

srpm: source
if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi
mock --old-chroot --resultdir BUILD/SRPM -D "commit $(COMMIT)" --buildsrpm --spec avocado-plugins-vt.spec --sources SOURCES

rpm: srpm
if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi
mock --old-chroot --resultdir BUILD/RPM -D "commit $(COMMIT)" --rebuild BUILD/SRPM/avocado-plugins-vt-$(VERSION)-*.src.rpm

srpm-release: source-release
if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi
mock --old-chroot --resultdir BUILD/SRPM -D "commit $(RELEASE_COMMIT)" --buildsrpm --spec avocado-plugins-vt.spec --sources SOURCES

rpm-release: srpm-release
if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi
mock --old-chroot --resultdir BUILD/RPM -D "commit $(RELEASE_COMMIT)" --rebuild BUILD/SRPM/avocado-plugins-vt-$(VERSION)-*.src.rpm

requirements:
requirements: pip
- $(PYTHON) -m pip install "pip>=6.0.1"
- $(PYTHON) -m pip install -r requirements.txt

Expand Down
29 changes: 29 additions & 0 deletions Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
source: clean
if test ! -d SOURCES; then mkdir SOURCES; fi
git archive --prefix="$(ARCHIVE_BASE_NAME)-$(COMMIT)/" -o "SOURCES/$(ARCHIVE_BASE_NAME)-$(SHORT_COMMIT).tar.gz" HEAD

source-release: clean
if test ! -d SOURCES; then mkdir SOURCES; fi
git archive --prefix="$(ARCHIVE_BASE_NAME)-$(VERSION)/" -o "SOURCES/$(ARCHIVE_BASE_NAME)-$(VERSION).tar.gz" $(VERSION)

install:
$(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)

srpm: source
if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --buildsrpm --spec $(RPM_BASE_NAME).spec --sources SOURCES

rpm: srpm
if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --rebuild BUILD/SRPM/$(RPM_BASE_NAME)-$(VERSION)-*.src.rpm

srpm-release: source-release
if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 1" --buildsrpm --spec $(RPM_BASE_NAME).spec --sources SOURCES

rpm-release: srpm-release
if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 1" --rebuild BUILD/SRPM/$(RPM_BASE_NAME)-$(VERSION)-*.src.rpm

pip:
$(PYTHON) -m pip --version || $(PYTHON) -m ensurepip $(PYTHON_DEVELOP_ARGS) || $(PYTHON) -c "import os; import sys; import urllib; f = urllib.urlretrieve('https://bootstrap.pypa.io/get-pip.py')[0]; os.system('%s %s' % (sys.executable, f))"

0 comments on commit ea224a3

Please sign in to comment.