mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2026-08-26 22:23:12 -04:00
It is desirable to be able to discover the GitLab account handle
assocaited with a real name in the MAINTAINERS file.
Rather that duplicating the same account handle multiple times,
inline with the MAINTAINERS file entries, this introduces mapping
files:
* .gitlab-map-auto - data automatically queried from GitLab
using the 'glab' tool and REST API
* .gitlab-map-manual - manual overrides/augmentation for
cases where the MAINTAINERS real name does not match the
GitLab account real name
The former would need refreshing when we add new MAINTAINERS
entries, if the person had to be added as a GitLab account
member. For this purpose scripts/gitlab-map-update can be
used, assuming the user has the 'glab' client tool present
and configured with an access token.
To audit how many maintainers have GitLab handles present/missing
scripts/gitlab-map-check can run a report.
$ ./scripts/gitlab-map-check
Missing GitLab handle for maintainer 'Akihiko Odaki'
Missing GitLab handle for maintainer 'Albert Esteve'
....
Missing GitLab handle for maintainer 'Zhenzhong Duan'
Missing GitLab handle for maintainer 'Zhuoying Cai'
GitLab handles missing: 158 / present: 68
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
51 lines
1.3 KiB
Bash
Executable file
51 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
missing=0
|
|
present=0
|
|
|
|
grep -E '^(R|M):' MAINTAINERS | \
|
|
sed -E -e 's/^(M|R): //' -e 's/ <.*//' | \
|
|
sort | uniq > names.txt
|
|
while IFS= read -r NAME
|
|
do
|
|
grep "$NAME" .gitlab-map-{auto,manual} > /dev/null
|
|
if test $? != 0
|
|
then
|
|
echo "Missing GitLab handle for maintainer '$NAME'"
|
|
missing=$(($missing + 1))
|
|
else
|
|
present=$(($present + 1))
|
|
fi
|
|
done < names.txt
|
|
rm -f names.txt
|
|
|
|
echo "GitLab handles missing: $missing / present: $present"
|
|
|
|
# .gitlab-map-manual is to provide alternate real names
|
|
# for cases where name in MAINTAINERS does not match
|
|
# the GitLab account real name. As such...
|
|
|
|
# ...all gitlab handles in .gitlab-map-manual must also exist
|
|
# in .gitlab-map-auto and ....
|
|
for HANDLE in $(grep -v '^#' .gitlab-map-manual | awk '{print $1}')
|
|
do
|
|
grep -E "^$HANDLE\s" .gitlab-map-auto >/dev/null
|
|
if test $? != 0
|
|
then
|
|
echo "Unexpected GitLab handle '$HANDLE' is not a member"
|
|
fi
|
|
done
|
|
|
|
# ...and all realnames in .gitlab-map-manual must also
|
|
# exist in MAINTAINERS
|
|
grep -v '^#' .gitlab-map-manual | \
|
|
awk '{ $1 = ""; print substr($0, 2) }' | \
|
|
while IFS= read -r NAME
|
|
do
|
|
grep -E "\s$NAME\s" MAINTAINERS >/dev/null
|
|
if test $? != 0
|
|
then
|
|
echo "Unexpected real name '$NAME' is not a maintainer"
|
|
fi
|
|
done
|