2 # Specific script for the final Dragora release process.
4 # Copyright (c) 2021-2023 Matias Fonzo, <selk@dragora.org>.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
22 # - Build the final system using real cores (instead of threads,
23 # if possible) to try to guarantee an error-free compilation.
24 # Instructions taken from https://stackoverflow.com/questions/6481005/how-to-obtain-the-number-of-cpus-cores-in-linux-from-the-command-line
28 # - Use the -f (force) option when building on 'phase-1'.
32 # - Switch /bin/sh to /bin/bash for catching errors on pipes.
34 # - Upgrade packages on 'phase-2' to ensure no dependency on
35 # /tools (temporary system) or to ensure possible system
36 # breaks by cutting symbolic links using qi/graft.
45 rm -f /build-phase1-log.txt
/build-phase2-log.txt
48 # Build all the packages to conform the final system.
52 echo "*** Building Dragora for release [phase-1]..."
54 echo "Using 1 parallel job for the compiler."
57 qi order
/usr
/src
/qi
/recipes
/*.order | \
58 qi build
-f -j1 -p -i - 2>&1 |
tee build-phase1-log.txt
61 # Build all the important packages against the final system
66 # Parallel jobs for the final system (phase-2)
68 # The default is to use the maximum number of
69 # installed processors (this should work on
70 # hyperthreading and non-hyperthreading systems)
71 JOBS
="${JOBS:-$(awk -F: '/^physical/ && !ID[$2] { P++; ID[$2]=1 }; /^cpu cores/ { CORES=$2 }; END { print CORES*P }' /proc/cpuinfo)}"
73 # Declare recipes that do not require reconstruction:
74 exclude_list
='!/pass-?|^data\/|docbook\/|xorg\/doc\/|xorg\/font\/|tde\/tde-i18n|devel\/fortify-headers|kernel\/headers|kernel\/generic|kernel\/buildtree-generic|kernel\/firmware|tools\/dragora-installer/'
77 echo "*** Building Dragora for release [phase-2]..."
79 echo "Using $JOBS parallel job(s) for the compiler."
84 mv -f /tools
/tools-to-be-renamed
88 qi order
/usr
/src
/qi
/recipes
/*.order |
awk "$exclude_list" | \
89 qi build
-f -j${JOBS} -p -u - 2>&1 |
tee build-phase2-log.txt
91 unset -v JOBS exclude_list
93 if test -d /tools-to-be-renamed
95 mv -f /tools-to-be-renamed
/tools