Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
8d373f599c | |||
17ef7eee8e | |||
0f713bf476 | |||
9f08c5f687 | |||
6fd96562ae | |||
76fe384d0f | |||
3d3dd379b7 | |||
cc206f6198 | |||
29c1256ee1 |
@ -119,6 +119,9 @@ def is_system_package(atom, eclasses):
|
|||||||
log.debug(f"{name} is a sys-boot package")
|
log.debug(f"{name} is a sys-boot package")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if eclasses is True:
|
||||||
|
return True
|
||||||
|
|
||||||
# libc-packages should be considered system-packages as they generally
|
# libc-packages should be considered system-packages as they generally
|
||||||
# requires the system to be restarted. Not sure if there is a better way
|
# requires the system to be restarted. Not sure if there is a better way
|
||||||
# then just checking for specific packages here, but as far as I know there
|
# then just checking for specific packages here, but as far as I know there
|
||||||
@ -140,7 +143,7 @@ def is_system_package(atom, eclasses):
|
|||||||
def get_eclasses(atom):
|
def get_eclasses(atom):
|
||||||
log = logging.getLogger(sau.LOGNAME)
|
log = logging.getLogger(sau.LOGNAME)
|
||||||
eclasses = []
|
eclasses = []
|
||||||
name=re.sub(r'^[<=>]*(.*?)(?:-\d)?(?:::\w+)?$', r'\1', atom)
|
name=re.sub(r'^[<=>]*(.*?)(?:-\d+)?(?:::\w+)?$', r'\1', atom)
|
||||||
test_re = re.compile(r'^\s*inherit\s+')
|
test_re = re.compile(r'^\s*inherit\s+')
|
||||||
cmd=[ EQUERY_PATH, 'w', name ]
|
cmd=[ EQUERY_PATH, 'w', name ]
|
||||||
ret, out, err = sau.helpers.exec_cmd(cmd)
|
ret, out, err = sau.helpers.exec_cmd(cmd)
|
||||||
@ -168,7 +171,7 @@ def get_eclasses(atom):
|
|||||||
return eclasses
|
return eclasses
|
||||||
|
|
||||||
def get_dependencies(atom):
|
def get_dependencies(atom):
|
||||||
cmd=[ EQUERY_PATH, '-q', 'd', '-F', '$cp', name ]
|
cmd=[ EQUERY_PATH, '-q', 'd', '-F', '$cp', atom ]
|
||||||
ret, out, err = sau.helpers.exec_cmd(cmd)
|
ret, out, err = sau.helpers.exec_cmd(cmd)
|
||||||
dependencies = [l.strip() for l in out.splitlines()]
|
dependencies = [l.strip() for l in out.splitlines()]
|
||||||
return dependencies
|
return dependencies
|
||||||
@ -263,7 +266,7 @@ def pkg_upgrade():
|
|||||||
|
|
||||||
## rebuild as needed
|
## rebuild as needed
|
||||||
do_rebuild = conf.getboolean('default', 'do_rebuilds', fallback=True)
|
do_rebuild = conf.getboolean('default', 'do_rebuilds', fallback=True)
|
||||||
if do_rebuilds:
|
if do_rebuild:
|
||||||
# from here on we shouldn't need to rebuild the upgraded packages again
|
# from here on we shouldn't need to rebuild the upgraded packages again
|
||||||
exclude_list = ' --exclude '.join(rebuild_packages.keys()).split()
|
exclude_list = ' --exclude '.join(rebuild_packages.keys()).split()
|
||||||
|
|
||||||
@ -279,13 +282,13 @@ def pkg_upgrade():
|
|||||||
EMERGE_PATH,
|
EMERGE_PATH,
|
||||||
'--color', 'n',
|
'--color', 'n',
|
||||||
'-q',
|
'-q',
|
||||||
'--usepkg-exclude', '*/*',
|
'--usepkg', 'n',
|
||||||
'@golang-rebuild',
|
'@golang-rebuild',
|
||||||
'--exclude' ] + exclude_list
|
'--exclude' ] + exclude_list
|
||||||
elif go_packages:
|
elif go_packages:
|
||||||
dependencies = []
|
dependencies = []
|
||||||
for package in go_packages:
|
for package in go_packages:
|
||||||
dependencies.append(get_dependencies(package))
|
dependencies.extend(get_dependencies(package))
|
||||||
dependencies = set(dependencies)
|
dependencies = set(dependencies)
|
||||||
upgraded = set(rebuild_packages.keys())
|
upgraded = set(rebuild_packages.keys())
|
||||||
not_upgraded = dependencies-upgraded
|
not_upgraded = dependencies-upgraded
|
||||||
@ -295,7 +298,7 @@ def pkg_upgrade():
|
|||||||
EMERGE_PATH,
|
EMERGE_PATH,
|
||||||
'--color', 'n',
|
'--color', 'n',
|
||||||
'-q',
|
'-q',
|
||||||
'--usepkg-exclude', '*/*'] + not_upgraded
|
'--usepkg', 'n'] + not_upgraded
|
||||||
if cmd:
|
if cmd:
|
||||||
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
||||||
if ret != 0 or err:
|
if ret != 0 or err:
|
||||||
@ -312,13 +315,13 @@ def pkg_upgrade():
|
|||||||
log.warning(line)
|
log.warning(line)
|
||||||
|
|
||||||
# rebuild rust
|
# rebuild rust
|
||||||
if 'dev-lang/rust' in rebuild_packages:
|
if any([x in rebuild_packages for x in ('dev-lang/rust', 'dev-lang/rust-bin')]):
|
||||||
log.info("Running rust-rebuild due to update of dev-lang/rust")
|
log.info("Running rust-rebuild due to update of rust")
|
||||||
cmd = [
|
cmd = [
|
||||||
EMERGE_PATH,
|
EMERGE_PATH,
|
||||||
'--color', 'n',
|
'--color', 'n',
|
||||||
'-q',
|
'-q',
|
||||||
'--usepkg-exclude', '*/*',
|
'--usepkg', 'n',
|
||||||
'@rust-rebuild',
|
'@rust-rebuild',
|
||||||
'--exclude' ] + exclude_list
|
'--exclude' ] + exclude_list
|
||||||
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
||||||
@ -338,7 +341,7 @@ def pkg_upgrade():
|
|||||||
# run perl-cleaner
|
# run perl-cleaner
|
||||||
if 'dev-lang/perl' in rebuild_packages:
|
if 'dev-lang/perl' in rebuild_packages:
|
||||||
log.info("Running perl-cleaner due to perl upgrade")
|
log.info("Running perl-cleaner due to perl upgrade")
|
||||||
cmd = [ PCLEAN_PATH, '--all', '--', '-q', '--usepkg-exclude', '*/*']
|
cmd = [ PCLEAN_PATH, '--all', '--', '-q', '--usepkg', 'n']
|
||||||
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
||||||
if ret != 0 or err:
|
if ret != 0 or err:
|
||||||
log.error('perl-cleaner failed with code {}'.format(ret))
|
log.error('perl-cleaner failed with code {}'.format(ret))
|
||||||
@ -354,7 +357,7 @@ def pkg_upgrade():
|
|||||||
log.warning(line)
|
log.warning(line)
|
||||||
|
|
||||||
# rebuild live packages
|
# rebuild live packages
|
||||||
cmd = [ EMERGE_PATH, '--color', 'n', '-q', '--usepkg-exclude', '*/*', '@live-rebuild' ]
|
cmd = [ EMERGE_PATH, '--color', 'n', '-q', '--usepkg', 'n', '@live-rebuild' ]
|
||||||
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=3600)
|
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=3600)
|
||||||
if ret != 0 or err:
|
if ret != 0 or err:
|
||||||
log.error('live-rebuild returned {}'.format(ret))
|
log.error('live-rebuild returned {}'.format(ret))
|
||||||
@ -389,7 +392,7 @@ def pkg_upgrade():
|
|||||||
|
|
||||||
|
|
||||||
## Preserved rebuild
|
## Preserved rebuild
|
||||||
cmd = [ EMERGE_PATH, '--color', 'n', '--usepkg-exclude', '*/*', '-q', '@preserved-rebuild' ]
|
cmd = [ EMERGE_PATH, '--color', 'n', '--usepkg', 'n', '-q', '@preserved-rebuild' ]
|
||||||
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
||||||
|
|
||||||
if ret != 0 or err:
|
if ret != 0 or err:
|
||||||
|
@ -12,6 +12,9 @@ import sau.platforms
|
|||||||
|
|
||||||
proc_fd_map_re = re.compile(r'^.*(/(?:usr|lib|opt|etc|s?bin)[^\(]*) \(deleted\)$')
|
proc_fd_map_re = re.compile(r'^.*(/(?:usr|lib|opt|etc|s?bin)[^\(]*) \(deleted\)$')
|
||||||
|
|
||||||
|
valid_service_policies=('restart', 'warn', 'ignore', 'silent-restart',
|
||||||
|
'reboot', 'silent-reboot')
|
||||||
|
|
||||||
def _warn(policy, msg):
|
def _warn(policy, msg):
|
||||||
log = logging.getLogger(sau.LOGNAME)
|
log = logging.getLogger(sau.LOGNAME)
|
||||||
if not policy.startswith('silent'):
|
if not policy.startswith('silent'):
|
||||||
@ -182,7 +185,7 @@ def _get_service_restart_policy(service):
|
|||||||
log = logging.getLogger(sau.LOGNAME)
|
log = logging.getLogger(sau.LOGNAME)
|
||||||
conf = sau.config
|
conf = sau.config
|
||||||
policy = conf.get('services', service, fallback=None)
|
policy = conf.get('services', service, fallback=None)
|
||||||
if policy and policy.lower() in ('restart', 'warn', 'ignore', 'silent-restart', 'reboot', 'silent-reboot'):
|
if policy and policy.lower() in valid_service_policies:
|
||||||
return policy.lower()
|
return policy.lower()
|
||||||
elif policy:
|
elif policy:
|
||||||
log.warning('service policy {} for {} is invalid'.format(policy, service))
|
log.warning('service policy {} for {} is invalid'.format(policy, service))
|
||||||
@ -230,6 +233,9 @@ def _get_service_from_proc(proc):
|
|||||||
log.warning(f'Not restarting user service {unit}; please log out and log in again')
|
log.warning(f'Not restarting user service {unit}; please log out and log in again')
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
policy = conf.get('services', name, fallback=None)
|
||||||
|
if policy and policy.lower() in valid_service_policies:
|
||||||
|
return name
|
||||||
_ret, enabled, _err = sau.helpers.exec_cmd([ '/usr/bin/systemctl', 'is-enabled', unit ])
|
_ret, enabled, _err = sau.helpers.exec_cmd([ '/usr/bin/systemctl', 'is-enabled', unit ])
|
||||||
enabled = enabled.strip()
|
enabled = enabled.strip()
|
||||||
if enabled not in ('enabled', 'static'):
|
if enabled not in ('enabled', 'static'):
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='sau',
|
name='sau',
|
||||||
version='1.4.0',
|
version='1.4.5',
|
||||||
description='Tool for auto-updating OS and packages',
|
description='Tool for auto-updating OS and packages',
|
||||||
author='Feffe',
|
author='Feffe',
|
||||||
author_email='feffe@fulh.ax',
|
author_email='feffe@fulh.ax',
|
||||||
|
Loading…
Reference in New Issue
Block a user