/[gentoo-x86]/autocompile.sh
Gentoo

Diff of /autocompile.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.3
1#!/bin/sh 1#!/bin/sh
2 2
3 3
4C_NORMAL=$'\033[0m' 4C_NORMAL=$'\033[0m'
5C_HILITE=$'\e[36;01m' 5C_HILITE=$'\e[36;01m'
6C_END=$'\e[A\e[73G' 6C_END=$'\e[A\e[68G'
7C_OK=$'\e[32m' 7C_OK=$'\e[32m'
8C_NO=$'\e[31m' 8C_NO=$'\e[31m'
9PORTDIR=/usr/portage 9PORTDIR=/usr/portage
10LOGDIR=$ROOT/tmp/portage-log
11STEPS="check fetch clean unpack compile install qmerge clean"
12
13do_step() {
14
15 echo "$C_END $C_HILITE "
16 echo "$C_END $C_HILITE [$1] "
17 ebuild $myd $1 &> $myl/$1
18 mye=$?
19
20 if [ -f $LOGDIR/$1 ]
21 then
22 cp $LOGDIR/$1 /tmp/failed
23 grep -v "$i" /tmp/failed > $LOGDIR/$1
24 fi
25
26 if [ $mye -ne 0 ]
27 then
28 echo "$C_END $C_HILITE "
29 echo "$C_END $C_NO [$1] "
30 echo $i >> $LOGDIR/$1
31 fi
32}
10 33
11if [ -z "${ROOT}" ] 34if [ -z "${ROOT}" ]
12then 35then
13 echo "ROOT not set !" 36 echo "ROOT not set !"
14 exit 1 37 exit 1
15fi 38fi
16 39
17if [ -n "`ls ${ROOT}`" ]
18then
19 echo "$C_HILITE>>>$C_NORMAL Cleaning ${ROOT}..."
20 rm -r ${ROOT}/*
21fi
22
23echo "$C_HILITE>>>$C_NORMAL Reading configuration..."
24mylist=${PORTDIR}/gentoo-x86/current-packages 40mylist=${PORTDIR}/gentoo-x86/current-packages
25 41
26if [ -f "${1}" ] 42if [ -f "${1}" ]
27then 43then
28 mylist=${1} 44 mylist=${1}
29fi 45fi
30 46
31echo "$C_HILITE>>>$C_NORMAL Using ${mylist}"
32
33mypackages="`grep -v "\#.*" $mylist`" 47mypackages="`grep -v "\#.*" $mylist`"
34 48
35if [ -d "/tmp/portage-log" ]
36then
37 rm -r /tmp/portage-log
38fi
39 49
40mkdir /tmp/portage-log 50mkdir -p $ROOT/tmp/portage-log
41 51
42echo "$C_HILITE>>>$C_NORMAL Building ..." 52echo "$C_HILITE>>>$C_NORMAL Building from ${mylist}..."
43for i in $mypackages 53for i in $mypackages
44do 54do
45 55
46 # full path 56 # full path
47 myd=${i/.\//$PORTDIR\/gentoo-x86\/} 57 myd=${i/.\//$PORTDIR\/gentoo-x86\/}
55 # package name 65 # package name
56 myp=${myf%*.ebuild} 66 myp=${myf%*.ebuild}
57 67
58 if [ -f "$myd" ] 68 if [ -f "$myd" ]
59 then 69 then
60 echo "$C_NORMAL $myp ($myc)"
61 70
62 myl="/tmp/portage-log/$myc/$myp/" 71 # Check if installed
63 install -d $myl 72 if [ -d ${ROOT}var/db/pkg/$myc/$myp ]
64
65 # Check dependencies
66 echo "$C_END $C_HILITE [CHECK] "
67 ebuild $myd check &> $myl/check
68 mye=$?
69 if [ $mye -ne 0 ]
70 then 73 then
71 echo "$C_END $C_NO [CHECK] "
72 echo $myd > /tmp/portage/check-failed
73 continue
74 fi
75
76 # Clean
77 echo "$C_END $C_HILITE [CLEAN] "
78 ebuild $myd clean &> $myl/clean
79 mye=$?
80 if [ $mye -ne 0 ]
81 then
82 echo "$C_END $C_NO [CLEAN] "
83 echo $myd > /tmp/portage/clean-failed
84 continue 74 continue
85 fi 75 fi
86 76
87 # Unpack 77 echo "$C_NORMAL$myp ($myc)"
88 echo "$C_END $C_HILITE [UNPACK] " 78
89 ebuild $myd unpack &> $myl/unpack 79 myl="$LOGDIR/$myc/$myp/"
80 mkdir -p $myl
81
82 for j in ${STEPS}
83 do
90 mye=$? 84 mye=0
85 do_step $j
91 if [ $mye -ne 0 ] 86 if [ $mye -ne 0 ]
92 then 87 then
88 break
89 fi
90 done
91 if [ $mye -eq 0 ]
92 then
93 echo "$C_END $C_NO [UNPACK] " 93 echo "$C_END $C_OK [OK] "
94 echo $myd > /tmp/portage/unpack-failed
95 continue
96 fi 94 fi
97
98 # Compile
99 echo "$C_END $C_HILITE [COMPILE]"
100 ebuild $myd compile &> $myl/compile
101 mye=$?
102 if [ $mye -ne 0 ]
103 then
104 echo "$C_END $C_NO [COMPILE]"
105 echo $myd > /tmp/portage/compile-failed
106 continue
107 fi 95
108
109 # Install
110 echo "$C_END $C_HILITE [INSTALL]"
111 ebuild $myd install &> $myl/install
112 mye=$?
113 if [ $mye -ne 0 ]
114 then
115 echo "$C_END $C_NO [INSTALL]"
116 echo $myd > /tmp/portage/install-failed
117 continue
118 fi
119
120 # Merge
121 echo "$C_END $C_HILITE [MERGE] "
122 ebuild $myd qmerge &> $myl/merge
123 mye=$?
124 if [ $mye -ne 0 ]
125 then
126 echo "$C_END $C_NO [MERGE] "
127 echo $myd > /tmp/portage/merge-failed
128 continue
129 fi
130
131 echo "$C_END $C_OK [OK] "
132
133 else 96 else
134 echo "!!! $myd does not exists !" 97 echo "!!! $myd does not exists !"
135 fi 98 fi
136done 99done

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.20