Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 3/6] scripts/oe-pkgdata-util: check path arguments to ensure they exist
Date: Mon, 28 Oct 2013 17:11:56 +0000	[thread overview]
Message-ID: <eff2690f7976664e6257c1c19c89feea9152eb9e.1382980153.git.paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <cover.1382980153.git.paul.eggleton@linux.intel.com>
In-Reply-To: <cover.1382980153.git.paul.eggleton@linux.intel.com>

Show an error if the specified paths don't exist.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/oe-pkgdata-util | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index e34fcbe..01fccd2 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -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:
-- 
1.8.1.2



  parent reply	other threads:[~2013-10-28 17:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 17:11 [PATCH 0/6] oe-pkgdata-util improvements Paul Eggleton
2013-10-28 17:11 ` [PATCH 1/6] scripts/oe-pkgdata-util: remove remnants of former pkgdata structure Paul Eggleton
2013-10-28 17:11 ` [PATCH 2/6] scripts/oe-pkgdata-util: improve help text and command line parsing Paul Eggleton
2013-10-28 17:11 ` Paul Eggleton [this message]
2013-10-28 17:11 ` [PATCH 4/6] scripts/oe-pkgdata-util: add ability to search for a target path Paul Eggleton
2013-10-28 17:11 ` [PATCH 5/6] scripts/oe-pkgdata-util: add ability to look up runtime package names Paul Eggleton
2013-10-28 17:11 ` [PATCH 6/6] scripts/oe-pkgdata-util: add ability to find a recipe from a target package Paul Eggleton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eff2690f7976664e6257c1c19c89feea9152eb9e.1382980153.git.paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox