=== modified file 'backend/jockey-backend' --- backend/jockey-backend 2008-09-25 20:47:09 +0000 +++ backend/jockey-backend 2011-04-15 10:57:48 +0000 @@ -42,6 +42,10 @@ parser.add_option ( '--test', action='store_true', dest='test', default=False, help=_('Run on session D-BUS (only for testing)')) + parser.add_option ( '-k', '--kernel', type='string', dest='kernel_ver', + default=None, + help=_('Override the use of the running kernel with a different ' + 'version.')) (opts, args) = parser.parse_args() return (opts, args) @@ -61,12 +65,14 @@ argv_options, argv_args = parse_argv() setup_logging(argv_options.debug, argv_options.logfile) +if argv_options.kernel_ver is not None: + OSLib.inst = OSLib(kernel=argv_options.kernel_ver) +else: + OSLib.inst = OSLib() if argv_options.test: - OSLib.inst = OSLib() svr = jockey.backend.Backend.create_dbus_server(session_bus=True, handler_dir=argv_options.handler_dir) else: - OSLib.inst = OSLib() svr = jockey.backend.Backend.create_dbus_server( handler_dir=argv_options.handler_dir) if argv_options.timeout == 0: === modified file 'debian/changelog' --- debian/changelog 2011-03-31 17:29:28 +0000 +++ debian/changelog 2011-04-15 11:21:15 +0000 @@ -1,3 +1,11 @@ +jockey (0.9.2-0ubuntu5) UNRELEASED; urgency=low + + * Support specifying the kernel version to use internally (-k) + (LP: #759804). + * Disconnect from Debconf before installing packages (LP: #759804). + + -- Evan Dandrea Fri, 15 Apr 2011 12:20:44 +0100 + jockey (0.9.2-0ubuntu4) natty; urgency=low [ Martin Pitt ] === modified file 'jockey/oslib.py' --- jockey/oslib.py 2011-03-31 17:29:28 +0000 +++ jockey/oslib.py 2011-04-15 11:17:04 +0000 @@ -42,7 +42,7 @@ # global default instance inst = None - def __init__(self, client_only=False): + def __init__(self, client_only=False, kernel=os.uname()[2]): '''Set default paths and load the module blacklist. Distributors might want to override some default paths. @@ -61,6 +61,8 @@ # below follows stuff which is only necessary for the backend + self.kernel = kernel + # default paths # path to a modprobe.d configuration file where kernel modules are @@ -82,7 +84,7 @@ # default paths to modalias files (directory entries will consider all # files in them) self.modaliases = [ - '/lib/modules/%s/modules.alias' % os.uname()[2], + '/lib/modules/%s/modules.alias' % self.kernel, '/usr/share/jockey/modaliases/', ] @@ -117,7 +119,7 @@ # multiple kernel flavors), it is ok to set this to "None". # Note that we want to install the metapackage here, to ensure upgrades # will keep working. - flavour = '-'.join(os.uname()[2].split('-')[2:]) + flavour = '-'.join(self.kernel.split('-')[2:]) self.kernel_header_package = 'linux-headers-' + flavour self.apt_show_cache = {} @@ -275,6 +277,11 @@ repository_added = False os.environ['DEBIAN_FRONTEND'] = 'noninteractive' + # Disconnect from any running Debconf instance. + if 'DEBIAN_HAS_FRONTEND' in os.environ: + del os.environ['DEBIAN_HAS_FRONTEND'] + if 'DEBCONF_USE_CDEBCONF' in os.environ: + del os.environ['DEBCONF_USE_CDEBCONF'] os.environ['PATH'] = '/sbin:/usr/sbin:/bin:/usr/bin' apt.apt_pkg.config.set('DPkg::options::','--force-confnew') @@ -581,7 +588,7 @@ ''' # try to get a *.ko file list from the main kernel package to avoid testing # known-free drivers - dpkg = subprocess.Popen(['dpkg', '-L', 'linux-image-' + os.uname()[2]], + dpkg = subprocess.Popen(['dpkg', '-L', 'linux-image-' + self.kernel], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = dpkg.communicate()[0] result = set() @@ -590,7 +597,7 @@ if l.endswith('.ko'): result.add(os.path.splitext(os.path.basename(l))[0].replace('-', '_')) - dpkg = subprocess.Popen(['dpkg', '-L', 'linux-ubuntu-modules-' + os.uname()[2]], + dpkg = subprocess.Popen(['dpkg', '-L', 'linux-ubuntu-modules-' + self.kernel], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = dpkg.communicate()[0] if dpkg.returncode == 0: === modified file 'jockey/ui.py' --- jockey/ui.py 2011-03-10 17:34:30 +0000 +++ jockey/ui.py 2011-04-15 11:15:02 +0000 @@ -77,7 +77,11 @@ fix_stdouterr() if not OSLib.inst: - OSLib.inst = OSLib(client_only=not self.argv_options.no_dbus) + if self.argv_options.kernel_ver is not None: + OSLib.inst = OSLib(client_only=not self.argv_options.no_dbus, + kernel=self.argv_options.kernel_ver) + else: + OSLib.inst = OSLib(client_only=not self.argv_options.no_dbus) if self.argv_options.check: time.sleep(self.argv_options.check) @@ -387,6 +391,11 @@ help=self._('Run as session D-BUS server.')) parser.add_option ('--no-dbus', action='store_true', default=False, help=self._('Do not use D-BUS for communicating with the backend. Needs root privileges.')) + parser.add_option ('-k', '--kernel', type='string', dest='kernel_ver', + default=None, + help=_('Override the use of the running kernel with a ' + 'different version.')) + #parser.add_option ('--debug', action='store_true', # dest='debug', default=False, # help=self._('Enable debugging messages.'))