[oe-commits] [openembedded-core] 17/31: wic: add --system-id wks option

git at git.openembedded.org git at git.openembedded.org
Fri Apr 29 06:55:26 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit b9c56b1c95cd1d0fd809d257e0cd05a50c481bed
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Fri Apr 22 12:31:59 2016 +0300

    wic: add --system-id wks option
    
    Added new option --system-id to wks parser. The option
    will be used to set partition system id.
    
    [YOCTO #9096]
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 scripts/lib/wic/ksparser.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 8c3f808..10d0d7c 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -92,6 +92,24 @@ def cannedpathtype(arg):
         raise ArgumentTypeError("file not found: %s" % arg)
     return result
 
+def systemidtype(arg):
+    """
+    Custom type for ArgumentParser
+    Checks if the argument sutisfies system id requirements,
+    i.e. if it's one byte long integer > 0
+    """
+    error = "Invalid system type: %s. must be hex "\
+            "between 0x1 and 0xFF" % arg
+    try:
+        result = int(arg, 16)
+    except ValueError:
+        raise ArgumentTypeError(error)
+
+    if result <= 0 or result > 0xff:
+        raise ArgumentTypeError(error)
+
+    return arg
+
 class KickStart(object):
     """"Kickstart parser implementation."""
 
@@ -121,6 +139,7 @@ class KickStart(object):
         part.add_argument('--size', type=sizetype, default=0)
         part.add_argument('--source')
         part.add_argument('--sourceparams')
+        part.add_argument('--system-id', type=systemidtype)
         part.add_argument('--use-uuid', action='store_true')
         part.add_argument('--uuid')
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list