Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] New profile 17: How urgent is the rebuild of world technically?
Date: Thu, 07 Dec 2017 08:08:23
Message-Id: 20171207080812.022c11f4@digimed.co.uk
In Reply to: Re: [gentoo-user] New profile 17: How urgent is the rebuild of world technically? by Frank Steinmetzger
1 On Thu, 7 Dec 2017 00:59:33 +0100, Frank Steinmetzger wrote:
2
3 > > How does a restarted emerge @world recognizes packages, which are
4 > > already compiled according to the new standard?
5 >
6 > I “circumvent” those questions by doing:
7 > emerge -pveD world > worldlist
8 > emerge -1O $(cat worldlist)
9 >
10 > If the system for whatever reason fails and I need to interrupt the
11 > merge, I simply remove the lines from worldlist that have already been
12 > built and then repeat the last command. Plus I can exclude some
13 > packages that don’t need a rebuild: -bins, -docs, virtuals, most perl
14 > and tex packages and so on. This saves a bit of time on the slower
15 > laptop.
16
17 I wrote a script to handle this some years ago, and it has come in handy
18 this week. It emerges all packages that have not been done since a given
19 time.
20
21 In this case, I run
22
23 mergeolderthan -r glibc
24
25 since glibc was emerged right before the world emerge
26
27 #!/bin/bash
28
29 EMERGE_ARGS="--oneshot --keep-going"
30
31 usage() {
32 echo -e "\nUsage: $(basename $0) [-f file] [-r category/package[-version] [-h]"
33 echo " -f re-emerge all packages older than this file"
34 echo " -r re-emerge all packages older than this package"
35 echo " -h Show this text"
36 echo -e "\n All other options are passed to the emerge command"
37 echo -e "$*"
38 exit
39 }
40
41 while getopts f:r:pvlh ARG; do
42 case "${ARG}" in
43 f) REFFILE=${OPTARG} ;;
44 r) REFFILE=$(ls -1 /var/db/pkg/${OPTARG}*/environment.bz2 | head -n 1) ;;
45 p) EMERGE_ARGS="${EMERGE_ARGS} --pretend" ;;
46 v) EMERGE_ARGS="${EMERGE_ARGS} --verbose" ;;
47 l) LIST="y" ;;
48 h) usage ;;
49 esac
50 done
51 shift $(expr ${OPTIND} - 1)
52
53 [[ "${REFFILE}" ]] || usage "\nYou must specify a reference with -f or -r\n"
54 [[ -f ${REFFILE} ]] || usage "\n${REFFILE} not found\n"
55
56 PKGLIST=$(mktemp -t mergeolderthan.XXXXXXXX)
57
58 emerge -ep --exclude gentoo-sources @world | grep -v sys-kernel/gentoo-sources | awk -F] '/^\[ebuild/ {print $2}' | awk '{print $1}' | while read PKG; do
59 if [[ /var/db/pkg/${PKG}/environment.bz2 -ot ${REFFILE} ]]; then
60 echo "=${PKG}" >>$PKGLIST
61 fi
62 done
63
64 if [[ "${LIST}" ]]; then
65 cat ${PKGLIST} && rm -f ${PKGLIST}
66 else
67 cat ${PKGLIST} | xargs --no-run-if-empty emerge ${EMERGE_ARGS} && rm -f ${PKGLIST}
68 fi
69
70
71
72 --
73 Neil Bothwick
74
75 Hickory Dickory Dock, The mice ran up the clock, The clock struck one, The
76 others escaped with minor injuries.