From patchwork Sat Mar 7 10:37:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1250863 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=buL2dWlM; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ZLYD1PrKz9sNg for ; Sat, 7 Mar 2020 21:37:59 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id EECE7203F3; Sat, 7 Mar 2020 10:37:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mXrA6oPwHAyc; Sat, 7 Mar 2020 10:37:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 2494C20356; Sat, 7 Mar 2020 10:37:50 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id D1E971BF5F8 for ; Sat, 7 Mar 2020 10:37:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CE852875B6 for ; Sat, 7 Mar 2020 10:37:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dz93rUNXW2Mc for ; Sat, 7 Mar 2020 10:37:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id CDA57875A1 for ; Sat, 7 Mar 2020 10:37:46 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id t11so5258706wrw.5 for ; Sat, 07 Mar 2020 02:37:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XwFkawjGgLxpeiagMsJGACrBAVoGXABBeSmLwpe1eKU=; b=buL2dWlMWK1iTw2MBwPZl+doZ5yHRxd53wWScQJLA6w2B41IfM9FKCgGTT40mTwpge kg6b9ngVuEIHQqsXjqAcQXfBfVJ+YALsnmQECvEBRbN4RWoE1pjsVY0OpVekStXKvah4 jQQMqheZh1Z2pkJoPrQalFnJTrBGEIWAph9dIniOBTwxbwCUnzuWvon0wrt3Jptn91YE 5aZGl3xqjlch+Rt+uALZTrbzsR4YnOgRNVbNK364T3X+QjKCfvKLVqw1QHNuQVYqLXzI LLKo+xXtSIhrBi/H4VF7ORSpYuwAm8kaQLKWygscyQkmzhry8SdJpl9NtVhvkEVS9NOx SDmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XwFkawjGgLxpeiagMsJGACrBAVoGXABBeSmLwpe1eKU=; b=aVLTAJnf3a6EOLJF/+ndQOAdMLInHflx/XO61bRteEx/ehYjAWZgAKmQ0X6piZ+bHq eiocQo3aDmLVted6uz2mF/o/7LXv5jN5/27bZmj1xkiYBvGXSvKA+AnDLgXVnxlW6Gya Qlx3B2BPvkHPZ7ghJLPA/2xnXz8SNtq6NlICUxSgnU3xvPHtF1yqPX6dYnvr2dQwU8Ah g7FlDcHpSKekJ76aPDtJuLLYmUgpiGOLw/6JqX1FluEZqxsFNm9gtzqztlUvQfN9xvXs WS2CVlXHjkQ4+N1GCcWiWplrF14OPYgnpySyPGkAmwwrBReZoCs412t7/MOpxkBj+sOu /pvQ== X-Gm-Message-State: ANhLgQ07XJ1GTCcOi56mkwc9jPltjLndSm3XLPIXAIkldByAJ8WtDcCO T3jyVc5mKeHz2yuY9FKBGYWaQvqJ X-Google-Smtp-Source: ADFU+vt8OYILwKrXcP29Sgg0zzz0D4vswkkOwqElBHwNxoBMFi+t7Dr1GP0AQq6r0x7AhDScDxXKKw== X-Received: by 2002:adf:ead0:: with SMTP id o16mr9329793wrn.239.1583577465004; Sat, 07 Mar 2020 02:37:45 -0800 (PST) Received: from t450s.fritz.box (ip5f58981a.dynamic.kabel-deutschland.de. [95.88.152.26]) by smtp.gmail.com with ESMTPSA id f17sm31766619wrm.3.2020.03.07.02.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Mar 2020 02:37:44 -0800 (PST) From: Heiko Thiery To: buildroot@buildroot.org Date: Sat, 7 Mar 2020 11:37:05 +0100 Message-Id: <20200307103704.20524-1-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] support/scripts/pkg-stats: add tilde '~' expansion for pathes X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Thiery , Titouan Christophe Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 --- 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')