[PATCH] Downloads build logs only if exist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Makes the script a bit more fail safe by only downloading
the build logs if they exist. It also keeps all the logs in
one place.

Signed-off-by: Miguel Flores Silverio <floresmigu3l@xxxxxxxxx>
---
 scripts/grab-logs.sh | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/scripts/grab-logs.sh b/scripts/grab-logs.sh
index 5df5735..0d498de 100755
--- a/scripts/grab-logs.sh
+++ b/scripts/grab-logs.sh
@@ -1,16 +1,34 @@
 #!/bin/sh
+# This a small script that helps download the build logs for current source tree
+# by default it will stores the downloaded logs in the logs/ directory. if the
+# you do not have a logs/ directory the script will create one.
+
+# Run the script from anywhere in your system as long as
+# script resides in scripts/ directory it should work.
+BASEDIR=$(dirname "$(cd $(dirname $BASH_SOURCE[0]) && pwd)")
+pushd $BASEDIR
 
 VER=$(fedpkg verrel)
 ver=$(echo $VER | sed -e 's/-/ /g' | awk '{print $2}')
 rev=$(echo $VER | sed -e 's/-/ /g' | awk '{print $3}')
 
-if [ -d logs ]; then
-  DIR=logs/
-else
-  DIR=./
+# keep things a bit more organized by putting all logs in one directory
+if [ ! -d logs ]; then
+    mkdir $BASEDIR/logs
+    DIR=$BASEDIR/logs
 fi
 
-wget -O $DIR/build-$VER-i686.log http://kojipkgs.fedoraproject.org/packages/kernel/$ver/$rev/data/logs/i686/build.log
-wget -O $DIR/build-$VER-x86-64.log http://kojipkgs.fedoraproject.org/packages/kernel/$ver/$rev/data/logs/x86_64/build.log
-wget -O $DIR/build-$VER-noarch.log http://kojipkgs.fedoraproject.org/packages/kernel/$ver/$rev/data/logs/noarch/build.log
+# This are the most common architectures that have build logs
+ARCHS[0]=i686
+ARCHS[1]=x86_64
+ARCHS[2]=noarch
+ARCHS[3]=armv7hl
 
+# Only download if logs exist
+for arch in $ARCHS; do
+    URL=http://kojipkgs.fedoraproject.org/packages/kernel/$ver/$rev/data/logs/$arch/build.log
+    wget --spider -q $URL
+    if [ $? -eq 0 ]; then
+	wget -N -O $DIR/build-$VER-$arch.log $URL
+    fi
+done
--
2.7.4
_______________________________________________
kernel mailing list
kernel@xxxxxxxxxxxxxxxxxxxxxxx
https://lists.fedoraproject.org/admin/lists/kernel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux