diff options
author | Ajay Garg <ajay@activitycentral.com> | 2012-10-02 15:02:58 (GMT) |
---|---|---|
committer | Ajay Garg <ajay@activitycentral.com> | 2012-10-02 15:02:58 (GMT) |
commit | bf5b07b23253b75359ffefa1199b60aceda31963 (patch) | |
tree | 519c024abebd4925edebb544bb8eb7c6d00f92cd | |
parent | 136ee50fb8588b3850cd5511c0958cb465417bf3 (diff) |
Fixing a duplicate patch (missed this in previous commit).
-rw-r--r-- | rpms/sugar/0140-sdxo-2379-Fix-the-logic-of-computing-XO-Serial-Numbe.patch | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/rpms/sugar/0140-sdxo-2379-Fix-the-logic-of-computing-XO-Serial-Numbe.patch b/rpms/sugar/0140-sdxo-2379-Fix-the-logic-of-computing-XO-Serial-Numbe.patch deleted file mode 100644 index 2c7294b..0000000 --- a/rpms/sugar/0140-sdxo-2379-Fix-the-logic-of-computing-XO-Serial-Numbe.patch +++ /dev/null @@ -1,62 +0,0 @@ -From c7c1696ae3dd3cd2f2dff6c4ab752f0778499bf3 Mon Sep 17 00:00:00 2001 -From: Ajay Garg <ajay@activitycentral.com> -Date: Fri, 28 Sep 2012 00:14:41 +0530 -Subject: [PATCH] sdxo#2379: Fix the logic of computing XO-Serial Number. -Organization: Sugar Labs Foundation -Signed-off-by: Ajay Garg <ajay@activitycentral.com> ---- - src/jarabe/journal/misc.py | 33 +++++++++++++++++++++++++-------- - 1 files changed, 25 insertions(+), 8 deletions(-) - -diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py -index 2c5d39a..e5b135d 100644 ---- a/src/jarabe/journal/misc.py -+++ b/src/jarabe/journal/misc.py -@@ -323,19 +323,36 @@ def get_backup_identifier(): - return serial_number - - def get_xo_serial(): -- path = '/ofw/serial-number' -+ _OFW_TREE = '/ofw' -+ _PROC_TREE = '/proc/device-tree' -+ _SN = 'serial-number' -+ _not_available = _('Not available') - -+ serial_no = None -+ if os.path.exists(os.path.join(_OFW_TREE, _SN)): -+ serial_no = read_file(os.path.join(_OFW_TREE, _SN)) -+ elif os.path.exists(os.path.join(_PROC_TREE, _SN)): -+ serial_no = read_file(os.path.join(_PROC_TREE, _SN)) -+ -+ if serial_no is None: -+ serial_no = _not_available -+ -+ # Remove the trailing binary character, else DBUS will crash. -+ return serial_no.rstrip('\x00') -+ -+ -+def read_file(path): - if os.access(path, os.R_OK) == 0: - return None - -- file_descriptor = open(path, 'r') -- content = file_descriptor.read() -- file_descriptor.close() -- -- if content: -- return content.strip() -+ fd = open(path, 'r') -+ value = fd.read() -+ fd.close() -+ if value: -+ value = value.strip('\n') -+ return value - else: -- logging.error('No serial number at %s', path) -+ logging.debug('No information in file or directory: %s', path) - return None - - def get_nick(): --- -1.7.4.4 - |