summaryrefslogtreecommitdiff
blob: 23c9b1b87cb4429895dd8c99943c5ac5e9f22eb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/sh


C_NORMAL=$'\033[0m'
C_HILITE=$'\e[36;01m'
C_END=$'\e[A\e[73G'
C_OK=$'\e[32m'
C_NO=$'\e[31m'
PORTDIR=/usr/portage

if [ -z "${ROOT}" ]
then
	echo "ROOT not set !"
	exit 1
fi

if [ -n "`ls ${ROOT}`" ]
then
  echo "$C_HILITE>>>$C_NORMAL Cleaning ${ROOT}..."
  rm -r ${ROOT}/*
fi

echo "$C_HILITE>>>$C_NORMAL Reading configuration..."
mylist=${PORTDIR}/gentoo-x86/current-packages

if [ -f "${1}" ]
then
  mylist=${1}
fi

echo "$C_HILITE>>>$C_NORMAL Using ${mylist}"

mypackages="`grep -v "\#.*" $mylist`"

if [ -d "/tmp/portage-log" ]
then
  rm -r /tmp/portage-log
fi

mkdir /tmp/portage-log

echo "$C_HILITE>>>$C_NORMAL Building ..."
for i in $mypackages
do

  # full path
  myd=${i/.\//$PORTDIR\/gentoo-x86\/}

  # file name
  myf="`basename $myd`"

  # category
  myc="`echo $i | sed -e "s:^\./\(.*\).*/.*/.*$:\1:"`"

  # package name
  myp=${myf%*.ebuild}

  if [ -f "$myd" ]
  then
    echo "$C_NORMAL $myp ($myc)"

    myl="/tmp/portage-log/$myc/$myp/"
    install -d $myl 

    # Check dependencies
    echo "$C_END $C_HILITE [CHECK]  "
    ebuild $myd check &> $myl/check
    mye=$?
    if [ $mye -ne 0 ]
    then
      echo "$C_END $C_NO [CHECK]  "
      echo $myd > /tmp/portage/check-failed
      continue
    fi
       
    # Clean
    echo "$C_END $C_HILITE [CLEAN]  "
    ebuild $myd clean &> $myl/clean
    mye=$?
    if [ $mye -ne 0 ]
    then
      echo "$C_END $C_NO [CLEAN]  "
      echo $myd > /tmp/portage/clean-failed
      continue
    fi

    # Unpack
    echo "$C_END $C_HILITE [UNPACK] "
    ebuild $myd unpack &> $myl/unpack
    mye=$?
    if [ $mye -ne 0 ]
    then
      echo "$C_END $C_NO [UNPACK] "
      echo $myd > /tmp/portage/unpack-failed
      continue
    fi

    # Compile
    echo "$C_END $C_HILITE [COMPILE]"
    ebuild $myd compile &> $myl/compile
    mye=$?
    if [ $mye -ne 0 ]
    then
      echo "$C_END $C_NO [COMPILE]"
      echo $myd > /tmp/portage/compile-failed
      continue
    fi

    # Install
    echo "$C_END $C_HILITE [INSTALL]"
    ebuild $myd install &> $myl/install
    mye=$?
    if [ $mye -ne 0 ]
    then
      echo "$C_END $C_NO [INSTALL]"
      echo $myd > /tmp/portage/install-failed
      continue
    fi

    # Merge
    echo "$C_END $C_HILITE [MERGE]  "
    ebuild $myd qmerge &> $myl/merge
    mye=$?
    if [ $mye -ne 0 ]
    then
      echo "$C_END $C_NO [MERGE]  "
      echo $myd > /tmp/portage/merge-failed
      continue
    fi

    echo "$C_END $C_OK [OK]     "

  else
    echo "!!! $myd does not exists !"
  fi
done