source: common/libs/func_compare.sh@ b6e981a

ablfs-more legacy trunk
Last change on this file since b6e981a was 3da8c49, checked in by Pierre Labastie <pierre@…>, 4 years ago

Update ICA for new LFS/master.sh

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[45f82718]1# $Id$
2
3#----------------------------------#
4wrt_compare_targets() { #
5#----------------------------------#
6
7 for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
8 # and "ITERATIONS" with no "$".
9 ITERATION=iteration-$N
10 if [ "$N" != "1" ] ; then
[3da8c49]11 wrt_system_build "$1" "$N" "$PREV_IT"
[45f82718]12 fi
[3da8c49]13 # add needed Makefile target
[45f82718]14 this_script=$ITERATION
[045b2dc]15 CHROOT_wrt_target "$ITERATION" "$PREV"
[45f82718]16 wrt_compare_work "$ITERATION" "$PREV_IT"
[10c8b78]17 wrt_logs "$N"
[6bb080e]18 wrt_touch
[45f82718]19 PREV_IT=$ITERATION
20 PREV=$ITERATION
21 done
[3da8c49]22 # We need to prevent "userdel" in all iterations but the last
23 # We need to access the scriptlets in "dir"
24 local dir
25 printf -v dir chapter%02d "$1"
26
27 sed -i '/userdel/d' $dir/*revised*
28 for (( N = 2; N < ITERATIONS; N++ )); do
29 sed -i '/userdel/d' $dir-build_$N/*revised*
30 done
31
[45f82718]32}
33
34#----------------------------------#
35wrt_system_build() { #
36#----------------------------------#
[3da8c49]37 local CHAP=$1
38 local RUN=$2
39 local PREV_IT=$3
[45f82718]40
[7a84ba7]41 if [[ "$PROGNAME" = "clfs" ]] ; then
42 final_system_Makefiles $RUN
[45f82718]43 else
[3da8c49]44 chapter_targets $CHAP $RUN
[45f82718]45 fi
46
[045b2dc]47 if [[ "$PROGNAME" = "clfs" ]] ; then
48 basicsystem="$basicsystem $PREV_IT $system_build"
49 else
[3da8c49]50 CHROOT_TGT="$CHROOT_TGT $PREV_IT $system_build"
[045b2dc]51 fi
52
53 if [[ "$RUN" = "$ITERATIONS" ]] ; then
54 if [[ "$PROGNAME" = "clfs" ]] ; then
55 basicsystem="$basicsystem iteration-$RUN"
56 else
[3da8c49]57 CHROOT_TGT="$CHROOT_TGT iteration-$RUN"
[045b2dc]58 fi
59 fi
[45f82718]60}
61
62#----------------------------------#
63wrt_compare_work() { #
64#----------------------------------#
65 local ITERATION=$1
66 local PREV_IT=$2
[1a1f099]67 local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
[f5ecc28]68/sources /root /run /srv /sys /tmp /tools /usr/local /usr/src /var"
[45f82718]69
[045b2dc]70 local ROOT_DIR=/
71 local DEST_TOPDIR=/${SCRIPT_ROOT}
72 local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
[45f82718]73
[401f81e]74 if [[ "$RUN_ICA" = "y" ]] ; then
[45f82718]75 local DEST_ICA=$DEST_TOPDIR/ICA && \
[31a9b14]76 # the PRUNEPATH additional setting is to avoid .pyc files to show up in diff
[45f82718]77(
78 cat << EOF
[31a9b14]79 @PRUNEPATH="$PRUNEPATH \$\$(find /usr/lib -name __pycache__)"; \\
80 extras/do_copy_files "\$\$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\
[6bb080e]81 extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1
[45f82718]82EOF
83) >> $MKFILE.tmp
84 if [[ "$ITERATION" != "iteration-1" ]] ; then
85 wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
86 fi
87 fi
88}
89
90#----------------------------------#
91wrt_do_ica_work() { #
92#----------------------------------#
[6bb080e]93 echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
[45f82718]94}
95
[10c8b78]96#----------------------------------#
97wrt_logs() { #
98#----------------------------------#
99 local build=build_$1
100 local file
101
102(
103 cat << EOF
104 @cd logs && \\
105 mkdir $build && \\
[b7515ec]106 mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
[10c8b78]107 if [ ! $build = build_1 ] ; then \\
108 cd $build && \\
109 for file in \`ls .\` ; do \\
110 mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
111 done ; \\
[7b7b5e9]112 fi
[10c8b78]113 @cd /\$(SCRIPT_ROOT)
114 @if [ -d test-logs ] ; then \\
115 cd test-logs && \\
116 mkdir $build && \\
[7fa9369]117 mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
[10c8b78]118 if [ ! $build = build_1 ] ; then \\
119 cd $build && \\
120 for file in \`ls .\` ; do \\
121 mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
122 done ; \\
123 fi ; \\
124 cd /\$(SCRIPT_ROOT) ; \\
125 fi ;
126EOF
127) >> $MKFILE.tmp
128}
Note: See TracBrowser for help on using the repository browser.