forked from openSUSE/obs-service-source_validator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path45-stale-changes
More file actions
executable file
·65 lines (57 loc) · 1.92 KB
/
Copy path45-stale-changes
File metadata and controls
executable file
·65 lines (57 loc) · 1.92 KB
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
#!/bin/bash
test "$1" = "--verbose" && { VERBOSE=true ; shift ; }
test "$1" = "--batchmode" && { BATCHMODE=true ; shift ; }
DIR_TO_CHECK="$1"
DESTINATIONDIR="$2"
test -n "$DIR_TO_CHECK" || DIR_TO_CHECK=`pwd`
HELPERS_DIR="/usr/lib/obs/service/source_validators/helpers"
$HELPERS_DIR/check_input_filename "$DIR_TO_CHECK" || exit 1
. $HELPERS_DIR/functions
test -z "$DESTINATIONDIR" -a -d "$DIR_TO_CHECK/.osc" && DESTINATIONDIR="$DIR_TO_CHECK/.osc"
RETURN=0
test "$VERBOSE" = true && echo -n "- checking for stale or missing changes "
test -f "$DIR_TO_CHECK/_service" && grep -E -q 'name=.product_converter' "$DIR_TO_CHECK/_service" && {
test "$VERBOSE" = true && echo skipped for product
exit 0
}
print_specs () {
while read recipe flavor; do
$HELPERS_DIR/spec_query --specfile "${DIR_TO_CHECK}/${recipe}" --print-subpacks --buildflavor "$flavor" | sed -e "s@ .*@@"
done < <(spec_build_flavors "$DIR_TO_CHECK")
}
SPECLIST=`print_specs | sort -u`
DO_PASS=""
test -n "$SPECLIST" && {
for i in $SPECLIST ; do
case $i in
*-) i=${i}MACRO ; DO_PASS="1" ;;
-*) i=${i#-} ;; # multi-flavour with empty default
esac
test -f "$DIR_TO_CHECK/$i.changes" && DO_PASS=1
done
test "$DO_PASS" = "1" || {
echo "WARNING: No .changes file found. This package can not be submitted to openSUSE product projects."
exit 0
}
# check for stale .changes files
for i in "$DIR_TO_CHECK"/*.changes ; do
test -f "$i" || continue
N=`basename "$i" .changes`
OKAY=0
for pack in $SPECLIST ; do
test "$pack" = "$N" && OKAY=1
case $pack in
*-) test "${pack}MACRO" = "$N" && OKAY=1 ;;
-*) test "${pack#-}" = "$N" && OKAY=1 ;;
esac
done
if test $OKAY = 0 ; then
if ! grep -q "^Source[0-9]*:.*$N.changes" "$DIR_TO_CHECK"/*.spec ; then
echo "ERROR: $(basename $i) not a subpackage, please remove"
RETURN=1
fi
fi
done
}
test "$VERBOSE" = true && echo done
exit $RETURN