source: common/libs/func_compare.sh@ 9728b23

ablfs-more legacy trunk
Last change on this file since 9728b23 was f5ecc28, checked in by Pierre Labastie <pierre@…>, 5 years ago

Add code to save work at the end of chapter 5
(and finish the rebuild-makefile change)

  • Property mode set to 100644
File size: 3.1 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 "$N" "$PREV_IT"
12 fi
13 this_script=$ITERATION
14 CHROOT_wrt_target "$ITERATION" "$PREV"
15 wrt_compare_work "$ITERATION" "$PREV_IT"
16 wrt_logs "$N"
17 wrt_touch
18 PREV_IT=$ITERATION
19 PREV=$ITERATION
20 done
21}
22
23#----------------------------------#
24wrt_system_build() { #
25#----------------------------------#
26 local RUN=$1
27 local PREV_IT=$2
28
29 if [[ "$PROGNAME" = "clfs" ]] ; then
30 final_system_Makefiles $RUN
31 else
32 chapter6_Makefiles $RUN
33 fi
34
35 if [[ "$PROGNAME" = "clfs" ]] ; then
36 basicsystem="$basicsystem $PREV_IT $system_build"
37 else
38 chapter6="$chapter6 $PREV_IT $system_build"
39 fi
40
41 if [[ "$RUN" = "$ITERATIONS" ]] ; then
42 if [[ "$PROGNAME" = "clfs" ]] ; then
43 basicsystem="$basicsystem iteration-$RUN"
44 else
45 chapter6="$chapter6 iteration-$RUN"
46 fi
47 fi
48}
49
50#----------------------------------#
51wrt_compare_work() { #
52#----------------------------------#
53 local ITERATION=$1
54 local PREV_IT=$2
55 local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
56/sources /root /run /srv /sys /tmp /tools /usr/local /usr/src /var"
57
58 local ROOT_DIR=/
59 local DEST_TOPDIR=/${SCRIPT_ROOT}
60 local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
61
62 if [[ "$RUN_ICA" = "y" ]] ; then
63 local DEST_ICA=$DEST_TOPDIR/ICA && \
64 # the PRUNEPATH additional setting is to avoid .pyc files to show up in diff
65(
66 cat << EOF
67 @PRUNEPATH="$PRUNEPATH \$\$(find /usr/lib -name __pycache__)"; \\
68 extras/do_copy_files "\$\$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\
69 extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1
70EOF
71) >> $MKFILE.tmp
72 if [[ "$ITERATION" != "iteration-1" ]] ; then
73 wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
74 fi
75 fi
76
77}
78
79#----------------------------------#
80wrt_do_ica_work() { #
81#----------------------------------#
82 echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
83}
84
85#----------------------------------#
86wrt_logs() { #
87#----------------------------------#
88 local build=build_$1
89 local file
90
91(
92 cat << EOF
93 @cd logs && \\
94 mkdir $build && \\
95 mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
96 if [ ! $build = build_1 ] ; then \\
97 cd $build && \\
98 for file in \`ls .\` ; do \\
99 mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
100 done ; \\
101 fi
102 @cd /\$(SCRIPT_ROOT)
103 @if [ -d test-logs ] ; then \\
104 cd test-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 fi ;
115EOF
116) >> $MKFILE.tmp
117}
Note: See TracBrowser for help on using the repository browser.