Author: ckauhaus
Date: Mon Dec 8 14:39:16 2008
New Revision: 7193
Log:
added basic 'emerge update world' loop
Modified:
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/files/portage/package.keywords
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/files/update-system.sh
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/templates/make.conf.erb
gocept.infrastructure/feature_systemupgrade/util/fixes/db/python.py
gocept.infrastructure/feature_systemupgrade/util/fixes/fix
gocept.infrastructure/feature_systemupgrade/util/fixes/lib/fixapi.py
Modified:
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/files/portage/package.keywords
==============================================================================
---
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/files/portage/package.keywords (original)
+++
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/files/portage/package.keywords Mon
Dec 8 14:39:16 2008
(at)(at) -1,11 +1,12 (at)(at)
# Managed by Puppet: do not edit this file directly. It will be overwritten!
~app-admin/puppet-0.24.5
-~app-emulation/kvm-73
+~app-backup/rdiff-backup-1.2.2
+~app-emulation/kvm-79
~dev-ruby/ruby-ldap-0.9.7
-~net-analyzer/nagios-3.0.5
-~net-analyzer/nagios-core-3.0.5
-~net-analyzer/nagios-imagepack-1.0-r100
-~net-analyzer/nagios-plugins-1.4.13
+~net-analyzer/nagios-3.0.6
+~net-analyzer/nagios-core-3.0.6
+~net-analyzer/nagios-imagepack-1.0
~net-analyzer/nagios-nrpe-2.12
+~net-analyzer/nagios-nsca-2.7.2
+~net-analyzer/nagios-plugins-1.4.13
~sys-block/megacli-1.01.40
-~app-backup/rdiff-backup-1.2.2
Modified:
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/files/update-system.sh
==============================================================================
---
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/files/update-system.sh (original)
+++
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/files/update-system.sh Mon
Dec 8 14:39:16 2008
(at)(at) -70,17 +70,41 (at)(at)
# do or the list of open fixes does not change anymore
apply_fixes() {
${fixdir}/emergency
+ ${fixdir}/check
local todo=$(${fixdir}/check)
local todo_old
while [[ -n ${todo} ]]; do
+ if [[ ${todo} == ${todo_old} ]]; then
+ return 1
+ fi
+ todo_old=${todo}
${fixdir}/fix
todo=$(${fixdir}/check)
+ done
+ return 0
+}
+
+# Perform a complete update. If a package fails, proceed by updating other
+# packages first. After each cycle, fixes are applied. If there are still
+# packages to update and no further progress can be made, exit unsuccessfully.
+update_world() {
+ apply_fixes
+ emerge -pquDN world
+ local todo=$(emerge -pquDN world)
+ local todo_old
+ while [[ -n "${todo}" ]]; do
if [[ ${todo} == ${todo_old} ]]; then
return 1
fi
todo_old=${todo}
+ emerge -quDN world >>/var/log/portage/build.log || true
+ until emerge -q --resume --skipfirst
>>/var/log/portage/build.log
+ do : ; done
+ apply_fixes
+ todo=$(emerge -pquDN world)
done
- return 0
+ apply_fixes
+ return $?
}
# main: perform update steps until convergence is reached
(at)(at) -89,9 +113,7 (at)(at)
update_files
update_portage
regen_metadata
- apply_fixes
- local problem=$?
- return ${problem}
+ update_world
}
if ! convergence --query; then
Modified:
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/templates/make.conf.erb
==============================================================================
---
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/templates/make.conf.erb (original)
+++
gocept.infrastructure/feature_systemupgrade/puppet/modules/sys_portage/templates/make.conf.erb Mon
Dec 8 14:39:16 2008
(at)(at) -12,8 +12,8 (at)(at)
MAKEOPTS="-j<%= processorcount.to_i + 1 %>"
FEATURES="ccache buildpkg usersandbox"
USE="-X -gnome -kde acpi bash-completion bzip2 device-mapper gnutls jpeg kvm \
- logrotate png sqlite3 sse sse2 symlink vim-syntax ldap apache2 "
+ logrotate png sqlite3 sse sse2 symlink vim-syntax ldap "
# save distfiles and installed packages outside of the portage tree
-DISTDIR="/var/tmp/distfiles"
-PKGDIR="/var/tmp/packages"
+DISTDIR="/var/tmp/portage/distfiles"
+PKGDIR="/var/tmp/portage/packages"
Modified: gocept.infrastructure/feature_systemupgrade/util/fixes/db/python.py
==============================================================================
---
gocept.infrastructure/feature_systemupgrade/util/fixes/db/python.py (original)
+++ gocept.infrastructure/feature_systemupgrade/util/fixes/db/python.py Mon Dec
8 14:39:16 2008
(at)(at) -2,7 +2,6 (at)(at)
# See also LICENSE.txt
import fixapi
-import subprocess
class PythonUpdater(fixapi.Fix):
Modified: gocept.infrastructure/feature_systemupgrade/util/fixes/fix
==============================================================================
--- gocept.infrastructure/feature_systemupgrade/util/fixes/fix (original)
+++ gocept.infrastructure/feature_systemupgrade/util/fixes/fix Mon Dec 8
14:39:16 2008
(at)(at) -17,8 +17,6 (at)(at)
fixes = fixer.list()
for fix in fixes:
print fix
- if fixes:
- sys.exit(2)
elif command == 'fix':
fixer.apply()
else:
Modified: gocept.infrastructure/feature_systemupgrade/util/fixes/lib/fixapi.py
==============================================================================
---
gocept.infrastructure/feature_systemupgrade/util/fixes/lib/fixapi.py (original)
+++ gocept.infrastructure/feature_systemupgrade/util/fixes/lib/fixapi.py Mon
Dec 8 14:39:16 2008
(at)(at) -37,7 +37,14 (at)(at)
def emerge(packages, opts=[]):
"""Convenience wrapper for emerge calls."""
- cmd(['emerge'] + EMERGE_DEFAULT_OPTS + list(opts) + list(packages))
+ if not isinstance(packages, list):
+ packages = list(packages)
+ if not isinstance(opts, list):
+ opts = list(opts)
+ log = file('/var/log/portage/fix.log', 'a')
+ cmd(['emerge'] + EMERGE_DEFAULT_OPTS + opts + packages,
+ stdout=log, stderr=log)
+ log.close()
class Fix(object):
|