Module: check_mk
Branch: master
Commit: afcd78dda70cf4323b7d850a337d1e8d4a9475a1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=afcd78dda70cf4…
Author: Andreas Umbreit <au(a)mathias-kettner.de>
Date: Tue Mar 20 16:34:35 2018 +0100
cmk-update-agent: Fix Make procedure (Windows and Linux)
- Don't download sources
- Fail when sources are missing (before starting the build target)
- Add targets for manual download
Change-Id: I1721463602c4a5567bb444be3b0fd1044d77b0ff
---
agents/windows/.gitignore | 4 +-
.../windows/frozen_binaries/pyinstaller-deps.make | 117 +++++++++++++--------
.../windows/frozen_binaries/src/python-2.7.12.msi | Bin 0 -> 18907136 bytes
.../windows/frozen_binaries/src/vcredist_x86.exe | Bin 0 -> 4479832 bytes
4 files changed, 78 insertions(+), 43 deletions(-)
diff --git a/agents/windows/.gitignore b/agents/windows/.gitignore
index 72a756e..3f77551 100644
--- a/agents/windows/.gitignore
+++ b/agents/windows/.gitignore
@@ -16,7 +16,7 @@ testtools
*.d
*.o
chroot
-*.exe
-*.msi
+/*.exe
+/*.msi
Makefile.in
junit.xml
diff --git a/agents/windows/frozen_binaries/pyinstaller-deps.make
b/agents/windows/frozen_binaries/pyinstaller-deps.make
index 1b0530a..e46f3dd 100644
--- a/agents/windows/frozen_binaries/pyinstaller-deps.make
+++ b/agents/windows/frozen_binaries/pyinstaller-deps.make
@@ -1,33 +1,40 @@
-.PHONY: new_packages actual_packages
-
# Python 2.7.13 yields a bug concerning the LoadLibrary() function on windows,
# see
http://bugs.python.org/issue29082 . Use 2.7.12 instead.
PYTHON_VERSION = 2.7.12
-BUILD_DIR = $(shell realpath ./../../winbuild)
-PLUGINS_DIR = $(shell realpath ./../../plugins)
+BUILD_DIR := $(shell realpath ./../../winbuild)
+PLUGINS_DIR := $(shell realpath ./../../plugins)
+
+ifndef SRC_DIR # Don't overwrite SRC_DIR if specified by calling Makefile
+ SRC_DIR := $(shell realpath src)
+endif
+
# This package list originates from resolving the dependencies of the packages
# pyinstaller, pyopenssl, requests. The required packages are explicitly listed
# in favor of providing a working setup for a pyinstaller build with python 2.7
-asn1crypto = src/pip/asn1crypto-0.22.0-py2.py3-none-any.whl
-certifi = src/pip/certifi-2017.7.27.1-py2.py3-none-any.whl
-cffi = src/pip/cffi-1.10.0-cp27-cp27m-win32.whl
-chardet = src/pip/chardet-3.0.4-py2.py3-none-any.whl
-crytography = src/pip/cryptography-2.0.3-cp27-cp27m-win32.whl
-enum34 = src/pip/enum34-1.1.6-py2-none-any.whl
-future = src/pip/future-0.16.0.tar.gz
-idna = src/pip/idna-2.6-py2.py3-none-any.whl
-ipaddress = src/pip/ipaddress-1.0.18-py2-none-any.whl
-pycparser = src/pip/pycparser-2.18.tar.gz
-PyInstaller = src/pip/PyInstaller-3.2.1.tar.bz2
-pyOpenSSL = src/pip/pyOpenSSL-17.2.0-py2.py3-none-any.whl
-pypiwin32 = src/pip/pypiwin32-219-cp27-none-win32.whl
-requests = src/pip/requests-2.18.4-py2.py3-none-any.whl
-setuptools = src/pip/setuptools-36.2.7-py2.py3-none-any.whl
-six = src/pip/six-1.10.0-py2.py3-none-any.whl
-urllib3 = src/pip/urllib3-1.22-py2.py3-none-any.whl
+# Match package names with their filenames in order to reference them
+asn1crypto = $(SRC_DIR)/pip/asn1crypto-0.22.0-py2.py3-none-any.whl
+certifi = $(SRC_DIR)/pip/certifi-2017.7.27.1-py2.py3-none-any.whl
+cffi = $(SRC_DIR)/pip/cffi-1.10.0-cp27-cp27m-win32.whl
+chardet = $(SRC_DIR)/pip/chardet-3.0.4-py2.py3-none-any.whl
+crytography = $(SRC_DIR)/pip/cryptography-2.0.3-cp27-cp27m-win32.whl
+enum34 = $(SRC_DIR)/pip/enum34-1.1.6-py2-none-any.whl
+future = $(SRC_DIR)/pip/future-0.16.0.tar.gz
+idna = $(SRC_DIR)/pip/idna-2.6-py2.py3-none-any.whl
+ipaddress = $(SRC_DIR)/pip/ipaddress-1.0.18-py2-none-any.whl
+pycparser = $(SRC_DIR)/pip/pycparser-2.18.tar.gz
+PyInstaller = $(SRC_DIR)/pip/PyInstaller-3.2.1.tar.bz2
+pyOpenSSL = $(SRC_DIR)/pip/pyOpenSSL-17.2.0-py2.py3-none-any.whl
+pypiwin32 = $(SRC_DIR)/pip/pypiwin32-219-cp27-none-win32.whl
+requests = $(SRC_DIR)/pip/requests-2.18.4-py2.py3-none-any.whl
+setuptools = $(SRC_DIR)/pip/setuptools-36.2.7-py2.py3-none-any.whl
+six = $(SRC_DIR)/pip/six-1.10.0-py2.py3-none-any.whl
+urllib3 = $(SRC_DIR)/pip/urllib3-1.22-py2.py3-none-any.whl
-PYTHON_PACKAGES = \
+# This list expands to filenames and is meant to be used
+# as depencencie(s). There must not be matching targets in order
+# to prevent automatic download
+PYTHON_PACKAGE_FILES = \
$(asn1crypto) \
$(certifi) \
$(cffi) \
@@ -46,6 +53,30 @@ PYTHON_PACKAGES = \
$(six) \
$(urllib3)
+# This list is meant to be used as target(s) for manual download
+PYTHON_PACKAGES = \
+ asn1crypto \
+ certifi \
+ cffi \
+ chardet \
+ crytography \
+ enum34 \
+ future \
+ idna \
+ ipaddress \
+ pycparser \
+ PyInstaller \
+ pyOpenSSL \
+ pypiwin32 \
+ requests \
+ setuptools \
+ six \
+ urllib3
+
+# Matching from filename to download-string.
+# When used as target, the target variable
+# must be extended two times in order to obtain the desired download-string.
+# E.g. make PyInstaller -> pip download $($($@))
$(asn1crypto) := asn1crypto==0.22.0
$(certifi) := certifi==2017.7.27.1
$(cffi) := cffi==1.10.0
@@ -64,19 +95,20 @@ $(setuptools) := setuptools==36.2.7
$(six) := six==1.10.0
$(urllib3) := urllib3==1.22
-src/python-$(PYTHON_VERSION).msi:
- mkdir -p src && \
- cd src && \
- curl -O
https://www.python.org/ftp/python/$(PYTHON_VERSION)/python-$(PYTHON_VERSION…
-$(BUILD_DIR)/drive_c/Python27/python.exe: src/python-$(PYTHON_VERSION).msi
+$(BUILD_DIR)/drive_c/Python27/python.exe: $(SRC_DIR)/python-$(PYTHON_VERSION).msi
mkdir -p $(BUILD_DIR) && \
export WINEPREFIX=$(BUILD_DIR) && \
cd $(BUILD_DIR) && \
- cp $(CURDIR)/src/python-$(PYTHON_VERSION).msi . && \
+ cp $(SRC_DIR)/python-$(PYTHON_VERSION).msi . && \
wine msiexec /qn /i python-$(PYTHON_VERSION).msi && \
touch $(BUILD_DIR)/drive_c/Python27/python.exe
+.PHONY: setup new_packages download_packages \
+download_vcredist download_python $(PYTHON_PACKAGES)
+
+download_packages: $(PYTHON_PACKAGES)
+
$(PYTHON_PACKAGES): $(BUILD_DIR)/drive_c/Python27/python.exe
# Download needed python packages including depencencies. This has to be done
# from within wine to obtain the correct win32 packages.
@@ -88,21 +120,21 @@ $(PYTHON_PACKAGES): $(BUILD_DIR)/drive_c/Python27/python.exe
cd $(BUILD_DIR) && \
mkdir -p pip && \
cd pip && \
- wine c:\\Python27\\python.exe -m pip download --no-deps $($@) && \
- mkdir -p $(CURDIR)/src/pip && \
- cp --no-clobber -r * $(CURDIR)/src/pip
+ wine c:\\Python27\\python.exe -m pip download --no-deps $($($@)) && \
+ mkdir -p $(SRC_DIR)/pip && \
+ cp --no-clobber -r * $(SRC_DIR)/pip
-current_packages: $(PYTHON_PACKAGES)
+download_python:
+ mkdir -p $(SRC_DIR) && \
+ cd $(SRC_DIR) && \
+ curl -O
https://www.python.org/ftp/python/$(PYTHON_VERSION)/python-$(PYTHON_VERSION…
-src/vcredist_x86.exe:
- mkdir -p src && \
- cd src && \
+download_vcredist:
+ mkdir -p $(SRC_DIR) && \
+ cd $(SRC_DIR) && \
curl -O
https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966…
-download_sources: src/python-$(PYTHON_VERSION).msi current_packages src/vcredist_x86.exe
-
-setup:
- sudo apt-get install scons upx-ucl wine
+download_sources: download_python download_packages download_vcredist
new_packages: $(BUILD_DIR)/drive_c/Python27/python.exe
# Use this target to obtain the newest versions of the needed packages.
@@ -117,5 +149,8 @@ new_packages: $(BUILD_DIR)/drive_c/Python27/python.exe
wine c:\\Python27\\python.exe -m pip download requests && \
wine c:\\Python27\\python.exe -m pip download pyinstaller && \
wine c:\\Python27\\python.exe -m pip download pyOpenSSL && \
- mkdir -p $(CURDIR)/src/pip && \
- cp -r * $(CURDIR)/src/pip
\ No newline at end of file
+ mkdir -p $(SRC_DIR)/pip && \
+ cp -r * $(SRC_DIR)/pip
+
+setup:
+ sudo apt-get install scons upx-ucl wine
\ No newline at end of file
diff --git a/agents/windows/frozen_binaries/src/python-2.7.12.msi
b/agents/windows/frozen_binaries/src/python-2.7.12.msi
new file mode 100644
index 0000000..c4669ec
Binary files /dev/null and b/agents/windows/frozen_binaries/src/python-2.7.12.msi differ
diff --git a/agents/windows/frozen_binaries/src/vcredist_x86.exe
b/agents/windows/frozen_binaries/src/vcredist_x86.exe
new file mode 100644
index 0000000..4170330
Binary files /dev/null and b/agents/windows/frozen_binaries/src/vcredist_x86.exe differ