:: [devuan-dev] devscripts-devuan
Etusivu
Poista viesti
Vastaa
Lähettäjä: Mark Hindley
Päiväys:  
Vastaanottaja: devuan-dev
Aihe: [devuan-dev] devscripts-devuan
Hi,

I am starting a src:devscripts-devuan package. My idea is to add Devuan-specific
scripts that might be useful for package maintainers, extending those already in
src:devscripts.

Attached is an alpha version of devuan-src-needs-update and it's manpage. I
would be grateful for testing and comments.

Notes:-

- it requires the jq package

- it probably needs a better name: devuan-check-src-version,
devuan-chksrcversion?

- is the output clear enough/easy enough to parse? Any improvements?

Another script to handle source merges is also in preparation and coming soon.

Thanks.

Mark
#!/bin/sh

set -e

DEVUAN_DAK_API_URL=https://api.pkginfo.devuan.org

devuan_suites()
{
    curl -fs $DEVUAN_DAK_API_URL/suites | \
    jq -r '.[] | select(.codename) |.codename' | \
    sort -u | grep -v -- -
}


debian_equivalent()
{
    s=$1
    valid=$2
    case $s in
    ceres|unstable)
        echo sid
        ;;
    experimental|*stable|testing)
        echo $s
        ;;
    *)
        if echo "$valid" | grep --quiet --fixed-strings --line-regexp $s
        then
        debian_jessie=8
        if [ "$s" = 'jessie' ]
        then
            debian_v=$debian_jessie
        else
            ascii_a=97
            debian_v=$(($(printf "%d" "'$s") - $ascii_a + $debian_jessie + 1))
        fi
        if [ -z "$include_archived" ]
        then
            debian_eol=$(awk -F, "\$1==\"$debian_v\" { print \$6 }" /usr/share/distro-info/debian.csv)
            [ -n "${debian_eol}" -a \
             $(date -d "${debian_eol}" +%s) -lt $(date +%s) ] && return
        fi
        awk -F, "\$1==\"$debian_v\" { print \$3 }" /usr/share/distro-info/debian.csv
        else
        echo 'WARNING: unknown suite ' $s >&2
        fi
        ;;
    esac
}


get_versions()
{
    s=$1
    u=$2
    rmadison -u $u -a source $s | awk -F\| '{print $3 $2}'
}


# parse command line
while getopts a opt
do
    case $opt in
    a) include_archived=$opt;;
    \?) echo "$0 [ -a ] [ source... ]"; exit 1;;
    esac
done


shift $(($OPTIND - 1))

sources=${@:-$(dpkg-parsechangelog -S Source)}

for src in $sources
do
    devuan=$(get_versions $src $DEVUAN_DAK_API_URL/madison)
    [ -z "$devuan" ] && \
    echo WARNING: no Devuan versions found for src:$src >&2 && \
    continue
    debian=$(get_versions $src udd ) # Use Ultimate Debian Database
    [ -z "$debian" ] && \
    echo WARNING: no Debian versions found for src:$src >&2 && \
    continue


    for s in $(echo "$devuan" | awk '$1 !~ /-/ {print $1}') # Parent suites
    do
    : "${valid_suites:=$(devuan_suites)}"
    bi_s=$(debian_equivalent "$s" "$valid_suites")
    [ -z "$bi_s" ] && continue


    for chld in '' '-proposed-updates' '-security' '-backports'
    do
        vu_v=$(echo "$devuan" | awk "\$1==\"$s$chld\" {print \$2}" | head -1)
        [ "$chld" = '-proposed-updates' ] && chld='-p-u' # UDD uses different name!
        bi_v=$(echo "$debian" | awk "\$1==\"$bi_s$chld\" {print \$2}" | head -1)
        [ -z "$bi_v" ] && continue


        dpkg --compare-versions "$vu_v" gt "$bi_v" || \
        echo "src:$src $bi_s$chld/$bi_v > $s$chld/${vu_v:-(None)}"
    done
    done
done

.TH "DEVUAN\-SRC\-NEEDS\-UPDATE" "1"
.SH NAME
.PP
devuan\-src\-needs\-update \- Check Devuan source versions against Debian

.SH SYNOPSIS
.PP
\fBdevuan\-src\-needs\-update\fP [\fIoption\fP] [\fIsrcpackage...\fP]

.SH OPTIONS
.PP
\fB-a\fP    Also check end-of-life (EOL) archived suites.


.SH DESCRIPTION
.PP
The command checks the specified Devuan source package(s) against Debian and
reports the suites where the Devuan source is out of date.
.PP
If a Devuan version exists in one of the main parent suites, the relevant
\fI\-security\fP, \fI\-proposed\-updates\fP and \fI\-backports\fP suites are
also checked.
.PP
If no source packages are specified on the command line and
\fBdevuan\-src\-needs\-update\fP is invoked from within a source tree,
\fBdpkg-parsechangelog\fP(1) is used to determine the source package to check.

.SH SEE ALSO
.PP
\fBdevscripts\fP(1), \fBrmadison\fP(1)

.SH AUTHORS
.PP
Written by Mark Hindley <mark@???>.