Hello community, here is the log from the commit of package cdemu-client for openSUSE:Factory checked in at 2019-10-24 23:10:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cdemu-client (Old) and /work/SRC/openSUSE:Factory/.cdemu-client.new.2990 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cdemu-client" Thu Oct 24 23:10:55 2019 rev:15 rq:742537 version:3.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/cdemu-client/cdemu-client.changes 2019-07-11 13:18:55.178757445 +0200 +++ /work/SRC/openSUSE:Factory/.cdemu-client.new.2990/cdemu-client.changes 2019-10-24 23:11:07.664659787 +0200 @@ -1,0 +2,7 @@ +Thu Oct 17 10:29:04 UTC 2019 - Jan Engelhardt <[email protected]> + +- Update to release 3.2.3 + * Improved setting and retrieval of daemon/library debug masks + * Fixed a "is no" comparison against a literal + +------------------------------------------------------------------- Old: ---- cdemu-client-3.2.0.tar.bz2 New: ---- cdemu-client-3.2.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cdemu-client.spec ++++++ --- /var/tmp/diff_new_pack.g95CJ6/_old 2019-10-24 23:11:08.148660352 +0200 +++ /var/tmp/diff_new_pack.g95CJ6/_new 2019-10-24 23:11:08.152660357 +0200 @@ -17,12 +17,12 @@ Name: cdemu-client -Version: 3.2.0 +Version: 3.2.3 Release: 0 Summary: Command-line client to control cdemu-daemon License: GPL-2.0-or-later Group: System/Filesystems -Url: http://cdemu.sf.net/about/client/ +URL: https://cdemu.sf.net/about/client/ #Git-Clone: git://git.code.sf.net/p/cdemu/code Source: http://downloads.sf.net/cdemu/%name-%version.tar.bz2 @@ -61,7 +61,6 @@ %find_lang cdemu %files -%defattr(-,root,root) %doc AUTHORS COPYING NEWS README %_bindir/cdemu %_datadir/applications/%name.desktop ++++++ cdemu-client-3.2.0.tar.bz2 -> cdemu-client-3.2.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cdemu-client-3.2.0/README new/cdemu-client-3.2.3/README --- old/cdemu-client-3.2.0/README 2018-07-07 21:55:02.000000000 +0200 +++ new/cdemu-client-3.2.3/README 2019-08-31 10:38:40.000000000 +0200 @@ -1,5 +1,5 @@ CDEmu client -3.2.0 +3.2.3 ~~~~~ Table of Contents: @@ -16,7 +16,7 @@ ~~~~~~~~~~~~~~~ This is cdemu-client, a simple command-line client for controlling CDEmu daemon. -It is part of the userspace-cdemu suite, a free, GPL CD/DVD-ROM device emulator +It is part of the cdemu suite, a free, GPL CD/DVD-ROM device emulator for linux. It provides a way to perform the key tasks related to controlling the CDEmu @@ -98,6 +98,12 @@ Setting daemon debug mask for the first device: cdemu daemon-debug-mask 0 0x01 +Setting daemon debug mask for the first device (composite): + cdemu daemon-debug-mask 0 "0x01|0x02" + +Setting daemon debug mask for the first device (composite, by name): + cdemu daemon-debug-mask 0 "DAEMON_DEBUG_DEVICE|DAEMON_DEBUG_MMC" + Obtaining library debug mask for the first device: cdemu library-debug-mask 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cdemu-client-3.2.0/debian/changelog new/cdemu-client-3.2.3/debian/changelog --- old/cdemu-client-3.2.0/debian/changelog 2018-07-07 21:55:02.000000000 +0200 +++ new/cdemu-client-3.2.3/debian/changelog 2019-08-31 10:38:40.000000000 +0200 @@ -1,3 +1,3 @@ -cdemu-client (3.2.0-1) debian; urgency=low +cdemu-client (3.2.3-1) debian; urgency=low * Initial Release. Closes: #705409 -- Henrik Stokseth <[email protected]> Sat, 05 Apr 2014 12:00:00 +0100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cdemu-client-3.2.0/debian/control new/cdemu-client-3.2.3/debian/control --- old/cdemu-client-3.2.0/debian/control 2018-07-07 21:55:02.000000000 +0200 +++ new/cdemu-client-3.2.3/debian/control 2019-08-31 10:38:40.000000000 +0200 @@ -4,9 +4,9 @@ Homepage: http://cdemu.sourceforge.net/ Maintainer: Henrik Stokseth <[email protected]> Build-Depends: debhelper (>= 9) -Build-Depends-Indep: python3 (>= 3.4.0), intltool, cmake (>= 2.8.5), dh-python, bash-completion +Build-Depends-Indep: python3 (>= 3.4.0), intltool, cmake (>= 2.8.5), ninja-build, dh-python, bash-completion, pkg-config X-Python3-Version: >= 3.4.0 -Standards-Version: 3.9.7 +Standards-Version: 4.3.0 Package: cdemu-client diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cdemu-client-3.2.0/debian/rules new/cdemu-client-3.2.3/debian/rules --- old/cdemu-client-3.2.0/debian/rules 2018-07-07 21:55:02.000000000 +0200 +++ new/cdemu-client-3.2.3/debian/rules 2019-08-31 10:38:40.000000000 +0200 @@ -6,7 +6,9 @@ override_dh_auto_configure: - dh_auto_configure -- "-DPOST_INSTALL_HOOKS:BOOL=OFF" + dh_auto_configure -- -G Ninja -DPOST_INSTALL_HOOKS:BOOL=OFF + +override_dh_auto_test: %: dh $@ --with python3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cdemu-client-3.2.0/man/cdemu.1 new/cdemu-client-3.2.3/man/cdemu.1 --- old/cdemu-client-3.2.0/man/cdemu.1 2018-07-07 21:55:02.000000000 +0200 +++ new/cdemu-client-3.2.3/man/cdemu.1 2019-08-31 10:38:40.000000000 +0200 @@ -8,7 +8,7 @@ <command parameters> .SH DESCRIPTION This is cdemu, a command-line client for controlling CDEmu daemon. It is -part of the userspace-cdemu suite, a free, GPL CD/DVD-ROM device emulator +part of the cdemu suite, a free, GPL CD/DVD-ROM device emulator for linux. .PP It provides a way to perform the key tasks related to controlling the CDEmu @@ -95,18 +95,24 @@ .B daemon-debug-mask <device> [new-value] Displays/sets daemon debug mask; \fBdevice\fR is the number of the desired device, or \fIall\fR. \fBnew-value\fR is the new debug mask value. If this -argument is omitted, current debug mask is displayed. A list of supported -debug mask values can be obtained with +argument is omitted, current debug mask is displayed. The list of supported +debug mask identifiers and values can be obtained with .B enum-daemon-debug-masks -command. +command. The \fBnew-value\fR can be either a single numeric value (e.g, +0x03), a string of numeric values separated by pipe character (e.g., +"0x01|0x02"), or a string of identifiers separated by pipe character +(e.g., "DAEMON_DEBUG_DEVICE|DAEMON_DEBUG_MMC"). .TP .B library-debug-mask <device> [new-value] Displays/sets library debug mask; \fBdevice\fR is the number of the desired device, or \fIall\fR. \fBnew-value\fR is the new debug mask value. If this -argument is omitted, current debug mask is displayed. A list of supported -debug mask values can be obtained with +argument is omitted, current debug mask is displayed. The list of supported +debug mask identifiers and values can be obtained with .B enum-library-debug-masks -command. +command. The \fBnew-value\fR can be either a single numeric value (e.g, +0x03), a string of numeric values separated by pipe character (e.g., +"0x01|0x02"), or a string of identifiers separated by pipe character +(e.g., "MIRAGE_DEBUG_PARSER|MIRAGE_DEBUG_DISC"). .TP .B dpm-emulation <device> [new-value] Displays/sets DPM emulation flag. \fBdevice\fR is the number of the desired @@ -205,6 +211,12 @@ .B Setting daemon debug mask for the first device: cdemu daemon-debug-mask 0 0x01 .TP +.B Setting daemon debug mask for the first device (composite): +cdemu daemon-debug-mask 0 "0x01|0x02" +.TP +.B Setting daemon debug mask for the first device (composite, by name): +cdemu daemon-debug-mask 0 "DAEMON_DEBUG_DEVICE|DAEMON_DEBUG_MMC" +.TP .B Obtaining library debug mask for the first device: cdemu library-debug-mask 0 .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cdemu-client-3.2.0/src/cdemu new/cdemu-client-3.2.3/src/cdemu --- old/cdemu-client-3.2.0/src/cdemu 2018-07-07 21:55:02.000000000 +0200 +++ new/cdemu-client-3.2.3/src/cdemu 2019-08-31 10:38:40.000000000 +0200 @@ -21,6 +21,7 @@ from __future__ import print_function import argparse +import collections import datetime import sys import os.path @@ -41,7 +42,7 @@ # *** Globals *** app_name = "cdemu" -app_version = "3.2.0" +app_version = "3.2.3" supported_daemon_interface_version = [ 7, 0 ] # I18n @@ -140,7 +141,7 @@ except GLib.Error as e: raise CDEmuError(_("Failed to get number of devices: %s") % (e)) - for device in range(0, num_devices): + for device in range(num_devices): # Device's status try: status = proxy.DeviceGetStatus(device) @@ -223,7 +224,7 @@ except GLib.Error as e: raise CDEmuError(_("Failed to get number of devices: %s") % (e)) - for device in range(0, num_devices): + for device in range(num_devices): # Device's status try: status = proxy.DeviceGetStatus(device) @@ -355,7 +356,7 @@ except GLib.Error as e: raise CDEmuError(_("Failed to get number of devices: %s") % (e)) - for device in range(0, num_devices): + for device in range(num_devices): try: proxy.DeviceUnload(device) except GLib.Error as e: @@ -392,7 +393,7 @@ print_header(_("Devices' status:")) print("%-5s %-10s %s" % (_("DEV"), _("LOADED"), _("FILENAME"))) - for device in range (0, num_devices): + for device in range (num_devices): try: [loaded, filenames] = proxy.DeviceGetStatus(device) except GLib.Error as e: @@ -429,7 +430,7 @@ print_header(_("Device mapping:")) print("%-5s %-15s %-15s" % (_("DEV"), _("SCSI CD-ROM"), _("SCSI generic"))) - for device in range (0, num_devices): + for device in range (num_devices): try: [dev_sr, dev_sg] = proxy.DeviceGetMapping(device) except GLib.Error as e: @@ -456,13 +457,15 @@ parser.set_defaults(command_function=self) def __call__ (self, proxy, arguments): + # Retrieve list of valid masks (for encoding/decoding) + mask_mapping = self.__get_debug_mask_mapping(proxy) + # Set daemon debug mask if hasattr(arguments, "new_value"): - try: - mask = int(arguments.new_value, 0) - except ValueError: - raise CDEmuError(_("String '%s' is not a number") % (arguments.new_value)) + # Convert the input value to mask + mask = self.__convert_input_to_mask(arguments.new_value, mask_mapping) + # Set the mask if arguments.device == "all": try: num_devices = proxy.GetNumberOfDevices() @@ -470,7 +473,7 @@ raise CDEmuError(_("Failed to get number of devices: %s") % (e)) print(_("Setting daemon debug mask of all devices to 0x%X.") % (mask)) - for device in range(0, num_devices): + for device in range(num_devices): try: proxy.DeviceSetOption(device, "daemon-debug-mask", GLib.Variant("i", mask)) except GLib.Error as e: @@ -498,16 +501,18 @@ raise CDEmuError(_("Failed to get number of devices: %s") % (e)) print_header(_("Devices' daemon debug masks:")) - print("%-5s %-10s" % (_("DEV"), _("DEBUG MASK"))) + print("%-5s %-10s %s" % (_("DEV"), _("DEBUG MASK"), _("MEANING"))) - for device in range(0, num_devices): + for device in range(num_devices): try: mask = proxy.DeviceGetOption(device, "daemon-debug-mask") except GLib.Error as e: print_warning(_("Failed to get daemon debug mask of device %i: %s") % (device, e)) continue - print("%-5s 0x%08X" % (device, mask)) + mask_meaning = self.__convert_mask_to_string(mask, mask_mapping) + + print("%-5s 0x%08X %s" % (device, mask, mask_meaning)) else: try: device = int(arguments.device, 0) @@ -517,7 +522,50 @@ except ValueError: raise CDEmuError(_("String '%s' is not a number") % (arguments.device)) - print(_("Daemon debug mask of device %i: 0x%X") % (device, mask)) + mask_meaning = self.__convert_mask_to_string(mask, mask_mapping) + + print(_("Daemon debug mask of device %i: 0x%X (%s)") % (device, mask, mask_meaning)) + + def __convert_input_to_mask (self, input_str, mapping): + output_mask = 0 + + # Split input string on pipe (|) + tokens = input_str.split("|") + for token in tokens: + token = token.strip() + + try: + if token in mapping: + val = mapping[token] + else: + val = int(token, 0) + except ValueError: + raise CDEmuError(_("String '%s' is not a number nor was it found in the list of valid debug mask identifiers") % (token)) + + output_mask |= val + + return output_mask + + def __convert_mask_to_string (self, value, mapping): + output_list = [] + + for mask_name, mask_value in mapping.items(): + if value & mask_value: + output_list.append(mask_name) + + return "|".join(output_list) + + def __get_debug_mask_mapping (self, proxy): + mapping = collections.OrderedDict() + + try: + debug_masks = proxy.EnumDaemonDebugMasks() + for debug_mask in debug_masks: + mapping[debug_mask[0]] = debug_mask[1] + except GLib.Error as e: + print_warning(_("Failed to enumerate supported daemon debug masks: %s") % (e)) + + return mapping ######################################################################## @@ -536,13 +584,15 @@ parser.add_argument("new_value", nargs="?", type=str, help=_("new value")) def __call__ (self, proxy, arguments): + # Retrieve list of valid masks (for encoding/decoding) + mask_mapping = self.__get_debug_mask_mapping(proxy) + # Set debug mask if hasattr(arguments, "new_value"): - try: - mask = int(arguments.new_value, 0) - except ValueError: - raise CDEmuError(_("String '%s' is not a number") % (arguments.new_value)) + # Convert the input value to mask + mask = self.__convert_input_to_mask(arguments.new_value, mask_mapping) + # Set the mask if arguments.device == "all": try: num_devices = proxy.GetNumberOfDevices() @@ -550,7 +600,7 @@ raise CDEmuError(_("Failed to get number of devices: %s") % (e)) print(_("Setting library debug mask of all devices to 0x%X.") % (mask)) - for device in range(0, num_devices): + for device in range(num_devices): try: proxy.DeviceSetOption(device, "library-debug-mask", GLib.Variant("i", mask)) except GLib.Error as e: @@ -578,15 +628,17 @@ raise CDEmuError(_("Failed to get number of devices: %s") % (e)) print_header(_("Devices' library debug masks:")) - print("%-5s %-10s" % (_("DEV"), _("DEBUG MASK"))) + print("%-5s %-10s %s" % (_("DEV"), _("DEBUG MASK"), _("MEANING"))) - for device in range(0, num_devices): + for device in range(num_devices): try: mask = proxy.DeviceGetOption(device, "library-debug-mask") except GLib.Error as e: print_warning(_("Failed to get library debug mask of device %i: %s") % (device, e)) - print("%-5s 0x%08X" % (device, mask)) + mask_meaning = self.__convert_mask_to_string(mask, mask_mapping) + + print("%-5s 0x%08X %s" % (device, mask, mask_meaning)) else: try: device = int(arguments.device, 0) @@ -596,7 +648,50 @@ except ValueError: raise CDEmuError(_("String '%s' is not a number") % (mask)) - print(_("Library debug mask of device %i: 0x%X") % (device, mask)) + mask_meaning = self.__convert_mask_to_string(mask, mask_mapping) + + print(_("Library debug mask of device %i: 0x%X (%s)") % (device, mask, mask_meaning)) + + def __convert_input_to_mask (self, input_str, mapping): + output_mask = 0 + + # Split input string on pipe (|) + tokens = input_str.split("|") + for token in tokens: + token = token.strip() + + try: + if token in mapping: + val = mapping[token] + else: + val = int(token, 0) + except ValueError: + raise CDEmuError(_("String '%s' is not a number nor was it found in the list of valid debug mask identifiers") % (token)) + + output_mask |= val + + return output_mask + + def __convert_mask_to_string (self, value, mapping): + output_list = [] + + for mask_name, mask_value in mapping.items(): + if value & mask_value: + output_list.append(mask_name) + + return "|".join(output_list) + + def __get_debug_mask_mapping (self, proxy): + mapping = collections.OrderedDict() + + try: + debug_masks = proxy.EnumLibraryDebugMasks() + for debug_mask in debug_masks: + mapping[debug_mask[0]] = debug_mask[1] + except GLib.Error as e: + print_warning(_("Failed to enumerate supported library debug masks: %s") % (e)) + + return mapping ######################################################################## @@ -629,7 +724,7 @@ raise CDEmuError(_("Failed to get number of devices: %s") % (e)) print(_("Setting DPM emulation flag of all devices to %i.") % (enabled)) - for device in range(0, num_devices): + for device in range(num_devices): try: proxy.DeviceSetOption(device, "dpm-emulation", GLib.Variant("b", enabled)) except GLib.Error as e: @@ -659,7 +754,7 @@ print_header(_("Devices' DPM emulation flag:")) print("%-5s %-10s" % (_("DEV"), _("ENABLED"))) - for device in range(0, num_devices): + for device in range(num_devices): try: enabled = proxy.DeviceGetOption(device, "dpm-emulation") except GLib.Error as e: @@ -709,7 +804,7 @@ raise CDEmuError(_("Failed to get number of devices: %s") % (e)) print(_("Setting transfer rate emulation flag of all devices to %i.") % (enabled)) - for device in range(0, num_devices): + for device in range(num_devices): try: proxy.DeviceSetOption(device, "tr-emulation", GLib.Variant("b", enabled)) except GLib.Error as e: @@ -739,7 +834,7 @@ print(_("Devices' transfer rate emulation flag:")) print("%-5s %-10s" % (_("DEV"), _("ENABLED"))) - for device in range(0, num_devices): + for device in range(num_devices): try: enabled = proxy.DeviceGetOption(device, "tr-emulation") except GLib.Error as e: @@ -789,7 +884,7 @@ raise CDEmuError(_("Failed to get number of devices: %s") % (e)) print(_("Setting bad sector emulation flag of all devices to %i.") % (enabled)) - for device in range(0, num_devices): + for device in range(num_devices): try: proxy.DeviceSetOption(device, "bad-sector-emulation", GLib.Variant("b", enabled)) except GLib.Error as e: @@ -819,7 +914,7 @@ print_header(_("Devices' bad sector emulation flag:")) print("%-5s %-10s" % (_("DEV"), _("ENABLED"))) - for device in range(0, num_devices): + for device in range(num_devices): try: enabled = proxy.DeviceGetOption(device, "bad-sector-emulation") except GLib.Error as e: @@ -869,7 +964,7 @@ raise CDEmuError(_("Failed to get number of devices: %s") % (e)) print(_("Setting DVD report CSS/CPPM flag of all devices to %i.") % (enabled)) - for device in range(0, num_devices): + for device in range(num_devices): try: proxy.DeviceSetOption(device, "dvd-report-css", GLib.Variant("b", enabled)) except GLib.Error as e: @@ -899,7 +994,7 @@ print_header(_("Devices' DVD report CSS/CPPM flag:")) print("%-5s %-10s" % (_("DEV"), _("ENABLED"))) - for device in range(0, num_devices): + for device in range(num_devices): try: enabled = proxy.DeviceGetOption(device, "dvd-report-css") except GLib.Error as e: @@ -939,7 +1034,7 @@ if hasattr(arguments, "new_id"): device_id = tuple(arguments.new_id) - if len(device_id) is not 4: + if len(device_id) != 4: raise CDEmuError(_("New device ID must consist of exactly four strings!")) if arguments.device == "all": @@ -949,7 +1044,7 @@ raise CDEmuError(_("Failed to get number of devices: %s") % (e)) print(_("Setting device ID of all devices to %s.") % (device_id)) - for device in range(0, num_devices): + for device in range(num_devices): try: proxy.DeviceSetOption(device, "device-id", GLib.Variant("(ssss)", device_id)) except GLib.Error as e: @@ -980,7 +1075,7 @@ print_header(_("Devices' IDs:")) print("%-5s %s" % (_("DEV"), _("DEVICE ID"))) - for device in range(0, num_devices): + for device in range(num_devices): try: values = proxy.DeviceGetOption(device, "device-id") device_id = list(map(str, values))
