[v3,03/12] support/scripts/pkg-stats: set developers info
diff mbox series

Message ID 20200222085715.23769-4-heiko.thiery@gmail.com
State Superseded
Headers show
Series
  • pkg-stats json output improvements
Related show

Commit Message

Heiko Thiery Feb. 22, 2020, 8:57 a.m. UTC
Use the function 'parse_developers' function from getdeveloperlib that
collect the information about the developers and the files they
maintain. Then set the maintainer(s) to each package.

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

Comments

Titouan Christophe Feb. 23, 2020, 1:45 p.m. UTC | #1
Heiko, all,
On 2/22/20 9:57 AM, Heiko Thiery wrote:
> Use the function 'parse_developers' function from getdeveloperlib that
> collect the information about the developers and the files they
> maintain. Then set the maintainer(s) to each package.
> 
> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
> ---
>   support/scripts/pkg-stats | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> index 4c963cef0f..643272e9d2 100755
> --- a/support/scripts/pkg-stats
> +++ b/support/scripts/pkg-stats
> @@ -30,10 +30,14 @@ import certifi
>   import distutils.version
>   import time
>   import gzip
> +import sys
>   from urllib3 import HTTPSConnectionPool
>   from urllib3.exceptions import HTTPError
>   from multiprocessing import Pool
>   
> +sys.path.append('utils/')
> +from getdeveloperlib import parse_developers
> + >   NVD_START_YEAR = 2002
>   NVD_JSON_VERSION = "1.0"
>   NVD_BASE_URL = "https://nvd.nist.gov/feeds/json/cve/" + NVD_JSON_VERSION
> @@ -169,6 +173,15 @@ class Package:
>           """
>           return cve in self.all_ignored_cves.get(self.pkgvar(), [])
>   
> +    def set_developers(self, developers):
> +        """
> +        Fills in the .developers field
> +        """
> +        self.developers = list()
> +        for dev in developers:
> +            if dev.hasfile(self.path):
> +                self.developers.append((dev.name))

Bikeshedding again, but maybe more elegant like this:

self.developers = [
     dev.name
     for dev in developers
     if dev.hasfile(self.path)
]

> +
>       def __eq__(self, other):
>           return self.path == other.path
>   
> @@ -891,6 +904,8 @@ def __main__():
>                                         'HEAD']).splitlines()[0]
>       print("Build package list ...")
>       packages = get_pkglist(args.npackages, package_list)
> +    print("Getting developers ...")
> +    developers = parse_developers()
>       print("Getting package make info ...")
>       package_init_make_info()
>       print("Getting package details ...")
> @@ -902,6 +917,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 ...")
>
Heiko Thiery Feb. 23, 2020, 9:37 p.m. UTC | #2
Hi Titouan and all,

Am So., 23. Feb. 2020 um 14:45 Uhr schrieb Titouan Christophe
<titouan.christophe@railnova.eu>:
>
> Heiko, all,
> On 2/22/20 9:57 AM, Heiko Thiery wrote:
> > Use the function 'parse_developers' function from getdeveloperlib that
> > collect the information about the developers and the files they
> > maintain. Then set the maintainer(s) to each package.
> >
> > Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
> > ---
> >   support/scripts/pkg-stats | 16 ++++++++++++++++
> >   1 file changed, 16 insertions(+)
> >
> > diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> > index 4c963cef0f..643272e9d2 100755
> > --- a/support/scripts/pkg-stats
> > +++ b/support/scripts/pkg-stats
> > @@ -30,10 +30,14 @@ import certifi
> >   import distutils.version
> >   import time
> >   import gzip
> > +import sys
> >   from urllib3 import HTTPSConnectionPool
> >   from urllib3.exceptions import HTTPError
> >   from multiprocessing import Pool
> >
> > +sys.path.append('utils/')
> > +from getdeveloperlib import parse_developers
> > + >   NVD_START_YEAR = 2002
> >   NVD_JSON_VERSION = "1.0"
> >   NVD_BASE_URL = "https://nvd.nist.gov/feeds/json/cve/" + NVD_JSON_VERSION
> > @@ -169,6 +173,15 @@ class Package:
> >           """
> >           return cve in self.all_ignored_cves.get(self.pkgvar(), [])
> >
> > +    def set_developers(self, developers):
> > +        """
> > +        Fills in the .developers field
> > +        """
> > +        self.developers = list()
> > +        for dev in developers:
> > +            if dev.hasfile(self.path):
> > +                self.developers.append((dev.name))
>
> Bikeshedding again, but maybe more elegant like this:

Indeed this is more elegant. I will change that.

> self.developers = [
>      dev.name
>      for dev in developers
>      if dev.hasfile(self.path)
> ]
>
> > +
> >       def __eq__(self, other):
> >           return self.path == other.path
> >
> > @@ -891,6 +904,8 @@ def __main__():
> >                                         'HEAD']).splitlines()[0]
> >       print("Build package list ...")
> >       packages = get_pkglist(args.npackages, package_list)
> > +    print("Getting developers ...")
> > +    developers = parse_developers()
> >       print("Getting package make info ...")
> >       package_init_make_info()
> >       print("Getting package details ...")
> > @@ -902,6 +917,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 ...")
> >

Patch
diff mbox series

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 4c963cef0f..643272e9d2 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -30,10 +30,14 @@  import certifi
 import distutils.version
 import time
 import gzip
+import sys
 from urllib3 import HTTPSConnectionPool
 from urllib3.exceptions import HTTPError
 from multiprocessing import Pool
 
+sys.path.append('utils/')
+from getdeveloperlib import parse_developers
+
 NVD_START_YEAR = 2002
 NVD_JSON_VERSION = "1.0"
 NVD_BASE_URL = "https://nvd.nist.gov/feeds/json/cve/" + NVD_JSON_VERSION
@@ -169,6 +173,15 @@  class Package:
         """
         return cve in self.all_ignored_cves.get(self.pkgvar(), [])
 
+    def set_developers(self, developers):
+        """
+        Fills in the .developers field
+        """
+        self.developers = list()
+        for dev in developers:
+            if dev.hasfile(self.path):
+                self.developers.append((dev.name))
+
     def __eq__(self, other):
         return self.path == other.path
 
@@ -891,6 +904,8 @@  def __main__():
                                       'HEAD']).splitlines()[0]
     print("Build package list ...")
     packages = get_pkglist(args.npackages, package_list)
+    print("Getting developers ...")
+    developers = parse_developers()
     print("Getting package make info ...")
     package_init_make_info()
     print("Getting package details ...")
@@ -902,6 +917,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 ...")