Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: Bash  |  size: 3.77 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. #    This file is part of vlbuildbot.
  4. #
  5. #    vlbuildbot is free software: you can redistribute it and/or modify
  6. #    it under the terms of the GNU General Public License v3 as published by
  7. #    the Free Software Foundation.
  8. #
  9. #    vlbuildbot is distributed in the hope that it will be useful,
  10. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. #    GNU General Public License for more details.
  13. #
  14. #    See http://www.gnu.org/licenses/ for complete licensing terms.
  15.  
  16.  
  17. SB=$(basename $1)
  18. SBPATH=$1
  19. APP=$(basename $SB .SlackBuild)
  20. #SBREPO=/var/vabs/
  21. SBREPO=/home/vluser/devel/slackbuilds/var/vabs/
  22. #DEPS=$(grep ^MAKEDEPENDS $1|cut -d'"' -f2) || exit 1
  23.  
  24. function read_sb_deps {
  25.         sb=$1
  26.         deps=$(grep ^MAKEDEPENDS $sb | cut -d '"' -f2) || return 1
  27.         echo $deps
  28. }
  29.  
  30. function find_deps_of_deps {
  31.         # exit if nothing in $DEPS
  32.         if [ -z $DEPS ]; then
  33.                 return 0
  34.         fi
  35.         echo "DEPS=$DEPS"
  36.         for dep in $DEPS; do
  37.                 if [ -d $SBREPO/$dep ]; then
  38.                         echo "Found source directory for $dep "
  39.                 else
  40.                         echo "Cannot find source directory for $dep "
  41.                 fi
  42.         done
  43.        
  44. }
  45.  
  46. function refresh_online_repo_data {
  47.         # exit on failure because if we can't run this, then
  48.         # we can't solve deps.
  49.         slapt-get -u || exit 1
  50.        
  51. }
  52.  
  53. function install_dep_from_repos {
  54.         dep=$1
  55.         retval=""
  56.         slapt-get -y -i $dep
  57.         retval=$?
  58.         # return the returncode of runni
  59.         echo $retval
  60. }
  61.  
  62. function build_dep_from_source {
  63.         dep=$1
  64.         if [ -d $SBREPO/$dep ]; then
  65.                 # found the source dir... copy it to the build dir.
  66.                 cp -ar $SBREPO/$dep /tmp/builds/ || exit 1
  67.                 cd /tmp/builds/$dep/src || exit 1
  68.                 echo "Building $dep from source code ... "
  69.                 ./$dep.SlackBuild || exit 1
  70.                 installpkg /tmp/builds/$dep/$dep*.t?z || exit 1
  71.         else
  72.                 echo "Source directory for $dep not found.  Cannot build from source code."
  73.                 exit 1
  74.         fi
  75. }
  76.  
  77. function process_deps_hive {
  78.         # get list of initial dependencies.
  79.         initial=$(read_sb_deps $SBPATH)
  80.         # loop through these and try to solve them
  81.         for dep in $initial;
  82.                 slaptry=$(install_dep_from_repos $dep)
  83.                 if [ "$slaptry" != 0 ]; then
  84.        
  85.        
  86.        
  87. }
  88.  
  89. #val=$(install_dep_from_repos "foo")
  90. #echo $val
  91. #exit $val
  92.  
  93.  
  94. #echo "initial deps ... $initial"
  95. #for i in $initial; do
  96. #       deps_of_dep=$(read_sb_deps $SBREPO/$i/src/$i.SlackBuild)
  97. #       if [ "x$deps_of_dep" != "x" ]; then
  98. #               echo "Deps for $i .. $deps_of_dep"
  99. #       else
  100. #               echo "No dep data for $i"
  101. #       fi
  102. #       #deps_of_deps=$(read_sb_deps $i.SlackBuild)
  103. #       #echo $deps_of_dep
  104. #done
  105. #exit 0
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112. #ls -al $SBREPO
  113. #echo $DEPS
  114. if [ "x$DEPS" != "x" ]; then
  115.         echo "Refreshing repository data"
  116.         slapt-get -u || exit 1
  117. else
  118.         echo "No MAKEDEPENDS specifications found on $SB"
  119.         exit 0
  120. fi
  121. for i in $(echo $DEPS) ;do
  122. #        if !  ls /var/log/packages/$i-* &>/dev/null;then
  123.                 slapt-get -y -i $i
  124.                 if [ $? != 0 ];then
  125.                         if [ -d $SBREPO/$i ]; then
  126.                                 # copy the source dir to the build location
  127.                                 cp -ar $SBREPO/$i /tmp/builds/ || exit 1
  128.                                 cd /tmp/builds/$i/src || exit 1
  129.                                 chmod +x $i.SlackBuild || exit 1
  130.                                 echo "Building $i from source ... "
  131.                                 ./$i.SlackBuild || exit 1
  132.                                 installpkg /tmp/builds/$i/$i*t?z || exit 1
  133.                         else
  134.                                 echo "Package $i is not found on the online repos."
  135.                                 echo "No source found to build $i.  Cannot continue"
  136.                                 exit 1
  137.                         fi
  138.                fi
  139. #        else
  140. #                echo "$i is installed"
  141. #        fi
  142. done