未验证 提交 e43e59cc 编写于 作者: L Lukáš Doktor

Merging pull request 1431

* https://github.com/avocado-framework/avocado:
  Makefile: limit clean/link to possible plugin directories
  selftests/unit/test_utils_partition.py: also treat raised OSError
  Makefile: add explicit config to all mock commands
  Makefile: RPM repos are not hosted on COPR anymore
  Makefile: move Debian package related rules to contrib
  Makefile: add target that shows general configuration
  Makefile: silence possible setuptools warnings
...@@ -7,22 +7,21 @@ ...@@ -7,22 +7,21 @@
# https://repos-avocadoproject.rhcloud.com/static/avocado-el.repo # https://repos-avocadoproject.rhcloud.com/static/avocado-el.repo
# #
# Since the RPM build steps are based on mock, edit your chroot config # Since the RPM build steps are based on mock, edit your chroot config
# file (/etc/mock/<your-config>.cnf) and add the COPR repo configuration there. # file (/etc/mock/<your-config>.cnf) and add the corresponding repo
# configuration there.
# #
PYTHON=$(shell which python) PYTHON=$(shell which python)
PYTHON26=$(shell $(PYTHON) -V 2>&1 | grep 2.6 -q && echo true || echo false) PYTHON26=$(shell $(PYTHON) -V 2>&1 | grep 2.6 -q && echo true || echo false)
VERSION=$(shell $(PYTHON) setup.py --version) VERSION=$(shell $(PYTHON) setup.py --version 2>/dev/null)
DESTDIR=/ DESTDIR=/
BUILDIR=$(CURDIR)/debian/avocado
PROJECT=avocado
AVOCADO_DIRNAME=$(shell echo $${PWD\#\#*/}) AVOCADO_DIRNAME=$(shell echo $${PWD\#\#*/})
AVOCADO_PLUGINS=$(filter-out ../$(AVOCADO_DIRNAME), $(wildcard ../*)) AVOCADO_PLUGINS=$(filter-out ../$(AVOCADO_DIRNAME), $(shell find ../ -maxdepth 1 -mindepth 1 -type d))
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)
SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1) SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1)
MOCK_CONFIG=default
all: all:
@echo @echo
...@@ -49,11 +48,6 @@ all: ...@@ -49,11 +48,6 @@ all:
@echo "srpm: Generate a source RPM package (.srpm)" @echo "srpm: Generate a source RPM package (.srpm)"
@echo "rpm: Generate binary RPMs" @echo "rpm: Generate binary RPMs"
@echo @echo
@echo "Debian related targets:"
@echo "deb: Generate both source and binary debian packages"
@echo "deb-src: Generate a source debian package"
@echo "deb-bin: Generate a binary debian package"
@echo
@echo "Release related targets:" @echo "Release related targets:"
@echo "source-release: Create source package for the latest tagged release" @echo "source-release: Create source package for the latest tagged release"
@echo "srpm-release: Generate a source RPM package (.srpm) for the latest tagged release" @echo "srpm-release: Generate a source RPM package (.srpm) for the latest tagged release"
...@@ -83,40 +77,21 @@ pypi: source-pypi develop ...@@ -83,40 +77,21 @@ pypi: source-pypi develop
install: install:
$(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE) $(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)
deb-prepare-source:
# build the source package in the parent directory
# then rename it to project_version.orig.tar.gz
dch -D "vivid" -M -v "$(VERSION)" "Automated (make builddeb) build."
$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../
rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
deb-src: deb-prepare-source
# build the source package
dpkg-buildpackage -S -elookkas@gmail.com -rfakeroot
deb-bin: deb-prepare-source
# build binary package
dpkg-buildpackage -b -rfakeroot
deb: deb-prepare-source
# build both source and binary packages
dpkg-buildpackage -i -I -rfakeroot
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 --resultdir BUILD/SRPM -D "commit $(COMMIT)" --buildsrpm --spec avocado.spec --sources SOURCES mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "commit $(COMMIT)" --buildsrpm --spec 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 --resultdir BUILD/RPM -D "commit $(COMMIT)" --rebuild BUILD/SRPM/avocado-$(VERSION)-*.src.rpm mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "commit $(COMMIT)" --rebuild BUILD/SRPM/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 --resultdir BUILD/SRPM -D "commit $(RELEASE_COMMIT)" --buildsrpm --spec avocado.spec --sources SOURCES mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "commit $(RELEASE_COMMIT)" --buildsrpm --spec 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 --resultdir BUILD/RPM -D "commit $(RELEASE_COMMIT)" --rebuild BUILD/SRPM/avocado-$(VERSION)-*.src.rpm mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "commit $(RELEASE_COMMIT)" --rebuild BUILD/SRPM/avocado-$(VERSION)-*.src.rpm
clean: clean:
$(PYTHON) setup.py clean $(PYTHON) setup.py clean
...@@ -126,8 +101,8 @@ clean: ...@@ -126,8 +101,8 @@ clean:
rm -f man/avocado-rest-client.1 rm -f man/avocado-rest-client.1
rm -rf docs/build rm -rf docs/build
find docs/source/api/ -name '*.rst' -delete find docs/source/api/ -name '*.rst' -delete
for MAKEFILE in $(AVOCADO_PLUGINS);\ for MAKEFILE in $(AVOCADO_PLUGINS); do\
do AVOCADO_DIRNAME=$(AVOCADO_DIRNAME) make -C $$MAKEFILE unlink &>/dev/null && echo ">> UNLINK $$MAKEFILE" || echo ">> SKIP $$MAKEFILE";\ if test -f $$MAKEFILE/Makefile; then AVOCADO_DIRNAME=$(AVOCADO_DIRNAME) make -C $$MAKEFILE unlink &>/dev/null && echo ">> UNLINK $$MAKEFILE" || echo ">> SKIP $$MAKEFILE"; fi;\
done done
$(PYTHON) setup.py develop --uninstall $(shell $(PYTHON26) || echo --user) $(PYTHON) setup.py develop --uninstall $(shell $(PYTHON26) || echo --user)
rm -rf avocado.egg-info rm -rf avocado.egg-info
...@@ -175,8 +150,8 @@ develop: ...@@ -175,8 +150,8 @@ develop:
$(PYTHON) setup.py develop $(shell $(PYTHON26) || echo --user) $(PYTHON) setup.py develop $(shell $(PYTHON26) || echo --user)
link: develop link: develop
for MAKEFILE in $(AVOCADO_PLUGINS);\ for MAKEFILE in $(AVOCADO_PLUGINS); do\
do AVOCADO_DIRNAME=$(AVOCADO_DIRNAME) make -C $$MAKEFILE link &>/dev/null && echo ">> LINK $$MAKEFILE" || echo ">> SKIP $$MAKEFILE";\ if test -f $$MAKEFILE/Makefile; then AVOCADO_DIRNAME=$(AVOCADO_DIRNAME) make -C $$MAKEFILE link &>/dev/null && echo ">> LINK $$MAKEFILE" || echo ">> SKIP $$MAKEFILE"; fi;\
done done
spell: spell:
...@@ -184,7 +159,20 @@ spell: ...@@ -184,7 +159,20 @@ spell:
man: man/avocado.1 man/avocado-rest-client.1 man: man/avocado.1 man/avocado-rest-client.1
.PHONY: source install clean check link variables:
@echo "PYTHON: $(PYTHON)"
@echo "PYTHON26: $(PYTHON26)"
@echo "VERSION: $(VERSION)"
@echo "DESTDIR: $(DESTDIR)"
@echo "AVOCADO_DIRNAME: $(AVOCADO_DIRNAME)"
@echo "AVOCADO_PLUGINS: $(AVOCADO_PLUGINS)"
@echo "RELEASE_COMMIT: $(RELEASE_COMMIT)"
@echo "RELEASE_SHORT_COMMIT: $(RELEASE_SHORT_COMMIT)"
@echo "COMMIT: $(COMMIT)"
@echo "SHORT_COMMIT: $(SHORT_COMMIT)"
@echo "MOCK_CONFIG: $(MOCK_CONFIG)"
.PHONY: source install clean check link variables
# implicit rule/recipe for man page creation # implicit rule/recipe for man page creation
%.1: %.rst %.1: %.rst
......
BUILDIR=$(CURDIR)/debian/avocado
PROJECT=avocado
all:
@echo
@echo "Debian related targets:"
@echo "deb: Generate both source and binary debian packages"
@echo "deb-src: Generate a source debian package"
@echo "deb-bin: Generate a binary debian package"
@echo
deb-prepare-source:
# build the source package in the parent directory
# then rename it to project_version.orig.tar.gz
dch -D "vivid" -M -v "$(VERSION)" "Automated (make builddeb) build."
$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../
rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
deb-src: deb-prepare-source
# build the source package
dpkg-buildpackage -S -elookkas@gmail.com -rfakeroot
deb-bin: deb-prepare-source
# build binary package
dpkg-buildpackage -b -rfakeroot
deb: deb-prepare-source
# build both source and binary packages
dpkg-buildpackage -i -I -rfakeroot
This is a collection of files that are useful to generate packages for
Debian(-like) systems. Their "contrib" status mean that they should
work, but there's no support for them.
If there are users out there interested in keeping Debian(-like)
packages update, please step up.
The basic usage is to run the various targets defined in the Makefile,
such as running `make deb` to have both source and binary packages
generated.
...@@ -33,7 +33,7 @@ def cannot_sudo(command): ...@@ -33,7 +33,7 @@ def cannot_sudo(command):
try: try:
process.run(command, sudo=True) process.run(command, sudo=True)
False False
except process.CmdError: except (process.CmdError, OSError):
return True return True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册