commit obs-service-download_files for openSUSE:11.3
Hello community, here is the log from the commit of package obs-service-download_files for openSUSE:11.3 checked in at Mon Jul 11 16:41:40 CEST 2011. -------- New Changes file: --- /dev/null 2010-08-26 16:28:41.000000000 +0200 +++ 11.3/obs-service-download_files/obs-service-download_files.changes 2011-07-05 13:51:52.000000000 +0200 @@ -0,0 +1,11 @@ +------------------------------------------------------------------- +Tue Jul 5 11:40:56 UTC 2011 - adrian@suse.de + +- Improve error reporting on illegal URLs +- fix "same file as committed" detection + +------------------------------------------------------------------- +Tue May 24 15:31:14 UTC 2011 - adrian@suse.de + +- initial package to download files accordings to urls in spec file Source: tags + calling whatdependson for 11.3-i586 New: ---- download_files download_files.service obs-service-download_files.changes obs-service-download_files.spec ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ obs-service-download_files.spec ++++++ # # spec file for package obs-service-download_files # # Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: obs-service-download_files License: GPL v2 or later Group: Development/Tools/Building Summary: An OBS source service: download files Version: 0.1 Release: 4.<RELEASE2> Source: download_files Source1: download_files.service Requires: wget diffutils Requires: build >= 2011.05.24 BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch %description This is a source service for openSUSE Build Service. This service is parsing all spec files and downloads all Source files which are specified via a http, https or ftp url. %prep %setup -q -D -T 0 -n . %build %install mkdir -p $RPM_BUILD_ROOT/usr/lib/obs/service install -m 0755 %{SOURCE0} $RPM_BUILD_ROOT/usr/lib/obs/service install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/usr/lib/obs/service %files %defattr(-,root,root) %dir /usr/lib/obs /usr/lib/obs/service %changelog ++++++ download_files ++++++ #!/bin/bash # downloads files specified in spec files DORECOMPRESS="" while test $# -gt 0; do case $1 in *-recompress) if [ "$2" == "yes" ]; then DORECOMPRESS="yes" fi shift ;; *-outdir) MYOUTDIR="$2" shift ;; *) echo Unknown parameter $1. echo 'this service is not accepting parameters currently' exit 1 ;; esac shift done if [ ! -d "$MYOUTDIR" ]; then echo "ERROR: output directory does not exist" exit 1 fi function uncompress_file() { local input=$1 local output=$2 UNCOMPRESS="cat" BASENAME="$input" if [ "${input%.gz}" != "$input" ]; then UNCOMPRESS="gunzip -c" BASENAME="${input%.gz}" elif [ "${input%.tgz}" != "$input" ]; then UNCOMPRESS="gunzip -c" BASENAME="${input%.tgz}.tar" elif [ "${input%.bz2}" != "$input" ]; then UNCOMPRESS="bunzip2 -c" BASENAME="${input%.bz2}" elif [ "${FILE%.xz}" != "$input" ]; then UNCOMPRESS="xz -dc" BASENAME="${input%.xz}" fi $UNCOMPRESS "$input" > "$output" echo $BASENAME } RETURN=0 for i in *.spec; do [ "$i" == "*.spec" ] && exit 0 for url in `perl -I/usr/lib/build -MBuild -e Build::show /usr/lib/build/configs/default.conf "$i" sources`; do PROTOCOL="${url%%:*}" if [ "$PROTOCOL" != "http" -a "$PROTOCOL" != "https" -a "$PROTOCOL" != "ftp" ]; then continue fi cd "$MYOUTDIR" if [ -z "$DORECOMPRESS" ]; then if ! /usr/bin/wget -4 --no-check-certificate -q "$url"; then echo "ERROR: Fail to download $url" exit 1 fi RECOMPRESS="" FILE="${url##*/}" else FORMAT="${url##*\.}" if /usr/bin/wget -4 --no-check-certificate -q "$url"; then RECOMPRESS="" FILE="${url}" elif /usr/bin/wget -4 --no-check-certificate -q "${url%$FORMAT}gz"; then RECOMPRESS="$FORMAT" FILE="${url%$FORMAT}gz" elif /usr/bin/wget -4 --no-check-certificate -q "${url%$FORMAT}bz2"; then RECOMPRESS="$FORMAT" FILE="${url%$FORMAT}bz2" elif /usr/bin/wget -4 --no-check-certificate -q "${url%$FORMAT}xz"; then RECOMPRESS="$FORMAT" FILE="${url%$FORMAT}xz" else echo "ERROR: Fail to download $url or any other compression format" exit 1 fi FILE="${FILE##*/}" fi # remove all file files which are indendical to committed files [ -f "$OLDPWD/$FILE" ] && cmp "$FILE" "$OLDPWD/$FILE" && rm "$FILE" if [ -n "$RECOMPRESS" ]; then tempfile=`mktemp` file_name=`uncompress_file "$FILE" "$tempfile"` # uncompress the old file also to compare tempoldfile=`mktemp` uncompress_file "$OLDPWD/${url##*/}" "$tempoldfile" > /dev/null # do not create new file, if identical if ! cmp "$tempfile" "$tempoldfile"; then if [ "$RECOMPRESS" == "gz" ]; then COMPRESS="gzip -c -" SUFFIX=".gz" elif [ "$RECOMPRESS" == "bz2" ]; then COMPRESS="bzip2 -c -" SUFFIX=".bz2" elif [ "$RECOMPRESS" == "xz" ]; then COMPRESS="xz -c -" SUFFIX=".xz" elif [ "$RECOMPRESS" == "none" ]; then COMPRESS="cat -" SUFFIX="" else echo "ERROR: Unknown compression $RECOMPRESS" RETURN=1 fi # do the compression cat "$tempfile" | $COMPRESS > "$file_name$SUFFIX" || RETURN=1 rm "$FILE" # remove downloaded file fi # cleanup rm -f "$tempfile" "$tempoldfile" fi cd - done done exit $RETURN ++++++ download_files.service ++++++ <service name="download_files"> <summary>Download files as specified in spec file</summary> <description>This service is parsing all spec files and downloads all Source files which are specified via a http, https or ftp url. Files which are identical to committed files get skipped. It can optionally also recompress the file if needed.</description> <parameter name="recompress"> <description>In case the right compression is not available on server, do recompress the file as needed.</description> <allowedvalue>yes</allowedvalue> </parameter> </service> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de