]> code.ossystems Code Review - openembedded-core.git/commitdiff
scripts/oe-pkgdata-util: check path arguments to ensure they exist
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Fri, 18 Oct 2013 11:23:30 +0000 (12:23 +0100)
committerPaul Eggleton <paul.eggleton@linux.intel.com>
Mon, 28 Oct 2013 17:08:07 +0000 (17:08 +0000)
Show an error if the specified paths don't exist.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
scripts/oe-pkgdata-util

index e34fcbe0795231a52b254ef76a820aeb8145b011..01fccd2db0f778a01f74764405e3468daa333eca 100755 (executable)
@@ -37,6 +37,14 @@ def glob(args, usage):
     pkglist_file = args[1]
     globs = args[2].split()
 
+    if not os.path.exists(pkgdata_dir):
+        print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir)
+        sys.exit(1)
+
+    if not os.path.exists(pkglist_file):
+        print('ERROR: Unable to find package list file %s' % pkglist_file)
+        sys.exit(1)
+
     skipregex = re.compile("-locale-|^locale-base-|-dev$|-doc$|-dbg$|-staticdev$|^kernel-module-")
 
     mappedpkgs = set()
@@ -148,6 +156,10 @@ def read_value(args, usage):
     var = args[1]
     packages = args[2].split()
 
+    if not os.path.exists(pkgdata_dir):
+        print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir)
+        sys.exit(1)
+
     def readvar(pkgdata_file, var):
         val = ""
         with open(pkgdata_file, 'r') as f: