Skip to content

Commit c5333a4

Browse files
committed
Generalize check-ensurepip into check-mismatched-packages
Signed-off-by: Michał Górny <[email protected]>
1 parent c3e931e commit c5333a4

File tree

3 files changed

+46
-34
lines changed

3 files changed

+46
-34
lines changed

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ to dev.gentoo.org. Typical usage::
115115
# tag archive-name upstream dgo-subdir
116116
mkpatchset gentoo-3.9.8 python-gentoo-patches-3.9.8 v3.9.8 python/
117117

118-
check-ensurepip
119-
---------------
118+
check-mismatched-packages
119+
-------------------------
120120
Dependencies: git, pkgcore
121121

122-
Check whether ``dev-python/ensurepip-*`` packages are up-to-date.
122+
Check whether packages that should be bumped in sync are up-to-date.
123123
Useful for a pre-push hook.
124124

125125

check-ensurepip

Lines changed: 0 additions & 31 deletions
This file was deleted.

check-mismatched-packages

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
# check whether packages that should be kept in sync are up-to-date
3+
4+
REPO=$(git rev-parse --show-toplevel)
5+
PKGS=(
6+
dev-python/ensurepip-pip:0=dev-python/pip:0
7+
dev-python/ensurepip-setuptools:0=dev-python/setuptools:0
8+
dev-python/python-docs:2.7=dev-lang/python:2.7
9+
dev-python/python-docs:3.8=dev-lang/python:3.8
10+
dev-python/python-docs:3.9=dev-lang/python:3.9
11+
dev-python/python-docs:3.10=dev-lang/python:3.10
12+
dev-python/python-docs:3.11=dev-lang/python:3.11
13+
)
14+
15+
declare -A VERSIONS
16+
while read -r PKG; do
17+
SLOT=${PKG#*:}
18+
PKG=${PKG%:*}
19+
PKG=${PKG%-r[0-9]*}
20+
NAME=${PKG%-*}
21+
VERSION=${PKG##*-}
22+
VERSION=${VERSION%_p*}
23+
VERSIONS[${NAME}:${SLOT}]=${VERSION}
24+
done < <(
25+
pquery -q -r "${REPO}" --slot "${PKGS[@]%=*}" "${PKGS[@]#*=}"
26+
)
27+
28+
RET=0
29+
for PKG in "${PKGS[@]}"; do
30+
A=${PKG%=*}
31+
B=${PKG#*=}
32+
AV="${VERSIONS[${A}]}"
33+
BV="${VERSIONS[${B}]}"
34+
35+
if [[ ${AV} != ${BV} ]]; then
36+
echo "Package version mismatch found!" >&2
37+
echo " ${A}: ${AV}" >&2
38+
echo " ${B}: ${BV}" >&2
39+
RET=1
40+
fi
41+
done
42+
43+
exit "${RET}"

0 commit comments

Comments
 (0)