1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
#!/bin/bash
# Copyright 2012-2014 Holger Levsen <holger@layer-acht.org>
# multiarch_versionskew UDD query by Stuart Prescott <stuart@debian.org>
# orphaned_without_o_bug by Johannes Schauer <j.schauer@email.de>
# released under the GPLv=2
DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
udd_query() {
#
# Actually query UDD and save result in $UDD file
#
echo "$(date) - querying UDD using ${SQL_QUERY}"
echo
PGPASSWORD=public-udd-mirror \
psql -U public-udd-mirror \
-h public-udd-mirror.xvm.mit.edu -p 5432 \
-t \
udd -c"${SQL_QUERY}" > $UDD
}
list_tables() {
SQL_QUERY="SELECT table_schema,table_name
FROM information_schema.tables
ORDER BY table_schema,table_name;"
udd_query
echo
for TABLE in $(cat $UDD | cut -d "|" -f2) ; do
SQL_QUERY="SELECT column_name, data_type, character_maximum_length
FROM INFORMATION_SCHEMA.COLUMNS where table_name = '$TABLE';"
udd_query
cat $UDD
echo
done
rm $UDD
}
multiarch_versionskew() {
if [ -z "$1" ] ; then
echo "Warning: no distro supplied, assuming sid."
DISTR=sid
else
DISTRO=$1
fi
#
# SQL query for detecting multi-arch version skew
#
SQL_QUERY="SELECT DISTINCT source FROM
(SELECT DISTINCT source, package, version
FROM packages WHERE
release='$DISTRO' AND
multi_arch='same' AND
architecture IN ('amd64', 'arm64', 'armel', 'armhf', 'i386',
'kfreebsd-amd64', 'kfreebsd-i386', 'mips', 'mipsel',
'powerpc', 'ppc64el', 's390x')
ORDER BY source) AS all_versions
GROUP BY source, package
HAVING count(*) > 1
ORDER BY source ;"
udd_query
if [ -s $UDD ] ; then
echo "Warning: multi-arch version skew in $DISTRO detected."
echo
# TODO: turn source package names into links
# TODO: show versions (per arch) too
cat $UDD
fi
rm $UDD
}
orphaned_without_o_bug() {
WNPPRM=$(mktemp)
SORTED_UDD=$(mktemp)
RES1=$(mktemp)
SQL_QUERY="SELECT DISTINCT source
FROM sources
WHERE maintainer LIKE '%packages@qa.debian.org%'
AND release='sid'
ORDER BY source ; "
udd_query
cat $UDD | tr -d ' ' | sort | uniq > "$SORTED_UDD"
curl --silent https://qa.debian.org/data/bts/wnpp_rm \
| cut -d ' ' -f 1 | tr -d ':' | sort | uniq > "$WNPPRM"
comm -23 "$SORTED_UDD" "$WNPPRM" > "$RES1"
# $RES1 now contains all packages that have packages@qa.debian.org as the
# maintainer but do not appear on https://qa.debian.org/data/bts/wnpp_rm
# (because they are missing a bug)
# we have to remove all the packages that appear in experimental but do not
# have packages@qa.debian.org as a maintainer (i.e: they found a new one)
SQL_QUERY="SELECT DISTINCT source
FROM sources
WHERE maintainer NOT LIKE '%packages@qa.debian.org%'
AND release='experimental'
ORDER BY source ; "
udd_query
if [ -s $UDD ] ; then
cat $UDD | tr -d ' ' | sort | uniq > "$SORTED_UDD"
echo "Warning: The following packages are maintained by packages@qa.debian.org"
echo "but are missing a wnpp bug according to https://qa.debian.org/data/bts/wnpp_rm"
echo
# TODO: turn source package names into links
comm -13 "$SORTED_UDD" "$RES1"
fi
rm -f "$UDD" "$WNPPRM" "$RES1" "$SORTED_UDD"
}
#
# main
#
UDD=$(mktemp)
case $1 in
list_tables)
list_tables
;;
orphaned_without_o_bug)
orphaned_without_o_bug
;;
multiarch_versionskew)
multiarch_versionskew $2
;;
*)
echo "unknown query requested, exiting... please provide patches :)"
;;
esac
echo
|