source: common/libs/func_compare.sh@ d5a739a

ablfs-more legacy trunk
Last change on this file since d5a739a 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
Line 
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
11 wrt_system_build "$1" "$N" "$PREV_IT"
12 fi
13 # add needed Makefile target
14 this_script=$ITERATION
15 CHROOT_wrt_target "$ITERATION" "$PREV"
16 wrt_compare_work "$ITERATION" "$PREV_IT"
17 wrt_logs "$N"
18 wrt_touch
19 PREV_IT=$ITERATION
20 PREV=$ITERATION
21 done
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
32}
33
34#----------------------------------#
35wrt_system_build() { #
36#----------------------------------#
37 local CHAP=$1
38 local RUN=$2
39 local PREV_IT=$3
40
41 if [[ "$PROGNAME" = "clfs" ]] ; then
42 final_system_Makefiles $RUN
43 else
44 chapter_targets $CHAP $RUN
45 fi
46
47 if [[ "$PROGNAME" = "clfs" ]] ; then
48 basicsystem="$basicsystem $PREV_IT $system_build"
49 else
50 CHROOT_TGT="$CHROOT_TGT $PREV_IT $system_build"
51 fi
52
53 if [[ "$RUN" = "$ITERATIONS" ]] ; then
54 if [[ "$PROGNAME" = "clfs" ]] ; then
55 basicsystem="$basicsystem iteration-$RUN"
56 else
57 CHROOT_TGT="$CHROOT_TGT iteration-$RUN"
58 fi
59 fi
60}
61
62#----------------------------------#
63wrt_compare_work() { #
64#----------------------------------#
65 local ITERATION=$1
66 local PREV_IT=$2
67 local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
68/sources /root /run /srv /sys /tmp /tools /usr/local /usr/src /var"
69
70 local ROOT_DIR=/
71 local DEST_TOPDIR=/${SCRIPT_ROOT}
72 local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
73
74 if [[ "$RUN_ICA" = "y" ]] ; then
75 local DEST_ICA=$DEST_TOPDIR/ICA && \
76 # the PRUNEPATH additional setting is to avoid .pyc files to show up in diff
77(
78 cat << EOF
79 @PRUNEPATH="$PRUNEPATH \$\$(find /usr/lib -name __pycache__)"; \\
80 extras/do_copy_files "\$\$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\
81 extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1
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#----------------------------------#
93 echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
94}
95
96#----------------------------------#
97wrt_logs() { #
98#----------------------------------#
99 local build=build_$1
100 local file
101
102(
103 cat << EOF
104 @cd logs && \\
105 mkdir $build && \\
106 mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
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 ; \\
112 fi
113 @cd /\$(SCRIPT_ROOT)
114 @if [ -d test-logs ] ; then \\
115 cd test-logs && \\
116 mkdir $build && \\
117 mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
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.