Little Helpers

Little Helpers for the packager

xvalidate

I use the following script to check the (xlint) validity of a package template and also scan for redundant entries (xmindep) in makedepends:

#!/bin/bash -e
# Validate a srcpkg with xlint and xmindep
XBPS_SRCPKGDIR="$(pwd)/srcpkgs"
pkg="$1"
if [ -z "$pkg" ]; then
        echo "Usage: $0 <pkg>"
        exit 1
fi
template="srcpkgs/$pkg/template"
if [ ! -f "$template" ]; then
        echo "Template $template not found"
        exit 1
fi

vopt_if() {
        echo "$2"
}

vopt_enable() {
        echo "--enable-$2"
}

echo "Running 'xlint $template'"
xlint $template
if [ "$?" -ne "0" ]; then
        exit $?
fi
echo "xlint : OK"
source $template
if [ -z "$makedepends" ]; then
        echo "No makedepends in $template"
else
        echo "Minimum dependencies for '$makedepends'"
        mindep="$(xmindep $makedepends)"
        for dep in $makedepends; do
                if [[ "$mindep" == *$dep* ]]; then
                        echo "$dep: OK"
                else
                        echo "$dep: remove"
                fi
        done
fi

Put the script in $HOME/bin, if this is in your search path. To check your-package then run ``` xvalidate your-package ```

This article is issued from Voidlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.