@ -0,0 +1 @@ |
|||||
|
versionsort |
@ -0,0 +1,41 @@ |
|||||
|
#!/bin/sh |
||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: bin/sde-check |
||||
|
# Copyright (C) 2007 - 2009 The OpenSDE Project |
||||
|
# |
||||
|
# More information can be found in the files COPYING and README. |
||||
|
# |
||||
|
# This program is free software; you can redistribute it and/or modify |
||||
|
# it under the terms of the GNU General Public License as published by |
||||
|
# the Free Software Foundation; version 2 of the License. A copy of the |
||||
|
# GNU General Public License can be found in the file COPYING. |
||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
#Description: Check stuff |
||||
|
|
||||
|
[ -n "$SDEROOT" ] || |
||||
|
export SDEROOT=$(cd "${0%/*}/.."; pwd -P) |
||||
|
|
||||
|
. "$SDEROOT/lib/libsde.in" |
||||
|
. "$SDEROOT/lib/sde-wrapper-discriminator.in" |
||||
|
|
||||
|
command='check' |
||||
|
|
||||
|
if [ $# -eq 0 -o "$1" = "--help" ]; then |
||||
|
sde_wrapper_discriminator_help "$command" |
||||
|
exit 1 |
||||
|
else |
||||
|
discriminator=$(sde_wrapper_discriminator "$command" "$1") |
||||
|
if [ -z "$discriminator" ]; then |
||||
|
# no default discriminator |
||||
|
echo_error "$command: $1: Invalid discriminator." |
||||
|
sde_wrapper_discriminator_help "$command" |
||||
|
exit 1 |
||||
|
else |
||||
|
shift; |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
exec "$SDEROOT/bin/sde-$command-$discriminator" "$@" |
@ -0,0 +1,156 @@ |
|||||
|
#!/bin/bash |
||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# |
||||
|
# Filename: bin/sde-check-package |
||||
|
# Copyright (C) 2009 The OpenSDE Project |
||||
|
# |
||||
|
# More information can be found in the files COPYING and README. |
||||
|
# |
||||
|
# This program is free software; you can redistribute it and/or modify |
||||
|
# it under the terms of the GNU General Public License as published by |
||||
|
# the Free Software Foundation; version 2 of the License. A copy of the |
||||
|
# GNU General Public License can be found in the file COPYING. |
||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
#Description: Checks for possible updates of a list of packages |
||||
|
#Alias: pkg |
||||
|
|
||||
|
[ -n "$SDEROOT" ] || |
||||
|
export SDEROOT=$( cd "${0%/*}/.."; pwd -P ) |
||||
|
|
||||
|
. "$SDEROOT/lib/libsde.in" |
||||
|
. "$SDEROOT/lib/sde-package.in" |
||||
|
|
||||
|
cachedir="$SDEROOT/tmp/checkver" |
||||
|
|
||||
|
check_usage() { |
||||
|
local progname=$(echo ${0##*/} | tr '-' ' ') |
||||
|
|
||||
|
[ $# -eq 0 ] || echo_error "$@" |
||||
|
cat <<-EOT |
||||
|
Usage: $progname <pkg>* |
||||
|
EOT |
||||
|
|
||||
|
exit 1 |
||||
|
} |
||||
|
|
||||
|
# parse arguments |
||||
|
shortopts='?' |
||||
|
longopts='help' |
||||
|
options=$(getopt -o "$shortopts" -l "$longopts" -- "$@") |
||||
|
[ $? -eq 0 ] || check_usage |
||||
|
|
||||
|
eval set -- "$options" |
||||
|
|
||||
|
while [ $# -gt 0 ]; do |
||||
|
case "$1" in |
||||
|
--help) |
||||
|
check_usage |
||||
|
;; |
||||
|
--) |
||||
|
shift; break |
||||
|
;; |
||||
|
-*) |
||||
|
check_usage "$1: Not implemented" |
||||
|
;; |
||||
|
*) |
||||
|
break |
||||
|
esac |
||||
|
shift |
||||
|
done |
||||
|
|
||||
|
# extract packages list |
||||
|
# |
||||
|
pkgs= |
||||
|
while [ $# -gt 0 ]; do |
||||
|
x=$(package_parse "$1" | tr '\n' ' ') |
||||
|
if [ -n "$x" ]; then |
||||
|
pkgs="$pkgs $x" |
||||
|
else |
||||
|
check_usage "$1: Invalid package" |
||||
|
fi |
||||
|
shift |
||||
|
done |
||||
|
|
||||
|
[ -n "$pkgs" ] || check_usage |
||||
|
|
||||
|
check_package_update() { |
||||
|
local pkg="$1" ver="$2" file="$3" dump="$4" |
||||
|
local prefix= suffix= x= |
||||
|
|
||||
|
# case 1, version is obvious part of the name |
||||
|
prefix="${file%$ver*}" |
||||
|
if [ "$prefix" != "$file" ]; then |
||||
|
suffix="${file#$prefix$ver}" |
||||
|
# I feel lucky |
||||
|
matches=$(grep "^${prefix}.*${suffix//\./\\.}$" "$dump" | sort -u) |
||||
|
for x in $matches; do |
||||
|
y=$(echo "$x" | sed -e "s,^$prefix\(.*\)$suffix\$,\1,") |
||||
|
echo "$y" |
||||
|
done |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
check_package() { |
||||
|
local repo="${1%/*}" pkg="${1#*/}" |
||||
|
local desc="$SDEROOT/package/$repo/$pkg/$pkg.desc" |
||||
|
|
||||
|
local cvurl=$(package_desc_extract "$desc" CV-URL) |
||||
|
local ver=$(package_desc_extract "$desc" V) |
||||
|
|
||||
|
local x= y= file= url= dump= found= |
||||
|
|
||||
|
|
||||
|
while read x file url; do |
||||
|
case "$url" in |
||||
|
-!*|!*) |
||||
|
file="${url##*/}" |
||||
|
url=$(echo "$url" | sed -e 's,^-\?!,,' -e 's,/[^/]*$,/,') |
||||
|
;; |
||||
|
-*) |
||||
|
url="${url#-}" |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
[ -z "$cvurl" ] || url="$cvurl" |
||||
|
|
||||
|
x="${url%%:*}" |
||||
|
case "$x" in |
||||
|
http|https|ftp) |
||||
|
dump=$(echo "$url.out" | tr '?&:/ ' '_____') |
||||
|
dump="$cachedir/$dump" |
||||
|
lock "$dump" |
||||
|
[ -e "$dump" ] || |
||||
|
"$SDEROOT/lib/sde-download/get-tokenized.sh" "$url" > "$dump" 2> "$dump.stderr" |
||||
|
unlock "$dump" |
||||
|
|
||||
|
found=$(check_package_update "$pkg" "$ver" "$file" "$dump") |
||||
|
if [ -n "$found" ]; then |
||||
|
found=$("$versionsort" $found $ver | sort -u | tac | sed -e "s|^${ver//./\.}\$|*$ver*|" | tr '\n' ' ') |
||||
|
echo "$pkg: $ver ($url) $found" |
||||
|
else |
||||
|
echo_error "$pkg: nothing found. ($url)" |
||||
|
fi |
||||
|
;; |
||||
|
*) |
||||
|
echo_error "$pkg: $x not supported." |
||||
|
continue |
||||
|
;; |
||||
|
esac |
||||
|
done < <(package_desc_extract "$desc" D) |
||||
|
} |
||||
|
|
||||
|
mkdir -p "$cachedir" |
||||
|
|
||||
|
# compile vsersionsort is missing |
||||
|
# |
||||
|
versionsort="$SDEROOT/bin/versionsort" |
||||
|
if [ ! -x "$versionsort" ]; then |
||||
|
gcc -o "$versionsort" -Os -W -Wall "$SDEROOT/src/tools-source/versionsort.c" || exit $? |
||||
|
fi |
||||
|
|
||||
|
for x in $pkgs; do |
||||
|
check_package "$x" & |
||||
|
done < /dev/null |
||||
|
wait |