Merge pull request #3881 from Gottox/consistencycheck
xbps-src: add consistency check
This commit is contained in:
commit
bc0d4b897d
|
@ -10,7 +10,8 @@ env:
|
|||
- PATH=$PATH:$HOME/bin
|
||||
|
||||
matrix:
|
||||
- XLINT=1
|
||||
- ACTION=xlint
|
||||
- ACTION=consistency-check
|
||||
- ARCH=x86_64 BOOTSTRAP=x86_64
|
||||
- ARCH=i686 BOOTSTRAP=i686
|
||||
- ARCH=armv6hf BOOTSTRAP=x86_64
|
||||
|
@ -24,6 +25,7 @@ before_script:
|
|||
- common/travis/fetch_upstream.sh
|
||||
- common/travis/changed_templates.sh
|
||||
- common/travis/xlint.sh
|
||||
- common/travis/consistency_check.sh
|
||||
- common/travis/bootstrap.sh $BOOTSTRAP
|
||||
|
||||
script:
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
#
|
||||
# bootstrap.sh
|
||||
|
||||
[ "$XLINT" ] && exit 0
|
||||
[ "$ACTION" ] && exit 0
|
||||
|
||||
./xbps-src -H $HOME/hostdir binary-bootstrap $1
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# build.sh
|
||||
|
||||
[ "$XLINT" ] && exit 0
|
||||
[ "$ACTION" ] && exit 0
|
||||
|
||||
if [ "$1" != "$2" ]; then
|
||||
arch="-a $2"
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# consistency_check.sh
|
||||
|
||||
[ "$ACTION" = "consistency-check" ] || exit 0
|
||||
|
||||
./xbps-src consistency-check
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# show_files.sh
|
||||
|
||||
[ "$XLINT" ] && exit 0
|
||||
[ "$ACTION" ] && exit 0
|
||||
|
||||
if [ "$1" != "$2" ]; then
|
||||
arch="-a $2"
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
#
|
||||
# xlint.sh
|
||||
|
||||
[ "$XLINT" ] || exit 0
|
||||
[ "$ACTION" = "xlint" ] || exit 0
|
||||
|
||||
awk '{ print "srcpkgs/" $0 "/template" }' /tmp/templates | xargs xlint
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
# vim: set ts=4 sw=4 et:
|
||||
|
||||
consistency_check_existing () {
|
||||
while IFS=" " read -r dep origname deplabel; do
|
||||
[ -f "$XBPS_SRCPKGDIR/$dep/template" ] && continue
|
||||
case "$deplabel" in
|
||||
makedepends|hostmakedepends)
|
||||
msg_warn "unsatisfied $deplabel in $origname: $dep does not exist\n";
|
||||
;;
|
||||
*) printf "%s %s %s\n" "$dep" "$origname" "$deplabel" ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
consistency_convert_pkgname () {
|
||||
local origname= pkgname version= revision=
|
||||
while IFS=" " read -r dep origname deplabel; do
|
||||
case "$deplabel" in
|
||||
makedepends|hostmakedepends)
|
||||
printf "%s %s %s\n" "$dep" "$origname" "$deplabel"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
case "$dep" in
|
||||
*\<*|*\>*|*=*)
|
||||
printf "%s %s %s\n" "$dep" "$origname" "$deplabel"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
if pkgname=$(xbps-uhelper getpkgname "$dep" 2> /dev/null) && \
|
||||
version=$(xbps-uhelper getpkgversion "$dep" 2> /dev/null) && \
|
||||
revision=$(xbps-uhelper getpkgrevision "$dep" 2> /dev/null); then
|
||||
printf "%s %s %s\n" "${pkgname}>=${version}_${revision}" "$origname" "$deplabel"
|
||||
else
|
||||
printf "%s %s %s\n" "$dep>=0" "$origname" "$deplabel"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
consistency_check_smart () {
|
||||
local pkgname= depdef= dep=
|
||||
while IFS=" " read -r depdef origname deplabel; do
|
||||
case "$deplabel" in
|
||||
makedepends|hostmakedepends)
|
||||
printf "%s %s %s\n" "$depdef" "$origname" "$deplabel"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
dep=$(xbps-uhelper getpkgdepname "$depdef")
|
||||
|
||||
if [ ! -f "$XBPS_SRCPKGDIR/$dep/template" ]; then
|
||||
msg_warn "unsatisfied $deplabel in $origname: $dep does not exist\n";
|
||||
continue
|
||||
fi
|
||||
(
|
||||
XBPS_TARGET_PKG=$dep
|
||||
read_pkg
|
||||
xbps-uhelper pkgmatch "$depdef" "${pkgname}-${version}_${revision}" && continue
|
||||
msg_red "unsatisfied $deplabel in $origname: $dep is $version, but required is $depdef\n";
|
||||
)
|
||||
done
|
||||
}
|
||||
|
||||
consistency_check() {
|
||||
local pkg= pkgname=
|
||||
for pkg in "$XBPS_SRCPKGDIR"/*/template; do
|
||||
XBPS_TARGET_PKG=$(basename $(dirname $pkg))
|
||||
(
|
||||
read_pkg
|
||||
[ "$depends" ] && printf "%s $pkgname depends\n" $depends
|
||||
[ "$conflicts" ] && printf "%s $pkgname conflicts\n" $conflicts
|
||||
[ -L "$XBPS_SRCPKGDIR/$XBPS_TARGET_PKG" ] && continue
|
||||
[ "$makedepends" ] && printf "%s $pkgname makedepends\n" $makedepends
|
||||
[ "$hostmakedepends" ] && printf "%s $pkgname hostmakedepends\n" $hostmakedepends
|
||||
)
|
||||
done | grep -v "^virtual?" | sed "s/^[^ ]*?//" | consistency_check_existing | \
|
||||
consistency_convert_pkgname | consistency_check_smart
|
||||
}
|
6
xbps-src
6
xbps-src
|
@ -30,6 +30,9 @@ bootstrap-update
|
|||
build <pkgname>
|
||||
Build package source (fetch + extract + configure + build).
|
||||
|
||||
consistency-check
|
||||
Runs a consistency check on all packages
|
||||
|
||||
chroot
|
||||
Enter to the chroot in <masterdir>.
|
||||
|
||||
|
@ -677,6 +680,9 @@ case "$XBPS_TARGET" in
|
|||
remove_pkg $XBPS_CROSS_BUILD
|
||||
fi
|
||||
;;
|
||||
consistency-check)
|
||||
consistency_check
|
||||
;;
|
||||
remove-autodeps)
|
||||
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
||||
chroot_handler remove-autodeps
|
||||
|
|
Loading…
Reference in New Issue