public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:master commit in: scripts/, .github/workflows/
@ 2021-04-02  9:54 Andrew Ammerlaan
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Ammerlaan @ 2021-04-02  9:54 UTC (permalink / raw
  To: gentoo-commits

commit:     e19e4730a005e718d8b8617c07bafca7e4e68346
Author:     Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
AuthorDate: Fri Apr  2 07:23:09 2021 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
CommitDate: Fri Apr  2 09:52:30 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=e19e4730

.github/workflows/*: reduce code-duplication

Reduce code duplication by moving the ::gentoo setup part
into a seperate script. This way only one file has to be
edited when e.g. updating the profile to a new version

Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> riseup.net>

 .github/workflows/duplicates.yml |  6 +-----
 .github/workflows/repoman.yml    |  6 +-----
 scripts/setup-master-gentoo.sh   | 10 ++++++++++
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/duplicates.yml b/.github/workflows/duplicates.yml
index d143d718e..6240adef0 100644
--- a/.github/workflows/duplicates.yml
+++ b/.github/workflows/duplicates.yml
@@ -13,11 +13,7 @@ jobs:
     - uses: actions/checkout@v2
     - name: Setup master gentoo repository
       run: |
-        sudo mkdir -p /var/db/repos/gentoo /etc/portage /var/cache/distfiles
-        wget -qO - "https://github.com/gentoo-mirror/gentoo/archive/master.tar.gz" | sudo tar xz -C /var/db/repos/gentoo --strip-components=1
-        sudo wget "https://www.gentoo.org/dtd/metadata.dtd" -O /var/cache/distfiles/metadata.dtd
-        sudo wget "https://gitweb.gentoo.org/proj/portage.git/plain/cnf/repos.conf" -O /etc/portage/repos.conf
-        sudo ln -s /var/db/repos/gentoo/profiles/default/linux/amd64/17.1 /etc/portage/make.profile
+        ./scripts/setup-master-gentoo.sh
     - name: Check for duplicates
       run: |
         ./scripts/check-duplicates.sh

diff --git a/.github/workflows/repoman.yml b/.github/workflows/repoman.yml
index b229afc94..fa9cebb6f 100644
--- a/.github/workflows/repoman.yml
+++ b/.github/workflows/repoman.yml
@@ -13,11 +13,7 @@ jobs:
     - uses: actions/checkout@v2
     - name: Setup master gentoo repository
       run: |
-        sudo mkdir -p /var/db/repos/gentoo /etc/portage /var/cache/distfiles
-        wget -qO - "https://github.com/gentoo-mirror/gentoo/archive/master.tar.gz" | sudo tar xz -C /var/db/repos/gentoo --strip-components=1
-        sudo wget "https://www.gentoo.org/dtd/metadata.dtd" -O /var/cache/distfiles/metadata.dtd
-        sudo wget "https://gitweb.gentoo.org/proj/portage.git/plain/cnf/repos.conf" -O /etc/portage/repos.conf
-        sudo ln -s /var/db/repos/gentoo/profiles/default/linux/amd64/17.1 /etc/portage/make.profile
+        ./scripts/setup-master-gentoo.sh
     - name: Setup and run Repoman
       run: |
         ./scripts/setup-and-run-repoman.sh

diff --git a/scripts/setup-master-gentoo.sh b/scripts/setup-master-gentoo.sh
new file mode 100755
index 000000000..a2939721a
--- /dev/null
+++ b/scripts/setup-master-gentoo.sh
@@ -0,0 +1,10 @@
+#! /usr/bin/env bash
+# Maintainer: Andrew Ammerlaan <andrewammerlaan@riseup.net>
+#
+# Fetch and setup the latest ::gentoo
+
+sudo mkdir -p /var/db/repos/gentoo /etc/portage /var/cache/distfiles
+wget -qO - "https://github.com/gentoo-mirror/gentoo/archive/master.tar.gz" | sudo tar xz -C /var/db/repos/gentoo --strip-components=1
+sudo wget "https://www.gentoo.org/dtd/metadata.dtd" -O /var/cache/distfiles/metadata.dtd
+sudo wget "https://gitweb.gentoo.org/proj/portage.git/plain/cnf/repos.conf" -O /etc/portage/repos.conf
+sudo ln -s /var/db/repos/gentoo/profiles/default/linux/amd64/17.1 /etc/portage/make.profile


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/proj/guru:master commit in: scripts/, .github/workflows/
@ 2022-04-06 19:43 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2022-04-06 19:43 UTC (permalink / raw
  To: gentoo-commits

commit:     5fa6ea3b1d1a78edc97608a3f92db07ab4ca19b7
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Apr  6 18:08:40 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Apr  6 18:08:40 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=5fa6ea3b

Add emails checker against bugzilla workflow

A new check that checks that all new emails written in metadata.xml
correspond to existing user in bugzilla.

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 .github/workflows/emails.yml | 29 +++++++++++++++++++++++++
 scripts/email-checker.py     | 51 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)

diff --git a/.github/workflows/emails.yml b/.github/workflows/emails.yml
index 6871760f4..e7791f558 100644
--- a/.github/workflows/emails.yml
+++ b/.github/workflows/emails.yml
@@ -6,5 +6,34 @@ jobs:
   bugzilla:
     runs-on: ubuntu-latest
     steps:
+
+    - uses: nrwl/last-successful-commit-action@v1
+      id: last_successful_commit
+      with:
+        branch: 'dev'
+        workflow_id: 'emails.yml'
+        github_token: ${{ secrets.GITHUB_TOKEN }}
+
+    - name: Checkout compare ref
+      uses: actions/checkout@v2
+      with:
+        ref: ${{ steps.last_successful_commit.outputs.commit_hash }}
+
     - name: Checkout code
       uses: actions/checkout@v2
+
+    - uses: actions/setup-python@v3
+      with:
+        python-version: '3.x'
+
+    - name: Get changed files
+      id: changed-files
+      uses: tj-actions/changed-files@v18.6
+      with:
+        base_sha: ${{ steps.last_successful_commit.outputs.commit_hash }}
+        files: |
+          **/metadata.xml
+
+    - name: Check Emails against bugzilla
+      run: |
+        python ./scripts/email-checker.py ${{ steps.changed-files.outputs.all_changed_files }}

diff --git a/scripts/email-checker.py b/scripts/email-checker.py
new file mode 100755
index 000000000..2b6e93a1d
--- /dev/null
+++ b/scripts/email-checker.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+
+from http.client import HTTPSConnection
+import json
+import sys
+from typing import Dict, Iterator, NamedTuple
+from urllib.parse import quote_plus
+import xml.etree.ElementTree as ET
+
+
+class Maintainer(NamedTuple):
+    name: str
+    email: str
+
+    def check_details(self, client: HTTPSConnection):
+        try:
+            client.request("GET", f"/rest/user?names={quote_plus(self.email)}")
+            resp = client.getresponse()
+            resp.read()
+            return resp.status == 200
+        except:
+            return False
+
+
+def read_all_maintainers(files: Iterator[str]) -> Iterator[Maintainer]:
+    for file in files:
+        try:
+            tree = ET.parse(file)
+            for maintainer in tree.findall('./maintainer'):
+                values = {child.tag: child.text for child in maintainer}
+                yield Maintainer(name=values.get('name', ''), email=values.get('email', ''))
+        except FileNotFoundError:
+            print(file, 'not found')
+
+
+def check_maintainers(maintainers: Iterator[Maintainer]) -> Iterator[Maintainer]:
+    try:
+        client = HTTPSConnection('bugs.gentoo.org')
+        for m in maintainers:
+            if m.check_details(client):
+                print(f'\033[92m\u2713 {m.name} <{m.email}>\033[0m')
+            else:
+                print(f'\033[91m\u2717 {m.name} <{m.email}>\033[0m')
+                yield m
+    finally:
+        client.close()
+
+
+if __name__ == '__main__':
+    missing_maintainers = len(tuple(check_maintainers(set(read_all_maintainers(sys.argv[1:])))))
+    sys.exit(int(missing_maintainers != 0))


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-06 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-06 19:43 [gentoo-commits] repo/proj/guru:master commit in: scripts/, .github/workflows/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2021-04-02  9:54 Andrew Ammerlaan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox