Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Thiery <heiko.thiery@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] support/scripts/pkg-stats: add tilde '~' expansion for pathes
Date: Sat,  7 Mar 2020 11:37:05 +0100	[thread overview]
Message-ID: <20200307103704.20524-1-heiko.thiery@gmail.com> (raw)

The script arguments 'nvd-path', 'json' and 'html' currently does not
allow to have '~' in path for user home directory. With this patch
this '~' is expanded to the real user home directory.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
 support/scripts/pkg-stats | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 8a67e509e1..bfe3a3f8d4 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -861,12 +861,16 @@ def dump_json(packages, stats, date, commit, output):
         f.write('\n')
 
 
+def resolvepath(path):
+        return os.path.abspath(os.path.expanduser(path))
+
+
 def parse_args():
     parser = argparse.ArgumentParser()
     output = parser.add_argument_group('output', 'Output file(s)')
-    output.add_argument('--html', dest='html', action='store',
+    output.add_argument('--html', dest='html', type=resolvepath,
                         help='HTML output file')
-    output.add_argument('--json', dest='json', action='store',
+    output.add_argument('--json', dest='json', type=resolvepath,
                         help='JSON output file')
     packages = parser.add_mutually_exclusive_group()
     packages.add_argument('-n', dest='npackages', type=int, action='store',
@@ -874,7 +878,7 @@ def parse_args():
     packages.add_argument('-p', dest='packages', action='store',
                           help='List of packages (comma separated)')
     parser.add_argument('--nvd-path', dest='nvd_path',
-                        help='Path to the local NVD database')
+                        help='Path to the local NVD database', type=resolvepath)
     args = parser.parse_args()
     if not args.html and not args.json:
         parser.error('at least one of --html or --json (or both) is required')
-- 
2.20.1

             reply	other threads:[~2020-03-07 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-07 10:37 Heiko Thiery [this message]
2020-03-07 14:56 ` [Buildroot] [PATCH] support/scripts/pkg-stats: add tilde '~' expansion for pathes Thomas Petazzoni
2020-03-07 21:00   ` Heiko Thiery
2020-04-12 12:56 ` Thomas Petazzoni

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=20200307103704.20524-1-heiko.thiery@gmail.com \
    --to=heiko.thiery@gmail.com \
    --cc=buildroot@busybox.net \
    /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