Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 01/14] support/scripts/pkg-stats: URL checking support
Date: Thu, 20 Sep 2018 22:58:18 +0200	[thread overview]
Message-ID: <20180920225818.51c10322@windsurf> (raw)
In-Reply-To: <1537449899-9576-1-git-send-email-matthew.weber@rockwellcollins.com>

Hello Matt,

On Thu, 20 Sep 2018 08:24:46 -0500, Matt Weber wrote:

> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> index b7b00e8..c83545b 100755
> --- a/support/scripts/pkg-stats
> +++ b/support/scripts/pkg-stats
> @@ -24,6 +24,8 @@ from collections import defaultdict
>  import re
>  import subprocess
>  import sys
> +import time
> +import requests  # URL checking
>  
>  INFRA_RE = re.compile("\$\(eval \$\(([a-z-]*)-package\)\)")
>  
> @@ -43,10 +45,30 @@ class Package:
>          self.patch_count = 0
>          self.warnings = 0
>          self.current_version = None
> +        self.url = None
>  
>      def pkgvar(self):
>          return self.name.upper().replace("-", "_")
>  
> +    def set_url(self):
> +        """
> +        Fills in the .url field
> +        """
> +        in_help_section = False
> +        self.url = "No Config"
> +        for filename in os.listdir(os.path.dirname(self.path)):
> +            if fnmatch.fnmatch(filename, 'Config.*'):
> +                fp = open(os.path.join(os.path.dirname(self.path), filename), "r")
> +                for config_line in fp:
> +                    if config_line.strip() == "help":
> +                        in_help_section = True
> +                    if in_help_section and re.match("(.*)https?://", config_line):
> +                        self.url = ''.join(config_line.split())
> +                        fp.close()
> +                        return
> +                self.url = "Missing Entry"
> +                fp.close()
> +
>      def set_infra(self):
>          """
>          Fills in the .infras field
> @@ -356,7 +378,19 @@ def boolean_str(b):
>  
>  def dump_html_pkg(f, pkg):
>      f.write(" <tr>\n")
> -    f.write("  <td>%s</td>\n" % pkg.path[2:])
> +    url_status = "Ok"
> +    if str(pkg.url) == "Missing Entry":
> +        f.write("  <td>%s<br>    (URL: Missing URL)</td>\n" % pkg.path[2:])
> +    elif str(pkg.url) == "No Config":
> +        f.write("  <td>%s<br>    (URL: No Config File)</td>\n" % pkg.path[2:])
> +    else:
> +        try:
> +            url_status_code = requests.head(pkg.url, verify=False).status_code
> +            if url_status_code > 308:
> +                url_status = "Error(" + str(url_status_code) + ")"
> +        except requests.exceptions.RequestException as e:
> +            url_status = e
> +        f.write("  <td>%s<br>    (<a href=%s>URL: %s</a>)</td>\n" % (pkg.path[2:], str(pkg.url), url_status))

Could you instead add a new column, like we already have for the
version, package type, number of patches, etc. and use the existing
green/orange/red colors to indicate URL present and working (green),
URL not present (orange) and URL present but not working (red) ?

How long does it take to run the script before/after your addition, on
all packages ? I'm sure you remember I was working on adding support
for using release-monitoring.org to this script to keep track of
upstream versions of packages, but doing it sequentially for the 2000+
packages we have was way too slow and I had to use several threads to
speed things up and make it reasonable.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2018-09-20 20:58 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 13:24 [Buildroot] [PATCH 01/14] support/scripts/pkg-stats: URL checking support Matt Weber
2018-09-20 13:24 ` [Buildroot] [PATCH 02/14] boot/at91bootstrap: URL update Matt Weber
2018-09-20 20:12   ` Thomas Petazzoni
2018-09-20 20:35     ` Matthew Weber
2018-09-20 21:10       ` Thomas Petazzoni
2018-09-20 13:24 ` [Buildroot] [PATCH 03/14] boot/at91bootstrap3: " Matt Weber
2018-09-20 20:11   ` Thomas Petazzoni
2018-10-05 11:48   ` Peter Korsgaard
2018-09-20 13:24 ` [Buildroot] [PATCH 04/14] boot/at91dataflashboot: " Matt Weber
2018-09-20 13:24 ` [Buildroot] [PATCH 05/14] boot/xloader: " Matt Weber
2018-09-20 20:28   ` Thomas Petazzoni
2018-10-05 11:49   ` Peter Korsgaard
2018-09-20 13:24 ` [Buildroot] [PATCH 06/14] package/android-tools: " Matt Weber
2018-09-20 20:21   ` Thomas Petazzoni
2018-10-05 11:48   ` Peter Korsgaard
2018-09-20 13:24 ` [Buildroot] [PATCH 07/14] package/arp-scan: " Matt Weber
2018-09-20 20:21   ` Thomas Petazzoni
2018-10-05 11:48   ` Peter Korsgaard
2018-09-20 13:24 ` [Buildroot] [PATCH 08/14] package/bandwidthd: URL move to newline Matt Weber
2018-09-20 20:21   ` Thomas Petazzoni
2018-10-05 11:49   ` Peter Korsgaard
2018-09-20 13:24 ` [Buildroot] [PATCH 09/14] package/connman: " Matt Weber
2018-09-20 19:29   ` Thomas Petazzoni
2018-10-05 11:51   ` Peter Korsgaard
2018-09-20 13:24 ` [Buildroot] [PATCH 10/14] package/glibc: URL update Matt Weber
2018-09-20 19:30   ` Thomas Petazzoni
2018-09-20 20:05     ` Matthew Weber
2018-09-20 20:17       ` Thomas Petazzoni
2018-09-20 20:31         ` Matthew Weber
2018-09-20 13:24 ` [Buildroot] [PATCH 11/14] package/tidsp-binaries: " Matt Weber
2018-09-20 19:39   ` Thomas Petazzoni
2018-09-20 21:38     ` Matthew Weber
2018-09-20 13:24 ` [Buildroot] [PATCH 12/14] boot/vexpress-firmware: " Matt Weber
2018-09-20 19:41   ` Thomas Petazzoni
2018-10-05 11:47   ` Peter Korsgaard
2018-09-20 13:24 ` [Buildroot] [PATCH 13/14] package/alljoyn-base: " Matt Weber
2018-09-20 20:04   ` Thomas Petazzoni
2018-09-20 20:44     ` Matthew Weber
2018-09-20 21:12       ` Thomas Petazzoni
2018-09-20 13:24 ` [Buildroot] [PATCH 14/14] package/alljoyn-tcl-base: " Matt Weber
2018-09-20 20:58 ` Thomas Petazzoni [this message]
2018-09-21 12:56   ` [Buildroot] [PATCH 01/14] support/scripts/pkg-stats: URL checking support Matthew Weber
2018-09-21 13:08     ` Thomas Petazzoni
2018-09-21 13:15       ` Matthew Weber

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=20180920225818.51c10322@windsurf \
    --to=thomas.petazzoni@bootlin.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