|
|
|
@ -119,6 +119,9 @@ def is_system_package(atom, eclasses):
|
|
|
|
|
log.debug(f"{name} is a sys-boot package")
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
if eclasses is True:
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
# libc-packages should be considered system-packages as they generally
|
|
|
|
|
# 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
|
|
|
|
@ -140,7 +143,7 @@ def is_system_package(atom, eclasses):
|
|
|
|
|
def get_eclasses(atom):
|
|
|
|
|
log = logging.getLogger(sau.LOGNAME)
|
|
|
|
|
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+')
|
|
|
|
|
cmd=[ EQUERY_PATH, 'w', name ]
|
|
|
|
|
ret, out, err = sau.helpers.exec_cmd(cmd)
|
|
|
|
@ -267,58 +270,14 @@ def pkg_upgrade():
|
|
|
|
|
# from here on we shouldn't need to rebuild the upgraded packages again
|
|
|
|
|
exclude_list = ' --exclude '.join(rebuild_packages.keys()).split()
|
|
|
|
|
|
|
|
|
|
# Rebuild go
|
|
|
|
|
go_packages = []
|
|
|
|
|
cmd = None
|
|
|
|
|
for package,eclasses in rebuild_packages.items():
|
|
|
|
|
if 'go-module' in eclasses or package == 'dev-lang/go':
|
|
|
|
|
go_packages.append(package)
|
|
|
|
|
if 'dev-lang/go' in go_packages:
|
|
|
|
|
log.info("Running golang-rebuild due to update of dev-lang/go")
|
|
|
|
|
cmd = [
|
|
|
|
|
EMERGE_PATH,
|
|
|
|
|
'--color', 'n',
|
|
|
|
|
'-q',
|
|
|
|
|
'--usepkg-exclude', '*/*',
|
|
|
|
|
'@golang-rebuild',
|
|
|
|
|
'--exclude' ] + exclude_list
|
|
|
|
|
elif go_packages:
|
|
|
|
|
dependencies = []
|
|
|
|
|
for package in go_packages:
|
|
|
|
|
dependencies.append(get_dependencies(package))
|
|
|
|
|
dependencies = set(dependencies)
|
|
|
|
|
upgraded = set(rebuild_packages.keys())
|
|
|
|
|
not_upgraded = dependencies-upgraded
|
|
|
|
|
if not_upgraded:
|
|
|
|
|
log.info(f'Rebuilding packages dependant of go modules {", ".join(go_packages)}')
|
|
|
|
|
cmd = [
|
|
|
|
|
EMERGE_PATH,
|
|
|
|
|
'--color', 'n',
|
|
|
|
|
'-q',
|
|
|
|
|
'--usepkg-exclude', '*/*'] + not_upgraded
|
|
|
|
|
if cmd:
|
|
|
|
|
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
|
|
|
|
if ret != 0 or err:
|
|
|
|
|
log.error('Rebuild of go packages returned {}'.format(ret))
|
|
|
|
|
for line in out.splitlines():
|
|
|
|
|
log.error('stdout: {}'.format(line))
|
|
|
|
|
for line in err.splitlines():
|
|
|
|
|
log.error('stderr: {}'.format(line))
|
|
|
|
|
raise sau.errors.UpgradeError(f'Error during go rebuild')
|
|
|
|
|
else:
|
|
|
|
|
log.info('go rebuild complete')
|
|
|
|
|
for line in out.splitlines():
|
|
|
|
|
if line.startswith(' * '):
|
|
|
|
|
log.warning(line)
|
|
|
|
|
|
|
|
|
|
# rebuild rust
|
|
|
|
|
if 'dev-lang/rust' in rebuild_packages:
|
|
|
|
|
log.info("Running rust-rebuild due to update of dev-lang/rust")
|
|
|
|
|
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 rust")
|
|
|
|
|
cmd = [
|
|
|
|
|
EMERGE_PATH,
|
|
|
|
|
'--color', 'n',
|
|
|
|
|
'-q',
|
|
|
|
|
'--usepkg-exclude', '*/*',
|
|
|
|
|
'--usepkg', 'n',
|
|
|
|
|
'@rust-rebuild',
|
|
|
|
|
'--exclude' ] + exclude_list
|
|
|
|
|
ret, out, err = sau.helpers.exec_cmd(cmd, timeout=72000)
|
|
|
|
@ -338,7 +297,7 @@ def pkg_upgrade():
|
|
|
|
|
# run perl-cleaner
|
|
|
|
|
if 'dev-lang/perl' in rebuild_packages:
|
|
|
|
|
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)
|
|
|
|
|
if ret != 0 or err:
|
|
|
|
|
log.error('perl-cleaner failed with code {}'.format(ret))
|
|
|
|
@ -354,7 +313,7 @@ def pkg_upgrade():
|
|
|
|
|
log.warning(line)
|
|
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
if ret != 0 or err:
|
|
|
|
|
log.error('live-rebuild returned {}'.format(ret))
|
|
|
|
@ -389,7 +348,7 @@ def pkg_upgrade():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 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)
|
|
|
|
|
|
|
|
|
|
if ret != 0 or err:
|
|
|
|
@ -416,7 +375,8 @@ def pkg_upgrade():
|
|
|
|
|
for sysfile in ['config', 'initramfs', 'System.map', 'vmlinuz', 'kernel']:
|
|
|
|
|
match = sorted(
|
|
|
|
|
[f for f in files if f.startswith(f'{sysfile}-')],
|
|
|
|
|
reverse=True)
|
|
|
|
|
reverse=True,
|
|
|
|
|
key=lambda x: tuple(map(int, x.split('-')[1].split('.')[:3])))
|
|
|
|
|
for f in match[keep_kernels:]:
|
|
|
|
|
log.debug(f"Removing old kernel file {f}")
|
|
|
|
|
os.remove(os.path.join(root, f))
|
|
|
|
|