summaryrefslogtreecommitdiff
blob: 31b313b082c821ea1a29b9a2dae1a75b8fc839e5 (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
#!/bin/sh
#
# Copyright © 2008-2010 Diego Elio Pettenò <flameeyes@gentoo.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.

mkdir -p /var/cache/tinderbox

reset_emergelog() {
    rm -f /var/log/emerge.log
}

dent() {
    # Ignore failure that might be caused by network being
    # unavailable, the service being unavailable or things like those.
    echo "$@" | bti --background || true
}

set -e

dent "#syncing anew upon request"

emerge --sync

echo > /etc/portage/package.mask/currentrun

./unavailable_installed.py | xargs -r emerge -C

reset_emergelog

emerge -u1 portage

emerge -u1 gcc
if fgrep -q '>>> emerge' /var/log/emerge.log; then
    ./update-gcc-asneeded.sh
    exit 0
fi

reset_emergelog

if emerge -u1 perl-cleaner perl &&
    fgrep -q '>>> emerge' /var/log/emerge.log; then

    dent "running per-cleaner"
    perl-cleaner --all -- --keep-going
fi

reset_emergelog

if emerge -u1 ghc haskell-updater &&
    fgrep -q '>>> emerge' /var/log/emerge.log; then

    dent "running #haskell-updater"
    /usr/sbin/haskell-updater --upgrade
fi

reset_emergelog

if emerge -u1 dev-lang/ocaml &&
    fgrep -q '>>> emerge' /var/log/emerge.log; then

    dent "running #ocaml-rebuild"
    # Don't fail if ocaml-rebuild fails, because of bug #319553
    /usr/sbin/ocaml-rebuild.sh -f || true
fi

reset_emergelog

cp /usr/src/linux/.config /usr/src/config

if emerge -u1 sys-kernel/gentoo-sources &&
    fgrep -q '>>> emerge' /var/log/emerge.log; then

    dent "new #gentoo-sources, making oldconfig"
    cp /usr/src/config /usr/src/linux/.config

    pushd /usr/src/linux
        make -j14 oldconfig && \
            make -j14 prepare modules_prepare
    popd

    emerge -P gentoo-sources
fi

emerge -u1 glibc bti screen gentoolkit java-dep-check portage-utils

reset_emergelog

# Generate a new complete list, this will also produce the list of new
# dependencies to satisfy. Ignore new-style virtuals, leave them to be
# merged out of dependencies.
./tinderbox.py | egrep -v '^virtual/' > /var/cache/tinderbox/list-complete

# Launch the fetch operation in background, saving the log (of both
# good results and failures).
nohup xargs -a /var/cache/tinderbox/list-complete emerge -fO --keep-going &> /var/log/tinderbox-fetch.log &

# Now replace the old queue with a new one, skipping everything that
# we wouldn't otherwise be merging (packages masked, removed, and
# similar).
mv /var/cache/tinderbox/queue /var/cache/tinderbox/queue.old
sort /var/cache/tinderbox/queue.old /var/cache/tinderbox/list-complete | uniq -d | sort -R > /var/cache/tinderbox/queue