From 18257d0baf1acde7522c1bf7d10e0a588d974431 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Thu, 6 Oct 2016 12:25:35 +0200 Subject: Add inital redhat build support Rebase notes (2.2.32): - Fix license text Rebase notes (2.2.26): - update to RHEL 8 build - Do not use INSTALED_FILES for %files Rebase notes (2.2.10): - switched to sha256 - added .gitpublish profile Rebase notes (2.2.46): - added waagent-extn.logrotate Merged patches (2.2.45): - df29beb Switch from platform-python to python36 - 6749108 Stop packaging legacy waagent2.0 Merged patches (2.2.32): - ce36fd9 Use Python3 - 952c830 Remove FIPS setting from the default config - cc9df73 Switch hardcoded python3 shebangs into the %%{__python3} macro - 66b6f8c Use correct macro for waagent.service - 1b15ada Switch to platform-python in systemd unit file - 59f682b Use sys.executable to find system python Merged patches (2.2.49): - 3a23336 Mark logrotate configs with %config(noreplace) --- .gitignore | 1 + .gitpublish | 8 + azurelinuxagent/ga/update.py | 12 +- bin/waagent | 2 +- bin/waagent2.0 | 2 +- init/arch/waagent.service | 2 +- init/clearlinux/waagent.service | 2 +- init/suse/waagent | 2 +- init/waagent.service | 2 +- makepkg.py | 2 +- redhat/.gitignore | 1 + redhat/Makefile | 72 +++++++ redhat/Makefile.common | 37 ++++ redhat/WALinuxAgent.spec.template | 206 +++++++++++++++++++ redhat/rpmbuild/BUILD/.gitignore | 2 + redhat/rpmbuild/RPMS/.gitignore | 2 + redhat/rpmbuild/SOURCES/.gitignore | 2 + redhat/rpmbuild/SPECS/.gitignore | 2 + redhat/rpmbuild/SRPMS/.gitignore | 2 + redhat/scripts/frh.py | 27 +++ redhat/scripts/git-backport-diff | 327 ++++++++++++++++++++++++++++++ redhat/scripts/git-compile-check | 215 ++++++++++++++++++++ redhat/scripts/process-patches.sh | 79 ++++++++ redhat/scripts/tarball_checksum.sh | 3 + setup.py | 2 +- tests/data/ext/sample_ext-1.3.0/sample.py | 2 +- 26 files changed, 1002 insertions(+), 14 deletions(-) create mode 100644 .gitpublish create mode 100644 redhat/.gitignore create mode 100644 redhat/Makefile create mode 100644 redhat/Makefile.common create mode 100644 redhat/WALinuxAgent.spec.template create mode 100644 redhat/rpmbuild/BUILD/.gitignore create mode 100644 redhat/rpmbuild/RPMS/.gitignore create mode 100644 redhat/rpmbuild/SOURCES/.gitignore create mode 100644 redhat/rpmbuild/SPECS/.gitignore create mode 100644 redhat/rpmbuild/SRPMS/.gitignore create mode 100755 redhat/scripts/frh.py create mode 100755 redhat/scripts/git-backport-diff create mode 100755 redhat/scripts/git-compile-check create mode 100755 redhat/scripts/process-patches.sh create mode 100755 redhat/scripts/tarball_checksum.sh diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py index 6fec60e..d2a80ab 100644 --- a/azurelinuxagent/ga/update.py +++ b/azurelinuxagent/ga/update.py @@ -87,8 +87,11 @@ def get_update_handler(): def get_python_cmd(): - major_version = platform.python_version_tuple()[0] - return "python" if int(major_version) <= 2 else "python{0}".format(major_version) + if sys.executable: + return sys.executable + else: + major_version = platform.python_version_tuple()[0] + return "python" if int(major_version) <= 2 else "python{0}".format(major_version) class UpdateHandler(object): @@ -152,9 +155,8 @@ class UpdateHandler(object): # Launch the correct Python version for python-based agents cmds = textutil.safe_shlex_split(agent_cmd) - if cmds[0].lower() == "python": - cmds[0] = get_python_cmd() - agent_cmd = " ".join(cmds) + cmds[0] = get_python_cmd() + agent_cmd = " ".join(cmds) self._evaluate_agent_health(latest_agent) diff --git a/bin/waagent b/bin/waagent index 60cdf56..0443ecb 100755 --- a/bin/waagent +++ b/bin/waagent @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3.6 # # Azure Linux Agent # diff --git a/bin/waagent2.0 b/bin/waagent2.0 index 3473267..762d211 100644 --- a/bin/waagent2.0 +++ b/bin/waagent2.0 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Azure Linux Agent # diff --git a/init/arch/waagent.service b/init/arch/waagent.service index d426eb2..ff1ebab 100644 --- a/init/arch/waagent.service +++ b/init/arch/waagent.service @@ -8,7 +8,7 @@ ConditionPathExists=/etc/waagent.conf [Service] Type=simple -ExecStart=/usr/bin/python -u /usr/bin/waagent -daemon +ExecStart=/usr/bin/python3 -u /usr/bin/waagent -daemon Restart=always RestartSec=5 diff --git a/init/clearlinux/waagent.service b/init/clearlinux/waagent.service index 9afee45..c29fc1b 100644 --- a/init/clearlinux/waagent.service +++ b/init/clearlinux/waagent.service @@ -8,7 +8,7 @@ ConditionPathExists=/usr/share/defaults/waagent/waagent.conf [Service] Type=simple -ExecStart=/usr/bin/python -u /usr/bin/waagent -daemon +ExecStart=/usr/bin/python3 -u /usr/bin/waagent -daemon Restart=always RestartSec=5 diff --git a/init/suse/waagent b/init/suse/waagent index b77b0fa..317e89e 100755 --- a/init/suse/waagent +++ b/init/suse/waagent @@ -34,7 +34,7 @@ # Description: Start the MicrosoftAzureLinuxAgent ### END INIT INFO -PYTHON=/usr/bin/python +PYTHON=/usr/bin/python3 WAZD_BIN=/usr/sbin/waagent WAZD_CONF=/etc/waagent.conf WAZD_PIDFILE=/var/run/waagent.pid diff --git a/init/waagent.service b/init/waagent.service index e91f143..99f3183 100644 --- a/init/waagent.service +++ b/init/waagent.service @@ -8,7 +8,7 @@ ConditionPathExists=/etc/waagent.conf [Service] Type=simple -ExecStart=/usr/bin/python -u /usr/sbin/waagent -daemon +ExecStart=/usr/bin/python3.6 -u /usr/sbin/waagent -daemon Restart=always RestartSec=5 diff --git a/makepkg.py b/makepkg.py index 52e0eae..51c263c 100755 --- a/makepkg.py +++ b/makepkg.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import glob import os diff --git a/setup.py b/setup.py index 372807f..f0798ff 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Microsoft Azure Linux Agent setup.py # diff --git a/tests/data/ext/sample_ext-1.3.0/sample.py b/tests/data/ext/sample_ext-1.3.0/sample.py index 74bd839..bf6ed99 100755 --- a/tests/data/ext/sample_ext-1.3.0/sample.py +++ b/tests/data/ext/sample_ext-1.3.0/sample.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os -- 1.8.3.1