diff options
author | grembo <grembo@FreeBSD.org> | 2019-09-19 08:21:10 +0800 |
---|---|---|
committer | grembo <grembo@FreeBSD.org> | 2019-09-19 08:21:10 +0800 |
commit | 2a7a32bfcee6617db79479d3223c70b6217b8f68 (patch) | |
tree | b05594c5c722f82a5dfe4ab59aae1e182e1f3a4f /sysutils | |
parent | e474cb5806c813de4658dde1ae1b1944cdbf28e2 (diff) | |
download | freebsd-ports-gnome-2a7a32bfcee6617db79479d3223c70b6217b8f68.tar.gz freebsd-ports-gnome-2a7a32bfcee6617db79479d3223c70b6217b8f68.tar.zst freebsd-ports-gnome-2a7a32bfcee6617db79479d3223c70b6217b8f68.zip |
Fix `iocage upgrade' for 11.3-RELEASE and upcoming 12.1-RELEASE[0]
Also:
- Fix dependencies when upgrading <12 jails running on a 12-RELEASE jailhost
(depend on `merge' from devel/rcs57).
- Fix to unbreak updating multiple jails at once[1].
- Patch to `setup.py' to make `make check-plist' pass[2].
- Move `NO_ARCH' to make portlint happy
See:
[0]https://github.com/iocage/iocage/pull/1027 and
https://github.com/iocage/iocage/commit/f66d9f0724daa03dc08cebc3f30b04abc7e97f82
[1]https://github.com/iocage/iocage/commit/47d7c28ad2db76eaba797921555bbf68a476eb9b#diff-134cbca4d064a61a693d1199494d24df
[2]https://github.com/iocage/iocage/issues/1043
PR: 240177
Approved by: araujo (maintainer timeout)
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/iocage/Makefile | 7 | ||||
-rw-r--r-- | sysutils/iocage/files/patch-iocage_lib-ioc_upgrade.py | 105 | ||||
-rw-r--r-- | sysutils/iocage/files/patch-setup.py | 50 |
3 files changed, 160 insertions, 2 deletions
diff --git a/sysutils/iocage/Makefile b/sysutils/iocage/Makefile index 1ebfcbdf30ff..2cec8fbe6be9 100644 --- a/sysutils/iocage/Makefile +++ b/sysutils/iocage/Makefile @@ -2,6 +2,7 @@ PORTNAME= iocage PORTVERSION= 1.1 +PORTREVISION= 1 CATEGORIES= sysutils python PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -22,13 +23,15 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}netifaces>0:net/py-netifaces@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}requests>=2.11.1:www/py-requests@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}libzfs>=1.0.2:devel/py-libzfs@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}dulwich>0:devel/dulwich@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}dnspython>0:dns/py-dnspython@${PY_FLAVOR} + ${PYTHON_PKGNAMEPREFIX}dnspython>0:dns/py-dnspython@${PY_FLAVOR} \ + merge:devel/rcs57 -NO_ARCH= yes USES= python:3.6+ USE_GITHUB= yes USE_PYTHON= autoplist distutils +NO_ARCH= yes + CONFLICTS= py27-iocage-[0-9]* .include <bsd.port.mk> diff --git a/sysutils/iocage/files/patch-iocage_lib-ioc_upgrade.py b/sysutils/iocage/files/patch-iocage_lib-ioc_upgrade.py new file mode 100644 index 000000000000..019143bb2262 --- /dev/null +++ b/sysutils/iocage/files/patch-iocage_lib-ioc_upgrade.py @@ -0,0 +1,105 @@ +This patch can most likely be removed when updating to iocage 1.2, +See +https://github.com/iocage/iocage/pull/1027 and +https://github.com/iocage/iocage/commit/f66d9f0724daa03dc08cebc3f30b04abc7e97f82 +--- iocage_lib/ioc_upgrade.py.orig 2019-01-25 21:32:55 UTC ++++ iocage_lib/ioc_upgrade.py +@@ -24,6 +24,7 @@ + """iocage upgrade module""" + import datetime + import fileinput ++import hashlib + import os + import pathlib + import subprocess as su +@@ -80,9 +81,12 @@ class IOCUpgrade(iocage_lib.ioc_json.IOCZFS): + } + + self.callback = callback +- # Work around for https://github.com/freebsd/freebsd/commit/bffa924f +- os.environ['UNAME_r'] = self.jail_release + ++ # symbolic link created on fetch by freebsd-update ++ bd_hash = hashlib.sha256((self.path + '\n').encode('utf-8')).hexdigest() ++ self.freebsd_install_link = os.path.join(self.path, ++ 'var/db/freebsd-update', bd_hash + '-install') ++ + def upgrade_jail(self): + tmp_dataset = self.zfs_get_dataset_name('/tmp') + tmp_val = self.zfs_get_property(tmp_dataset, 'exec') +@@ -142,44 +146,26 @@ class IOCUpgrade(iocage_lib.ioc_json.IOCZFS): + callback=self.callback + ) + else: +- try: +- iocage_lib.ioc_exec.InteractiveExec( +- fetch_cmd, +- self.path.replace('/root', ''), +- uuid=self.uuid, +- unjailed=True +- ) +- except iocage_lib.ioc_exceptions.CommandFailed: +- self.__rollback_jail__() +- msg = f'Upgrade failed! Rolling back jail' ++ iocage_lib.ioc_exec.InteractiveExec( ++ fetch_cmd, ++ self.path.replace('/root', ''), ++ uuid=self.uuid, ++ unjailed=True ++ ) ++ ++ if not os.path.islink(self.freebsd_install_link): ++ msg = f'Upgrade failed, nothing to install after fetch!' + iocage_lib.ioc_common.logit( + { +- "level": "EXCEPTION", +- "message": msg ++ 'level': 'EXCEPTION', ++ 'message': msg + }, + _callback=self.callback, + silent=self.silent + ) + +- if not self.interactive: +- while not self.__upgrade_install__(tmp.name): +- pass +- else: +- # FreeBSD update loops 3 times +- for _ in range(3): +- try: +- self.__upgrade_install__(tmp.name) +- except iocage_lib.ioc_exceptions.CommandFailed: +- self.__rollback_jail__() +- msg = f'Upgrade failed! Rolling back jail' +- iocage_lib.ioc_common.logit( +- { +- 'level': 'EXCEPTION', +- 'message': msg +- }, +- _callback=self.callback, +- silent=self.silent +- ) ++ while os.path.islink(self.freebsd_install_link): ++ self.__upgrade_install__(tmp.name) + + new_release = iocage_lib.ioc_common.get_jail_freebsd_version( + self.path, +@@ -353,16 +339,10 @@ class IOCUpgrade(iocage_lib.ioc_json.IOCZFS): + unjailed=True, + callback=self.callback, + ) as _exec: +- update_output = iocage_lib.ioc_common.consume_and_log( ++ iocage_lib.ioc_common.consume_and_log( + _exec, + callback=self.callback + ) +- +- for i in update_output: +- if i == 'No updates are available to install.': +- return True +- +- return False + else: + iocage_lib.ioc_exec.InteractiveExec( + install_cmd, diff --git a/sysutils/iocage/files/patch-setup.py b/sysutils/iocage/files/patch-setup.py new file mode 100644 index 000000000000..aa06e3c7fd98 --- /dev/null +++ b/sysutils/iocage/files/patch-setup.py @@ -0,0 +1,50 @@ +See https://github.com/iocage/iocage/issues/1043 +--- setup.py.orig 2019-01-25 21:32:55 UTC ++++ setup.py +@@ -43,26 +43,26 @@ if sys.version_info < (3, 6): + + VERSION = '1.1' + +-setup( +- name='iocage_lib', +- version=VERSION, +- description='A jail manager that uses ZFS.', +- author='iocage Contributors', +- author_email='https://groups.google.com/forum/#!forum/iocage', +- url='https://github.com/iocage/iocage', +- packages=find_packages(), +- include_package_data=True, +- install_requires=[ +- 'dulwich>=0.18.6', +- 'netifaces>=0.10.8', +- 'dnspython>=1.15.0', +- 'libzfs' +- ], +- setup_requires=['pytest-runner'], +- entry_points={'console_scripts': ['iocage = iocage_lib:cli']}, +- data_files=_data, +- tests_require=['pytest', 'pytest-cov', 'pytest-pep8'] +-) ++#setup( ++# name='iocage_lib', ++# version=VERSION, ++# description='A jail manager that uses ZFS.', ++# author='iocage Contributors', ++# author_email='https://groups.google.com/forum/#!forum/iocage', ++# url='https://github.com/iocage/iocage', ++# packages=find_packages(), ++# include_package_data=True, ++# install_requires=[ ++# 'dulwich>=0.18.6', ++# 'netifaces>=0.10.8', ++# 'dnspython>=1.15.0', ++# 'libzfs' ++# ], ++# setup_requires=['pytest-runner'], ++# entry_points={'console_scripts': ['iocage = iocage_lib:cli']}, ++# data_files=_data, ++# tests_require=['pytest', 'pytest-cov', 'pytest-pep8'] ++#) + + setup( + name='iocage_cli', |