diff options
author | Andrei Belov <defan@nginx.com> | 2018-01-22 16:39:31 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2018-01-22 16:39:31 +0300 |
commit | be8df0631a6fa4e5afa8c03ed5b84cec72da20d4 (patch) | |
tree | 756001955deac1252d1890cae951d397a502103d | |
parent | d1f29ed77edd5833d1e84f20ed7032377d5de960 (diff) | |
download | unit-be8df0631a6fa4e5afa8c03ed5b84cec72da20d4.tar.gz unit-be8df0631a6fa4e5afa8c03ed5b84cec72da20d4.tar.bz2 |
Packages: improved per-module dependency tracking.
-rw-r--r-- | pkg/deb/Makefile | 26 | ||||
-rw-r--r-- | pkg/deb/Makefile.go | 3 | ||||
-rw-r--r-- | pkg/deb/Makefile.go17 | 3 | ||||
-rw-r--r-- | pkg/deb/Makefile.go18 | 3 | ||||
-rw-r--r-- | pkg/deb/Makefile.go19 | 3 | ||||
-rw-r--r-- | pkg/deb/Makefile.php | 6 | ||||
-rw-r--r-- | pkg/deb/Makefile.python | 3 | ||||
-rw-r--r-- | pkg/deb/Makefile.python27 | 3 | ||||
-rw-r--r-- | pkg/deb/Makefile.python34 | 3 | ||||
-rw-r--r-- | pkg/deb/Makefile.python35 | 3 | ||||
-rw-r--r-- | pkg/deb/Makefile.python36 | 3 | ||||
-rw-r--r-- | pkg/rpm/Makefile | 26 | ||||
-rw-r--r-- | pkg/rpm/Makefile.go | 3 | ||||
-rw-r--r-- | pkg/rpm/Makefile.php | 3 | ||||
-rw-r--r-- | pkg/rpm/Makefile.python | 3 |
15 files changed, 74 insertions, 20 deletions
diff --git a/pkg/deb/Makefile b/pkg/deb/Makefile index a8eb7102..d7929f5e 100644 --- a/pkg/deb/Makefile +++ b/pkg/deb/Makefile @@ -12,7 +12,8 @@ SRCDIR= unit-$(VERSION) CODENAME = $(shell lsb_release -cs) -BUILD_DEPENDS = debhelper devscripts libxml2-utils lintian lsb-release xsltproc +BUILD_DEPENDS_unit = debhelper devscripts libxml2-utils lintian lsb-release xsltproc +BUILD_DEPENDS = $(BUILD_DEPENDS_unit) MODULES= @@ -100,6 +101,25 @@ check-build-depends: fi \ } +check-build-depends-%: + @{ \ + not_installed= ; \ + for pkg in $(BUILD_DEPENDS_unit) $(BUILD_DEPENDS_$*); do \ + dpkg -s $${pkg} >/dev/null 2>&1 ; \ + if [ $$? -ne 0 ]; then \ + not_installed="$${not_installed} $${pkg}" ; \ + fi ; \ + done ; \ + if test -n "$${not_installed}" ; then \ + echo "" >&2 ; \ + echo "The following packages are required in order to proceed:" >&2 ; \ + echo "" >&2 ; \ + echo $${not_installed} >&2 ; \ + echo "" >&2 ; \ + exit 1 ; \ + fi \ + } + debuild/$(SRCDIR)/debian: @{ \ set -e ; \ @@ -133,7 +153,7 @@ debuild/unit_$(VERSION).orig.tar.gz: | debuild/$(SRCDIR)/debian mv debuild/$(SRCDIR).tar.gz debuild/unit_$(VERSION).orig.tar.gz cd debuild && tar zxf unit_$(VERSION).orig.tar.gz -unit: debuild/unit_$(VERSION).orig.tar.gz debuild/$(SRCDIR)/debian/changelog +unit: check-build-depends-unit debuild/unit_$(VERSION).orig.tar.gz debuild/$(SRCDIR)/debian/changelog @echo "===> Building $@ package" cd debuild/$(SRCDIR) && debuild -us -uc mkdir -p debs @@ -192,7 +212,7 @@ debuild-%: debuild/unit_$(VERSION).orig.tar.gz ../../docs/changes.xml chmod +x $@/$(SRCDIR)/debian/rules ; \ } -unit-%: | debuild-% +unit-%: check-build-depends-% | debuild-% @echo "===> Building $@ package" cd debuild-$*/$(SRCDIR) && debuild -us -uc mkdir -p debs diff --git a/pkg/deb/Makefile.go b/pkg/deb/Makefile.go index 53ed6b4c..a5ce1494 100644 --- a/pkg/deb/Makefile.go +++ b/pkg/deb/Makefile.go @@ -13,7 +13,8 @@ MODULE_INSTARGS_go= go-install MODULE_SOURCES_go= unit.example-go-app \ unit.example-go-config -BUILD_DEPENDS+= golang +BUILD_DEPENDS_go= golang +BUILD_DEPENDS+= $(BUILD_DEPENDS_go) MODULE_BUILD_DEPENDS_go=,golang MODULE_DEPENDS_go=,golang diff --git a/pkg/deb/Makefile.go17 b/pkg/deb/Makefile.go17 index 8c2ee1b2..9495e416 100644 --- a/pkg/deb/Makefile.go17 +++ b/pkg/deb/Makefile.go17 @@ -13,7 +13,8 @@ MODULE_INSTARGS_go17= /usr/lib/go-1.7/bin/go-install MODULE_SOURCES_go17= unit.example-go-app \ unit.example-go1.7-config -BUILD_DEPENDS+= golang-1.7 +BUILD_DEPENDS_go17= golang-1.7 +BUILD_DEPENDS+= $(BUILD_DEPENDS_go17) MODULE_BUILD_DEPENDS_go17=,golang-1.7 MODULE_DEPENDS_go17=,golang-1.7 diff --git a/pkg/deb/Makefile.go18 b/pkg/deb/Makefile.go18 index 2f427da4..114000a8 100644 --- a/pkg/deb/Makefile.go18 +++ b/pkg/deb/Makefile.go18 @@ -13,7 +13,8 @@ MODULE_INSTARGS_go18= /usr/lib/go-1.8/bin/go-install MODULE_SOURCES_go18= unit.example-go-app \ unit.example-go1.8-config -BUILD_DEPENDS+= golang-1.8 +BUILD_DEPENDS_go18= golang-1.8 +BUILD_DEPENDS+= $(BUILD_DEPENDS_go18) MODULE_BUILD_DEPENDS_go18=,golang-1.8 MODULE_DEPENDS_go18=,golang-1.8 diff --git a/pkg/deb/Makefile.go19 b/pkg/deb/Makefile.go19 index 7be967d8..f7053274 100644 --- a/pkg/deb/Makefile.go19 +++ b/pkg/deb/Makefile.go19 @@ -13,7 +13,8 @@ MODULE_INSTARGS_go19= /usr/lib/go-1.9/bin/go-install MODULE_SOURCES_go19= unit.example-go-app \ unit.example-go1.9-config -BUILD_DEPENDS+= golang-1.9 +BUILD_DEPENDS_go19= golang-1.9 +BUILD_DEPENDS+= $(BUILD_DEPENDS_go19) MODULE_BUILD_DEPENDS_go19=,golang-1.9 MODULE_DEPENDS_go19=,golang-1.9 diff --git a/pkg/deb/Makefile.php b/pkg/deb/Makefile.php index 305bd970..492e88fd 100644 --- a/pkg/deb/Makefile.php +++ b/pkg/deb/Makefile.php @@ -14,15 +14,17 @@ MODULE_SOURCES_php= unit.example-php-app \ unit.example-php-config ifneq (,$(findstring $(CODENAME),trusty jessie)) -BUILD_DEPENDS+= php5-dev libphp5-embed +BUILD_DEPENDS_php= php5-dev libphp5-embed MODULE_BUILD_DEPENDS_php=,php5-dev,libphp5-embed MODULE_DEPENDS_php=,libphp5-embed else -BUILD_DEPENDS+= php-dev libphp-embed +BUILD_DEPENDS_php= php-dev libphp-embed MODULE_BUILD_DEPENDS_php=,php-dev,libphp-embed MODULE_DEPENDS_php=,libphp-embed endif +BUILD_DEPENDS+= $(BUILD_DEPENDS_php) + define MODULE_PREINSTALL_php mkdir -p debian/unit-php/usr/share/doc/unit-php/examples/phpinfo-app install -m 644 -p debian/unit.example-php-app debian/unit-php/usr/share/doc/unit-php/examples/phpinfo-app/index.php diff --git a/pkg/deb/Makefile.python b/pkg/deb/Makefile.python index d9274ad6..d1cbe0e1 100644 --- a/pkg/deb/Makefile.python +++ b/pkg/deb/Makefile.python @@ -13,7 +13,8 @@ MODULE_INSTARGS_python= python-install MODULE_SOURCES_python= unit.example-python-app \ unit.example-python-config -BUILD_DEPENDS+= python-dev +BUILD_DEPENDS_python= python-dev +BUILD_DEPENDS+= $(BUILD_DEPENDS_python) MODULE_BUILD_DEPENDS_python=,python-dev diff --git a/pkg/deb/Makefile.python27 b/pkg/deb/Makefile.python27 index 397678ca..8a323bd4 100644 --- a/pkg/deb/Makefile.python27 +++ b/pkg/deb/Makefile.python27 @@ -13,7 +13,8 @@ MODULE_INSTARGS_python27= python2.7-install MODULE_SOURCES_python27= unit.example-python-app \ unit.example-python2.7-config -BUILD_DEPENDS+= python2.7-dev +BUILD_DEPENDS_python27= python2.7-dev +BUILD_DEPENDS+= $(BUILD_DEPENDS_python27) MODULE_BUILD_DEPENDS_python27=,python2.7-dev diff --git a/pkg/deb/Makefile.python34 b/pkg/deb/Makefile.python34 index fc501a7c..b5818b2f 100644 --- a/pkg/deb/Makefile.python34 +++ b/pkg/deb/Makefile.python34 @@ -13,7 +13,8 @@ MODULE_INSTARGS_python34= python3.4-install MODULE_SOURCES_python34= unit.example-python-app \ unit.example-python3.4-config -BUILD_DEPENDS+= python3.4-dev +BUILD_DEPENDS_python34= python3.4-dev +BUILD_DEPENDS+= $(BUILD_DEPENDS_python34) MODULE_BUILD_DEPENDS_python34=,python3.4-dev diff --git a/pkg/deb/Makefile.python35 b/pkg/deb/Makefile.python35 index a23c99c8..6289b6af 100644 --- a/pkg/deb/Makefile.python35 +++ b/pkg/deb/Makefile.python35 @@ -13,7 +13,8 @@ MODULE_INSTARGS_python35= python3.5-install MODULE_SOURCES_python35= unit.example-python-app \ unit.example-python3.5-config -BUILD_DEPENDS+= python3.5-dev +BUILD_DEPENDS_python35= python3.5-dev +BUILD_DEPENDS+= $(BUILD_DEPENDS_python35) MODULE_BUILD_DEPENDS_python35=,python3.5-dev diff --git a/pkg/deb/Makefile.python36 b/pkg/deb/Makefile.python36 index 232687f2..fc4bac45 100644 --- a/pkg/deb/Makefile.python36 +++ b/pkg/deb/Makefile.python36 @@ -13,7 +13,8 @@ MODULE_INSTARGS_python36= python3.6-install MODULE_SOURCES_python36= unit.example-python-app \ unit.example-python3.6-config -BUILD_DEPENDS+= python3.6-dev +BUILD_DEPENDS_python36= python3.6-dev +BUILD_DEPENDS+= $(BUILD_DEPENDS_python36) MODULE_BUILD_DEPENDS_python36=,python3.6-dev diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile index 2a839444..aad26a5a 100644 --- a/pkg/rpm/Makefile +++ b/pkg/rpm/Makefile @@ -8,7 +8,8 @@ DEFAULT_RELEASE := 1 VERSION ?= $(DEFAULT_VERSION) RELEASE ?= $(DEFAULT_RELEASE) -BUILD_DEPENDS = libxml2 libxslt rpm-build rpmlint +BUILD_DEPENDS_unit = libxml2 libxslt rpm-build rpmlint +BUILD_DEPENDS = $(BUILD_DEPENDS_unit) MODULES= -include Makefile.* @@ -51,6 +52,25 @@ check-build-depends: fi \ } +check-build-depends-%: + @{ \ + not_installed= ; \ + for pkg in $(BUILD_DEPENDS_unit) $(BUILD_DEPENDS_$*); do \ + rpm -qi $${pkg} >/dev/null 2>&1 ; \ + if [ $$? -ne 0 ]; then \ + not_installed="$${not_installed} $${pkg}" ; \ + fi ; \ + done ; \ + if test -n "$${not_installed}" ; then \ + echo "" >&2 ; \ + echo "The following packages are required in order to proceed:" >&2 ; \ + echo "" >&2 ; \ + echo $${not_installed} >&2 ; \ + echo "" >&2 ; \ + exit 1 ; \ + fi \ + } + rpmbuild/SPECS: mkdir -p rpmbuild/SPECS @@ -74,7 +94,7 @@ rpmbuild/SOURCES/unit-$(VERSION).tar.gz: --transform "s#^#unit-$(VERSION)/#" \ LICENSE NOTICE CHANGES README configure auto src test -unit: rpmbuild/SPECS/unit.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz +unit: check-build-depends-unit rpmbuild/SPECS/unit.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz @echo "===> Building $@ package" ; \ rpmbuild -D "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/unit.spec && \ ln -s rpmbuild/BUILD/$@-$(VERSION)/build $@ @@ -122,7 +142,7 @@ rpmbuild/SPECS/unit-%.spec: unit.module.spec.in ../../docs/changes.xml | rpmbuil >> $@.tmp mv $@.tmp $@ -unit-%: rpmbuild/SPECS/unit-%.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz +unit-%: check-build-depends-% rpmbuild/SPECS/unit-%.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz @echo "===> Building $@ package" ; \ rpmbuild -D "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/$@.spec && \ ln -s rpmbuild/BUILD/$@-$(VERSION)/build $@ diff --git a/pkg/rpm/Makefile.go b/pkg/rpm/Makefile.go index 37cf53cb..7f2f5438 100644 --- a/pkg/rpm/Makefile.go +++ b/pkg/rpm/Makefile.go @@ -12,7 +12,8 @@ MODULE_INSTARGS_go= go-install MODULE_SOURCES_go= unit.example-go-app \ unit.example-go-config -BUILD_DEPENDS+= golang +BUILD_DEPENDS_go= golang +BUILD_DEPENDS+= $(BUILD_DEPENDS_go) define MODULE_DEFINITIONS_go diff --git a/pkg/rpm/Makefile.php b/pkg/rpm/Makefile.php index dcaee2a8..a3cbcb8c 100644 --- a/pkg/rpm/Makefile.php +++ b/pkg/rpm/Makefile.php @@ -12,7 +12,8 @@ MODULE_INSTARGS_php= php-install MODULE_SOURCES_php= unit.example-php-app \ unit.example-php-config -BUILD_DEPENDS+= php-devel php-embedded +BUILD_DEPENDS_php= php-devel php-embedded +BUILD_DEPENDS+= $(BUILD_DEPENDS_php) define MODULE_PREINSTALL_php %{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-php/examples/phpinfo-app diff --git a/pkg/rpm/Makefile.python b/pkg/rpm/Makefile.python index b954744e..21ba8a5d 100644 --- a/pkg/rpm/Makefile.python +++ b/pkg/rpm/Makefile.python @@ -12,7 +12,8 @@ MODULE_INSTARGS_python= python-install MODULE_SOURCES_python= unit.example-python-app \ unit.example-python-config -BUILD_DEPENDS+= python-devel +BUILD_DEPENDS_python= python-devel +BUILD_DEPENDS+= $(BUILD_DEPENDS_python) define MODULE_PREINSTALL_python %{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-python/examples/python-app |