Hello community, here is the log from the commit of package system-config-printer checked in at Fri Nov 21 15:53:08 CET 2008. -------- --- GNOME/system-config-printer/system-config-printer.changes 2008-10-28 03:30:33.000000000 +0100 +++ /mounts/work_src_done/STABLE/system-config-printer/system-config-printer.changes 2008-11-21 08:24:09.000000000 +0100 @@ -1,0 +2,18 @@ +Fri Nov 21 08:00:01 CET 2008 - vuntz@novell.com + +- Update cups-pk-helper to 0.0.3 (there is no upstream project, but + I still version the code): + + make various checks to be sure that the arguments passed over + dbus are valid. + + fix a major issue with many options never being changed + + implement various dbus methods that were missing until there, + so that the old authentication dialog never appears. + + add more fine-grained PolicyKit policies. + This is actually needed for bnc#439286. +- Update system-config-printer-policykit.patch to match the + cups-pk-helper update. +- Drop cups-pk-helper-acceptjobs.patch (fixed in 0.0.3). +- Add system-config-printer-more-checks.patch, to avoid a few + uncaught exceptions. + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- cups-pk-helper-0.0.1.tar.bz2 cups-pk-helper-acceptjobs.patch New: ---- cups-pk-helper-0.0.3.tar.bz2 system-config-printer-more-checks.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ system-config-printer.spec ++++++ --- /var/tmp/diff_new_pack.J28005/_old 2008-11-21 15:52:09.000000000 +0100 +++ /var/tmp/diff_new_pack.J28005/_new 2008-11-21 15:52:09.000000000 +0100 @@ -22,10 +22,10 @@ License: GPL v2 or later Group: Hardware/Printing Version: 1.0.8 -Release: 4 +Release: 5 %define pycups_version 1.9.42 %define pysmbc_version 1.0.5 -%define cups_pk_helper_version 0.0.1 +%define cups_pk_helper_version 0.0.3 Summary: A printer administration tool Url: http://cyberelk.net/tim/software/system-config-printer/ Source0: http://cyberelk.net/tim/data/system-config-printer/1.0.x/system-config-printer-%{version}.tar.bz2 @@ -44,14 +44,14 @@ Patch12: system-config-printer-remove-redhat-base.patch # PATCH-FIX-OPENSUSE system-config-printer-icon-brp-friendly.patch vuntz@novell.com -- brp checks don't like the printer icon name, so we have to use something else Patch13: system-config-printer-icon-brp-friendly.patch +# PATCH-FIX-UPSTREAM system-config-printer-more-checks.patch vuntz@novell.com -- Add some more checks to not have exceptions here and there +Patch14: system-config-printer-more-checks.patch # PATCH-FEATURE-OPENSUSE system-config-printer-policykit.patch vuntz@novell.com -- Make s-c-p PolicyKit-aware Patch15: system-config-printer-policykit.patch # PATCH-FIX-OPENSUSE system-config-printer-cups-autoconfig-notifications.patch vuntz@novell.com -- Integration with cups-autoconfig. This will be removed after 11.1, since we'll move to hal-cups-utils. Patch16: system-config-printer-cups-autoconfig-notifications.patch # PATCH-FIX-OPENSUSE system-config-printer-hide-my-default-printer.patch vuntz@novell.com -- Hide my-default-printer in the menus Patch17: system-config-printer-hide-my-default-printer.patch -# PATCH-FIX-OPENSUSE cups-pk-helper-acceptjobs.patch vuntz@novell.com -- Make cups-pk-helper correctly handle AcceptJobs requests. -Patch18: cups-pk-helper-acceptjobs.patch # PATCH-FIX-UPSTREAM system-config-printer-prefill-name-descr.patch bnc433633 vuntz@novell.com -- Prefill the name and description of a new printer Patch19: system-config-printer-prefill-name-descr.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -108,12 +108,10 @@ %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 %patch15 -p1 %patch16 -p1 %patch17 -p1 -pushd cups-pk-helper-%{cups_pk_helper_version} -%patch18 -p1 -popd %patch19 -p1 %build @@ -187,6 +185,21 @@ %files lang -f %{name}.lang %changelog +* Fri Nov 21 2008 vuntz@novell.com +- Update cups-pk-helper to 0.0.3 (there is no upstream project, but + I still version the code): + + make various checks to be sure that the arguments passed over + dbus are valid. + + fix a major issue with many options never being changed + + implement various dbus methods that were missing until there, + so that the old authentication dialog never appears. + + add more fine-grained PolicyKit policies. + This is actually needed for bnc#439286. +- Update system-config-printer-policykit.patch to match the + cups-pk-helper update. +- Drop cups-pk-helper-acceptjobs.patch (fixed in 0.0.3). +- Add system-config-printer-more-checks.patch, to avoid a few + uncaught exceptions. * Tue Oct 28 2008 vuntz@novell.com - Add system-config-printer-prefill-name-descr.patch to prefill name and description of new printers. Fix bnc#433633. @@ -203,7 +216,7 @@ printer. - Obsoletes gnome-cups-manager. No Provides, since it's not the same application... -* Fri Oct 24 2008 vuntz@novell.com +* Thu Oct 23 2008 vuntz@novell.com - Add system-config-printer-cups-autoconfig-notifications.patch. We display notifications for printers automatically configured by cups-autoconfig. This is the missing piece for dropping @@ -262,7 +275,7 @@ - Update pycups to 1.9.42 and pysmbc to 1.0.5. - Remove pysmbc-debug.patch (fixed upstream) and take system-config-printer-forbidden.patch from Fedora package. -* Thu Aug 28 2008 vuntz@novell.com +* Wed Aug 27 2008 vuntz@novell.com - Update to version 1.0.6. + See ChangeLog for details. * Wed Jul 30 2008 vuntz@novell.com ++++++ cups-pk-helper-0.0.1.tar.bz2 -> cups-pk-helper-0.0.3.tar.bz2 ++++++ ++++ 19710 lines of diff (skipped) ++++++ system-config-printer-more-checks.patch ++++++ diff --git a/AdvancedServerSettings.py b/AdvancedServerSettings.py index bd1f0de..2987136 100644 --- a/AdvancedServerSettings.py +++ b/AdvancedServerSettings.py @@ -128,7 +128,14 @@ class AdvancedServerSettingsDialog: # Fetch cupsd.conf f = tempfile.TemporaryFile () try: - cupsconn.getFile (self.RESOURCE, file=f) + try: + self.cupsconn.getFile (self.RESOURCE, file=f) + except TypeError: + # Specifying a file object requires pycups >= 1.9.38 + (fd, name) = tempfile.mkstemp () + self.cupsconn.getFile (self.RESOURCE, name) + os.unlink (name) + f = os.fdopen (fd, "r+") except cups.HTTPError, s: show_HTTP_Error (s, dialog) raise diff --git a/cupshelpers/cupshelpers.py b/cupshelpers/cupshelpers.py index 5b9cbfc..eba5a7e 100755 --- a/cupshelpers/cupshelpers.py +++ b/cupshelpers/cupshelpers.py @@ -558,7 +558,11 @@ class _PrintersConf: self.connection.getFile(file, filename) except cups.HTTPError, e: os.close(fd) - os.unlink(filename) + try: + os.unlink(filename) + except OSError: + pass + if (e.args[0] == cups.HTTP_UNAUTHORIZED or e.args[0] == cups.HTTP_NOT_FOUND): return [] ++++++ system-config-printer-policykit.patch ++++++ --- /var/tmp/diff_new_pack.J28005/_old 2008-11-21 15:52:10.000000000 +0100 +++ /var/tmp/diff_new_pack.J28005/_new 2008-11-21 15:52:10.000000000 +0100 @@ -11,7 +11,7 @@ errordialogs.py \ jobviewer.py \ diff --git a/authconn.py b/authconn.py -index eb2dd23..3795c3b 100644 +index 1b37e34..bfcb13f 100644 --- a/authconn.py +++ b/authconn.py @@ -18,6 +18,7 @@ @@ -74,10 +74,10 @@ self._failed () diff --git a/cupspk.py b/cupspk.py new file mode 100644 -index 0000000..a72fc59 +index 0000000..b04d1b8 --- /dev/null +++ b/cupspk.py -@@ -0,0 +1,454 @@ +@@ -0,0 +1,625 @@ +# vim: set ts=4 sw=4 et: coding=UTF-8 +# +# Copyright (C) 2008 Novell, Inc. @@ -105,6 +105,7 @@ +# add missing methods + +import os ++import sys + +import tempfile + @@ -226,14 +227,12 @@ + return pk_auth_ret != 0 + + -+ def _handle_exception_with_auth(self, e, fallback, *args, **kwds): ++ def _handle_exception_with_auth(self, e): + if e.get_dbus_name() != CUPS_PK_NEED_AUTH: -+ fallback(*args, **kwds) + return False + + tokens = e.get_dbus_message().split(' ', 2) + if len(tokens) != 3: -+ fallback(*args, **kwds) + return False + + try: @@ -244,7 +243,6 @@ + # FIXME: is xid working? + ret = self._obtain_auth(tokens[0], xid) + except dbus.exceptions.DBusException: -+ fallback(*args, **kwds) + return False + + if not ret: @@ -265,42 +263,81 @@ + pass + + if use_fallback or not pk_function: -+ fallback_function(*args, **kwds) -+ return ++ return fallback_function(*args, **kwds) ++ ++ pk_retval = 'PolicyKit communication issue' + + while True: + try: + # FIXME: async call or not? -+ pk_function(*pk_args) ++ pk_retval = pk_function(*pk_args) ++ ++ # if the PK call has more than one return values, we pop the ++ # first one as the error message ++ if type(pk_retval) == tuple: ++ retval = pk_retval[1:] ++ # if there's no error, then we can safely return what we ++ # got ++ if pk_retval[0] == '': ++ # if there's only one item left in the tuple, we don't ++ # want to return the tuple, but the item ++ if len(retval) == 1: ++ return retval[0] ++ else: ++ return retval + break + except dbus.exceptions.DBusException, e: -+ if not self._handle_exception_with_auth(e, fallback_function, *args, **kwds): ++ if not self._handle_exception_with_auth(e): + break + ++ # The PolicyKit call did not work (either a PK-error and we got a dbus ++ # exception that wasn't handled, or an error in the mechanism itself) ++ if pk_retval != '': ++ print >>sys.stderr, 'PolicyKit call to %s did not work: %s' % (pk_function_name, pk_retval) ++ return fallback_function(*args, **kwds) ++ + + def _args_to_tuple(self, types, *args): ++ retval = [ False ] ++ + if len(types) != len(args): -+ types.append(True) -+ return types ++ retval[0] = True ++ # We do this to have the right length for the returned value ++ retval.extend(types) ++ return tuple(types) + + exception = False + -+ retval = [] -+ + for i in range(len(types)): + if type(args[i]) != types[i]: + if types[i] == str and type(args[i]) == unicode: + # we accept a mix between unicode and str + pass ++ elif types[i] == str and type(args[i]) == int: ++ # we accept a mix between int and str ++ retval.append(str(args[i])) ++ continue ++ elif types[i] == str and type(args[i]) == bool: ++ # we accept a mix between bool and str ++ retval.append(str(args[i])) ++ continue + elif types[i] == str and args[i] == None: + # None is an empty string for dbus + retval.append('') + continue ++ elif types[i] == list and type(args[i]) == tuple: ++ # we accept a mix between list and tuple ++ retval.append(list(args[i])) ++ continue ++ elif types[i] == list and args[i] == None: ++ # None is an empty list ++ retval.append([]) ++ continue + else: + exception = True + retval.append(args[i]) + -+ retval.append(exception) ++ retval[0] = exception + + return tuple(retval) + @@ -331,11 +368,74 @@ +# authenticateJob +# setJobHoldUntil +# restartJob -+# getFile -+# putFile ++ ++ def getFile(self, *args, **kwds): ++ ''' Keeping this as an alternative for the code. ++ We don't use it because it's not possible to know if the call was a ++ PK-one (and so we push the content of a temporary filename to fd or ++ file) or a non-PK-one (in which case nothing should be done). ++ ++ filename = None ++ fd = None ++ file = None ++ if use_pycups: ++ if len(kwds) != 1: ++ use_pycups = True ++ elif kwds.has_key('filename'): ++ filename = kwds['filename'] ++ elif kwds.has_key('fd'): ++ fd = kwds['fd'] ++ elif kwds.has_key('file'): ++ file = kwds['file'] ++ else: ++ use_pycups = True ++ ++ if fd or file: ++ ''' ++ ++ if len(args) == 2: ++ (use_pycups, resource, filename) = self._args_to_tuple([str, str], *args) ++ else: ++ (use_pycups, resource) = self._args_to_tuple([str], *args) ++ if kwds.has_key('filename'): ++ filename = kwds['filename'] ++ else: ++ if not use_pycups: ++ raise TypeError() ++ else: ++ filename = None ++ ++ pk_args = (resource, filename) ++ ++ self._call_with_pk_and_fallback(use_pycups, ++ 'FileGet', pk_args, ++ self._connection.getFile, ++ *args, **kwds) ++ ++ ++ def putFile(self, *args, **kwds): ++ if len(args) == 2: ++ (use_pycups, resource, filename) = self._args_to_tuple([str, str], *args) ++ else: ++ (use_pycups, resource) = self._args_to_tuple([str], *args) ++ if kwds.has_key('filename'): ++ filename = kwds['filename'] ++ else: ++ if not use_pycups: ++ raise TypeError() ++ else: ++ filename = None ++ ++ pk_args = (resource, filename) ++ ++ self._call_with_pk_and_fallback(use_pycups, ++ 'FilePut', pk_args, ++ self._connection.putFile, ++ *args, **kwds) ++ + + def addPrinter(self, *args, **kwds): -+ (name, use_pycups) = self._args_to_tuple([str], *args) ++ (use_pycups, name) = self._args_to_tuple([str], *args) + (filename, ppdname, info, location, device, ppd) = self._kwds_to_vars(['filename', 'ppdname', 'info', 'location', 'device', 'ppd'], **kwds) + + need_unlink = False @@ -362,7 +462,7 @@ + + + def setPrinterDevice(self, *args, **kwds): -+ (name, device, use_pycups) = self._args_to_tuple([str, str], *args) ++ (use_pycups, name, device) = self._args_to_tuple([str, str], *args) + pk_args = (name, device) + + self._call_with_pk_and_fallback(use_pycups, @@ -372,7 +472,7 @@ + + + def setPrinterInfo(self, *args, **kwds): -+ (name, info, use_pycups) = self._args_to_tuple([str, str], *args) ++ (use_pycups, name, info) = self._args_to_tuple([str, str], *args) + pk_args = (name, info) + + self._call_with_pk_and_fallback(use_pycups, @@ -382,7 +482,7 @@ + + + def setPrinterLocation(self, *args, **kwds): -+ (name, location, use_pycups) = self._args_to_tuple([str, str], *args) ++ (use_pycups, name, location) = self._args_to_tuple([str, str], *args) + pk_args = (name, location) + + self._call_with_pk_and_fallback(use_pycups, @@ -392,7 +492,7 @@ + + + def setPrinterShared(self, *args, **kwds): -+ (name, shared, use_pycups) = self._args_to_tuple([str, bool], *args) ++ (use_pycups, name, shared) = self._args_to_tuple([str, bool], *args) + pk_args = (name, shared) + + self._call_with_pk_and_fallback(use_pycups, @@ -402,7 +502,7 @@ + + + def setPrinterJobSheets(self, *args, **kwds): -+ (name, start, end, use_pycups) = self._args_to_tuple([str, str, str], *args) ++ (use_pycups, name, start, end) = self._args_to_tuple([str, str, str], *args) + pk_args = (name, start, end) + + self._call_with_pk_and_fallback(use_pycups, @@ -412,7 +512,7 @@ + + + def setPrinterErrorPolicy(self, *args, **kwds): -+ (name, policy, use_pycups) = self._args_to_tuple([str, str], *args) ++ (use_pycups, name, policy) = self._args_to_tuple([str, str], *args) + pk_args = (name, policy) + + self._call_with_pk_and_fallback(use_pycups, @@ -422,7 +522,7 @@ + + + def setPrinterOpPolicy(self, *args, **kwds): -+ (name, policy, use_pycups) = self._args_to_tuple([str, str], *args) ++ (use_pycups, name, policy) = self._args_to_tuple([str, str], *args) + pk_args = (name, policy) + + self._call_with_pk_and_fallback(use_pycups, @@ -431,13 +531,36 @@ + *args, **kwds) + + -+# setPrinterUsersAllowed -+# setPrinterUsersDenied ++ def setPrinterUsersAllowed(self, *args, **kwds): ++ (use_pycups, name, users) = self._args_to_tuple([str, list], *args) ++ pk_args = (name, users) ++ ++ self._call_with_pk_and_fallback(use_pycups, ++ 'PrinterSetUsersAllowed', pk_args, ++ self._connection.setPrinterUsersAllowed, ++ *args, **kwds) ++ ++ ++ def setPrinterUsersDenied(self, *args, **kwds): ++ (use_pycups, name, users) = self._args_to_tuple([str, list], *args) ++ pk_args = (name, users) ++ ++ self._call_with_pk_and_fallback(use_pycups, ++ 'PrinterSetUsersDenied', pk_args, ++ self._connection.setPrinterUsersDenied, ++ *args, **kwds) + + def addPrinterOptionDefault(self, *args, **kwds): -+ #FIXME: value can be a sequence (need to fix dbus API too) -+ (name, option, value, use_pycups) = self._args_to_tuple([str, str, str], *args) -+ pk_args = (name, option, value) ++ # The values can be either a single string, or a list of strings, so ++ # we have to handle this ++ (use_pycups, name, option, value) = self._args_to_tuple([str, str, str], *args) ++ # success ++ if not use_pycups: ++ values = (value,) ++ # okay, maybe we directly have values ++ else: ++ (use_pycups, name, option, values) = self._args_to_tuple([str, str, list], *args) ++ pk_args = (name, option, values) + + self._call_with_pk_and_fallback(use_pycups, + 'PrinterAddOptionDefault', pk_args, @@ -446,7 +569,7 @@ + + + def deletePrinterOptionDefault(self, *args, **kwds): -+ (name, option, use_pycups) = self._args_to_tuple([str, str], *args) ++ (use_pycups, name, option) = self._args_to_tuple([str, str], *args) + pk_args = (name, option) + + self._call_with_pk_and_fallback(use_pycups, @@ -456,7 +579,7 @@ + + + def deletePrinter(self, *args, **kwds): -+ (name, use_pycups) = self._args_to_tuple([str], *args) ++ (use_pycups, name) = self._args_to_tuple([str], *args) + pk_args = (name,) + + self._call_with_pk_and_fallback(use_pycups, @@ -465,13 +588,40 @@ + *args, **kwds) + +# getPrinterAttributes -+# addPrinterToClass -+# deletePrinterFromClass -+# deleteClass ++ ++ def addPrinterToClass(self, *args, **kwds): ++ (use_pycups, printer, name) = self._args_to_tuple([str, str], *args) ++ pk_args = (name, printer) ++ ++ self._call_with_pk_and_fallback(use_pycups, ++ 'ClassAddPrinter', pk_args, ++ self._connection.addPrinterToClass, ++ *args, **kwds) ++ ++ ++ def deletePrinterFromClass(self, *args, **kwds): ++ (use_pycups, printer, name) = self._args_to_tuple([str, str], *args) ++ pk_args = (name, printer) ++ ++ self._call_with_pk_and_fallback(use_pycups, ++ 'ClassDeletePrinter', pk_args, ++ self._connection.deletePrinterFromClass, ++ *args, **kwds) ++ ++ ++ def deleteClass(self, *args, **kwds): ++ (use_pycups, name) = self._args_to_tuple([str], *args) ++ pk_args = (name,) ++ ++ self._call_with_pk_and_fallback(use_pycups, ++ 'ClassDelete', pk_args, ++ self._connection.deleteClass, ++ *args, **kwds) ++ +# getDefault + + def setDefault(self, *args, **kwds): -+ (name, use_pycups) = self._args_to_tuple([str], *args) ++ (use_pycups, name) = self._args_to_tuple([str], *args) + pk_args = (name,) + + self._call_with_pk_and_fallback(use_pycups, @@ -482,7 +632,7 @@ +# getPPD + + def enablePrinter(self, *args, **kwds): -+ (name, use_pycups) = self._args_to_tuple([str], *args) ++ (use_pycups, name) = self._args_to_tuple([str], *args) + pk_args = (name, True) + + self._call_with_pk_and_fallback(use_pycups, @@ -492,7 +642,7 @@ + + + def disablePrinter(self, *args, **kwds): -+ (name, use_pycups) = self._args_to_tuple([str], *args) ++ (use_pycups, name) = self._args_to_tuple([str], *args) + pk_args = (name, False) + + self._call_with_pk_and_fallback(use_pycups, @@ -502,7 +652,7 @@ + + + def acceptJobs(self, *args, **kwds): -+ (name, use_pycups) = self._args_to_tuple([str], *args) ++ (use_pycups, name) = self._args_to_tuple([str], *args) + pk_args = (name, True, '') + + self._call_with_pk_and_fallback(use_pycups, @@ -512,7 +662,7 @@ + + + def rejectJobs(self, *args, **kwds): -+ (name, use_pycups) = self._args_to_tuple([str], *args) ++ (use_pycups, name) = self._args_to_tuple([str], *args) + (reason,) = self._kwds_to_vars(['reason'], **kwds) + pk_args = (name, False, reason) + @@ -524,7 +674,28 @@ + +# printTestPage +# adminGetServerSettings -+# adminSetServerSettings ++ ++ ++ def adminGetServerSettings(self, *args, **kwds): ++ use_pycups = False ++ pk_args = () ++ ++ return self._call_with_pk_and_fallback(use_pycups, ++ 'ServerGetSettings', pk_args, ++ self._connection.adminGetServerSettings, ++ *args, **kwds) ++ ++ ++ def adminSetServerSettings(self, *args, **kwds): ++ (use_pycups, settings) = self._args_to_tuple([dict], *args) ++ pk_args = (settings,) ++ ++ self._call_with_pk_and_fallback(use_pycups, ++ 'ServerSetSettings', pk_args, ++ self._connection.adminSetServerSettings, ++ *args, **kwds) ++ ++ +# getSubscriptions +# createSubscription +# getNotifications @@ -533,10 +704,10 @@ +# printFile +# printFiles diff --git a/system-config-printer.py b/system-config-printer.py -index 9b5830e..3587e75 100755 +index 2520e73..b908f7b 100755 --- a/system-config-printer.py +++ b/system-config-printer.py -@@ -1537,7 +1537,7 @@ class GUI(GtkGUI, monitor.Watcher): +@@ -1538,7 +1538,7 @@ class GUI(GtkGUI, monitor.Watcher): return True self.changed = set() # of options ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org