提交 443c5591 编写于 作者: C Cleber Rosa

SPEC file: sync how we build snapshot and release packages

Downstream (Fedora and EPEL) RPM packages have had a different way
of building release (by default) and snapshot packages by editing
the SPEC file.

Let's sync with them, while also allowing snapshot packages to be
built from our usual `make rpm` command.  Release builds are still
supported with `make rpm-release`.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 9865f1d7
...@@ -28,6 +28,7 @@ AVOCADO_PLUGINS=$(AVOCADO_OPTIONAL_PLUGINS) $(AVOCADO_EXTERNAL_PLUGINS) ...@@ -28,6 +28,7 @@ AVOCADO_PLUGINS=$(AVOCADO_OPTIONAL_PLUGINS) $(AVOCADO_EXTERNAL_PLUGINS)
RELEASE_COMMIT=$(shell git log --pretty=format:'%H' -n 1 $(VERSION)) RELEASE_COMMIT=$(shell git log --pretty=format:'%H' -n 1 $(VERSION))
RELEASE_SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1 $(VERSION)) RELEASE_SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1 $(VERSION))
COMMIT=$(shell git log --pretty=format:'%H' -n 1) 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) SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1)
MOCK_CONFIG=default MOCK_CONFIG=default
...@@ -64,11 +65,11 @@ all: ...@@ -64,11 +65,11 @@ all:
source: clean source: clean
if test ! -d SOURCES; then mkdir SOURCES; fi if test ! -d SOURCES; then mkdir SOURCES; fi
git archive --prefix="avocado-$(COMMIT)/" -o "SOURCES/avocado-$(VERSION)-$(SHORT_COMMIT).tar.gz" HEAD git archive --prefix="avocado-$(COMMIT)/" -o "SOURCES/avocado-$(SHORT_COMMIT).tar.gz" HEAD
source-release: clean source-release: clean
if test ! -d SOURCES; then mkdir SOURCES; fi if test ! -d SOURCES; then mkdir SOURCES; fi
git archive --prefix="avocado-$(RELEASE_COMMIT)/" -o "SOURCES/avocado-$(VERSION)-$(RELEASE_SHORT_COMMIT).tar.gz" $(VERSION) git archive --prefix="avocado-$(VERSION)/" -o "SOURCES/avocado-$(VERSION).tar.gz" $(VERSION)
source-pypi: clean source-pypi: clean
if test ! -d PYPI_UPLOAD; then mkdir PYPI_UPLOAD; fi if test ! -d PYPI_UPLOAD; then mkdir PYPI_UPLOAD; fi
...@@ -103,19 +104,19 @@ install: ...@@ -103,19 +104,19 @@ install:
srpm: source srpm: source
if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "commit $(COMMIT)" --buildsrpm --spec python-avocado.spec --sources SOURCES mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --buildsrpm --spec python-avocado.spec --sources SOURCES
rpm: srpm rpm: srpm
if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "commit $(COMMIT)" --rebuild BUILD/SRPM/python-avocado-$(VERSION)-*.src.rpm mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --rebuild BUILD/SRPM/python-avocado-$(VERSION)-*.src.rpm
srpm-release: source-release srpm-release: source-release
if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "commit $(RELEASE_COMMIT)" --buildsrpm --spec python-avocado.spec --sources SOURCES mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 1" --buildsrpm --spec python-avocado.spec --sources SOURCES
rpm-release: srpm-release rpm-release: srpm-release
if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "commit $(RELEASE_COMMIT)" --rebuild BUILD/SRPM/python-avocado-$(VERSION)-*.src.rpm mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 1" --rebuild BUILD/SRPM/python-avocado-$(VERSION)-*.src.rpm
clean: clean:
$(PYTHON) setup.py clean $(PYTHON) setup.py clean
...@@ -204,6 +205,7 @@ variables: ...@@ -204,6 +205,7 @@ variables:
@echo "RELEASE_COMMIT: $(RELEASE_COMMIT)" @echo "RELEASE_COMMIT: $(RELEASE_COMMIT)"
@echo "RELEASE_SHORT_COMMIT: $(RELEASE_SHORT_COMMIT)" @echo "RELEASE_SHORT_COMMIT: $(RELEASE_SHORT_COMMIT)"
@echo "COMMIT: $(COMMIT)" @echo "COMMIT: $(COMMIT)"
@echo "COMMIT_DATE: $(COMMIT_DATE)"
@echo "SHORT_COMMIT: $(SHORT_COMMIT)" @echo "SHORT_COMMIT: $(SHORT_COMMIT)"
@echo "MOCK_CONFIG: $(MOCK_CONFIG)" @echo "MOCK_CONFIG: $(MOCK_CONFIG)"
@echo "PYTHON_DEVELOP_ARGS: $(PYTHON_DEVELOP_ARGS)" @echo "PYTHON_DEVELOP_ARGS: $(PYTHON_DEVELOP_ARGS)"
......
%global srcname avocado %global srcname avocado
# Conditional for release vs. snapshot builds. Set to 1 for release build.
%if ! 0%{?rel_build:1}
%global rel_build 1
%endif
# Settings used for build from snapshots.
%if 0%{?rel_build}
%global gittar %{srcname}-%{version}.tar.gz
%else
%if ! 0%{?commit:1} %if ! 0%{?commit:1}
%define commit 1d717446d28ff852fe5de895f14c7985c63ada3e %global commit 817c25c2bbedb6d43e5fa2ad0a78698f1416ab49
%endif
%if ! 0%{?commit_date:1}
%global commit_date 20170407
%endif
%global shortcommit %(c=%{commit};echo ${c:0:7})
%global gitrel .%{commit_date}git%{shortcommit}
%global gittar %{srcname}-%{shortcommit}.tar.gz
%endif %endif
%global shortcommit %(c=%{commit}; echo ${c:0:7})
# selftests are provided but may need to skipped because many of # selftests are provided but may need to skipped because many of
# functional tests are time and resource sensitive and can # functional tests are time and resource sensitive and can
...@@ -13,11 +29,15 @@ ...@@ -13,11 +29,15 @@
Summary: Framework with tools and libraries for Automated Testing Summary: Framework with tools and libraries for Automated Testing
Name: python-%{srcname} Name: python-%{srcname}
Version: 48.0 Version: 48.0
Release: 1%{?dist} Release: 2%{?gitrel}%{?dist}
License: GPLv2 License: GPLv2
Group: Development/Tools Group: Development/Tools
URL: http://avocado-framework.github.io/ URL: http://avocado-framework.github.io/
Source0: https://github.com/avocado-framework/%{srcname}/archive/%{commit}/%{srcname}-%{version}-%{shortcommit}.tar.gz %if 0%{?rel_build}
Source0: https://github.com/avocado-framework/%{srcname}/archive/%{version}.tar.gz#/%{gittar}
%else
Source0: https://github.com/avocado-framework/%{srcname}/archive/%{commit}.tar.gz#/%{gittar}
%endif
BuildArch: noarch BuildArch: noarch
BuildRequires: fabric BuildRequires: fabric
BuildRequires: procps-ng BuildRequires: procps-ng
...@@ -85,7 +105,11 @@ Avocado is a set of tools and libraries (what people call ...@@ -85,7 +105,11 @@ Avocado is a set of tools and libraries (what people call
these days a framework) to perform automated testing. these days a framework) to perform automated testing.
%prep %prep
%if 0%{?rel_build}
%setup -q -n %{srcname}-%{version}
%else
%setup -q -n %{srcname}-%{commit} %setup -q -n %{srcname}-%{commit}
%endif
# package plugins-runner-vm requires libvirt-python, but the RPM # package plugins-runner-vm requires libvirt-python, but the RPM
# version of libvirt-python does not publish the egg info and this # version of libvirt-python does not publish the egg info and this
# causes that dep to be attempted to be installed by pip # causes that dep to be attempted to be installed by pip
...@@ -259,7 +283,10 @@ examples of how to write tests on your own. ...@@ -259,7 +283,10 @@ examples of how to write tests on your own.
%{_datadir}/avocado/wrappers %{_datadir}/avocado/wrappers
%changelog %changelog
* Mon Apr 3 2017 Cleber Rosa <cleber@localhost.localdomain> - 48.0-1 * Mon Apr 10 2017 Cleber Rosa <cleber@redhat.com> - 48.0-2
- Update how release and snapshot packages are built
* Mon Apr 3 2017 Cleber Rosa <cleber@redhat.com> - 48.0-1
- Updated exclude directives and files for optional plugins - Updated exclude directives and files for optional plugins
* Mon Apr 3 2017 Cleber Rosa <cleber@redhat.com> - 48.0-0 * Mon Apr 3 2017 Cleber Rosa <cleber@redhat.com> - 48.0-0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册