From patchwork Fri Jan 3 15:18:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1217361 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.b="n+NvmUbn"; 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 47q7qB742nz9sR0 for ; Sat, 4 Jan 2020 02:19:18 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id BA3BE21577; Fri, 3 Jan 2020 15:19:16 +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 dGdZNii1k8cn; Fri, 3 Jan 2020 15:19:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 18CC721561; Fri, 3 Jan 2020 15:19:08 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 401E31BF599 for ; Fri, 3 Jan 2020 15:19:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 39E7F84821 for ; Fri, 3 Jan 2020 15:19:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HKkW4zxxgpFO for ; Fri, 3 Jan 2020 15:19:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 2922B85F4B for ; Fri, 3 Jan 2020 15:19:04 +0000 (UTC) Received: by mail-wr1-f52.google.com with SMTP id y11so42740650wrt.6 for ; Fri, 03 Jan 2020 07:19:04 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=14x5hogCwl8p5pV9FXBgFT/DFZ/NylxuYq9U+Gp7lQ8=; b=n+NvmUbn+xtUDv9QodJupuRlldI35goqXhzBtZHEIoKUQtovF8yy1oSe0OBvPvHKmo MjOZpFPZTc9cUEH3CbZgdRmqzDWP5VZTAVDThxANp32XYzRREb+JrZ8cwhh8suy4fijx nr9llRzXd5RRI2urlIFnR65P70xXgmdZ4fBqCsz+MY7iaMAHXMZ7p9jaN4wf4f9X7648 2ToOwJl6DqzHrPbxsRc2yTYoLND3boRYSOGeZr+/RDlx0JUkSyw0kKS0sy2+tlApKpH4 j7UHMtTDtPQJS40aB9QYZ3hp/UwICDaAS+sctQMpqO7EVSFyl6l4w2gkOd1h1h0s15BS trXQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=14x5hogCwl8p5pV9FXBgFT/DFZ/NylxuYq9U+Gp7lQ8=; b=iyQTlWsLQM/ejkuejAW8E3aadoMszIi9HqE4i0J/wQzHio7YDfN5tS9iJD3WFqF7Qk s56vmN69hV1cQ9Aiy0oZszu3B7/DPwVajqbYFdWg0gm38w5DapgT2140z3zwpXYpql/H ky/18h1pG3hfduCu+XpujTkUnAC8uBr3mOcdgTozskPDaRqu2nrswSo9czuEoCIfi3s6 AJsP8YkpShJi3ecVdathUq8Vut+yuIHkaN6wcdU1E+4AjywWZKfhwhSIme7wp03VG270 OCoSlEgbWHaCBGkCoSwkmaXOUitR4+etbrSpVJEBsxcJkLmQVTOsmnrY5EMwlE3L3Mxv wDzw== X-Gm-Message-State: APjAAAVhOQpPU7NQLwUzA5AnGMPYgoEHfatMDJXK2q6zlvnLweCAVzUH deg/K9rZF0hITNq+rlJ736MKxku9 X-Google-Smtp-Source: APXvYqwvqS69mzQLweYQeMuh/xE/3w8OIc290kC96wFt3I+fsCEAtFwYS2UPUgtVqNb2K+vzs2ak7A== X-Received: by 2002:a5d:51cc:: with SMTP id n12mr90618518wrv.177.1578064742344; Fri, 03 Jan 2020 07:19:02 -0800 (PST) Received: from hthiery01.sab.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id u16sm12460565wmj.41.2020.01.03.07.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 07:19:01 -0800 (PST) From: Heiko Thiery To: buildroot@buildroot.org Date: Fri, 3 Jan 2020 16:18:42 +0100 Message-Id: <20200103151849.10956-6-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200103151849.10956-1-heiko.thiery@gmail.com> References: <20200103151849.10956-1-heiko.thiery@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 05/11] support/scripts/pkg-stats: parse and set developers info 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 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch collects the developers information and stores developers to the Pakckage instance. Signed-off-by: Heiko Thiery --- support/scripts/pkg-stats | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index 4021aacceb..d520da6807 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -20,6 +20,7 @@ import argparse import datetime import fnmatch import os +import glob from collections import defaultdict import re import subprocess @@ -42,6 +43,50 @@ RM_API_STATUS_NOT_FOUND = 4 # because it's used by sub-processes. http_pool = None +class Developer: + def __init__(self, name, files): + self.name = name + self.files = files + +def parse_developers(basepath=None): + """Parse the DEVELOPERS file and return a list of Developer objects.""" + developers = [] + linen = 0 + if basepath is None: + basepath = os.getcwd() + with open(os.path.join(basepath, "DEVELOPERS"), "r") as f: + files = [] + name = None + for line in f: + line = line.strip() + if line.startswith("#"): + continue + elif line.startswith("N:"): + if name is not None or len(files) != 0: + print("Syntax error in DEVELOPERS file, line %d" % linen) + name = line[2:].strip() + elif line.startswith("F:"): + fname = line[2:].strip() + #dev_files = glob.glob(os.path.join(basepath, fname)) + dev_files = glob.glob(fname) + if len(dev_files) == 0: + print("WARNING: '%s' doesn't match any file" % fname) + files += dev_files + elif line == "": + if not name: + continue + developers.append(Developer(name, files)) + files = [] + name = None + else: + print("Syntax error in DEVELOPERS file, line %d: '%s'" % (linen, line)) + + return None + linen += 1 + # handle last developer + if name is not None: + developers.append(Developer(name, files)) + return developers class Package: all_licenses = list() @@ -56,6 +101,7 @@ class Package: self.has_license = False self.has_license_files = False self.has_hash = False + self.developers = None self.patches = {'count':0, 'files': None} self.warnings = 0 self.current_version = None @@ -151,6 +197,16 @@ class Package: self.warnings = int(m.group(1)) return + def set_developers(self, developers): + """ + Fills in the .developers field + """ + self.developers = list() + for dev in developers: + for f in dev.files: + if self.pkg_path[2:] == f[:-1]: + self.developers.append((dev.name)) + def __eq__(self, other): return self.path == other.path @@ -729,6 +785,8 @@ def __main__(): date = datetime.datetime.utcnow() commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).splitlines()[0] + print("Getting developers...") + developers = parse_developers() print("Build package list ...") packages = get_pkglist(args.npackages, package_list) print("Getting developers...") @@ -744,6 +802,7 @@ def __main__(): pkg.set_check_package_warnings() pkg.set_current_version() pkg.set_url() + pkg.set_developers(developers) print("Checking URL status") check_package_urls(packages) print("Getting latest versions ...")