Created by
Atri Bhattacharya
last modified
| #!/usr/bin/env bash
prj="$1"
pkg=`echo $2 | awk ' BEGIN { FS=":"; } { print $1; }'`
msg() {
src_status="$1"
printf "%-25s %s\n" ${pkg} "${src_status}"
}
check_service() {
osc ls ${prj} ${pkg} | grep -E "^_service" > /dev/null
# TODO
# Check if service file actually downloads source using obs_scm/tar_scm or
# download_files
}
check_source_url() {
local ext="(tgz|zip|7z|gz|bz2|lz|xz)"
# Get URL since some SourceN may be specified as %{url}/...
url=`osc cat ${prj} ${pkg}{,.spec} | grep -E "^URL:" | awk '{ print $2; }'`
sources=`osc cat ${prj} ${pkg}{,.spec} | grep -E "^Source[0-9]*:\s*.*(\.tar)?\.${ext}$" | awk '{ print $2; }'`
sources_exp_url=`echo ${sources} | sed -E "s@^%\{?(url|URL)\}?@${url}@g"`
for src in ${sources_exp_url}
do
echo ${src} | grep -E "^(ht|f)tps?://" > /dev/null || return 1
done
}
if check_service
then
msg "Service source"
else
check_source_url && msg "Valid URL source" || { tput setaf 1; msg "Local source"; tput sgr0; }
fi
|