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
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
11 wrt_system_build "$N" "$PREV_IT"
12 fi
13 this_script=$ITERATION
[045b2dc]14 CHROOT_wrt_target "$ITERATION" "$PREV"
[45f82718]15 wrt_compare_work "$ITERATION" "$PREV_IT"
[10c8b78]16 wrt_logs "$N"
[6bb080e]17 wrt_touch
[45f82718]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
[7a84ba7]29 if [[ "$PROGNAME" = "clfs" ]] ; then
30 final_system_Makefiles $RUN
[45f82718]31 else
32 chapter6_Makefiles $RUN
33 fi
34
[045b2dc]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
[45f82718]48}
49
50#----------------------------------#
51wrt_compare_work() { #
52#----------------------------------#
53 local ITERATION=$1
54 local PREV_IT=$2
[1a1f099]55 local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
[f5ecc28]56/sources /root /run /srv /sys /tmp /tools /usr/local /usr/src /var"
[45f82718]57
[045b2dc]58 local ROOT_DIR=/
59 local DEST_TOPDIR=/${SCRIPT_ROOT}
60 local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
[45f82718]61
[401f81e]62 if [[ "$RUN_ICA" = "y" ]] ; then
[45f82718]63 local DEST_ICA=$DEST_TOPDIR/ICA && \
[31a9b14]64 # the PRUNEPATH additional setting is to avoid .pyc files to show up in diff
[45f82718]65(
66 cat << EOF
[31a9b14]67 @PRUNEPATH="$PRUNEPATH \$\$(find /usr/lib -name __pycache__)"; \\
68 extras/do_copy_files "\$\$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\
[6bb080e]69 extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1
[45f82718]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#----------------------------------#
[6bb080e]82 echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
[45f82718]83}
84
[10c8b78]85#----------------------------------#
86wrt_logs() { #
87#----------------------------------#
88 local build=build_$1
89 local file
90
91(
92 cat << EOF
93 @cd logs && \\
94 mkdir $build && \\
[b7515ec]95 mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
[10c8b78]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 ; \\
[7b7b5e9]101 fi
[10c8b78]102 @cd /\$(SCRIPT_ROOT)
103 @if [ -d test-logs ] ; then \\
104 cd test-logs && \\
105 mkdir $build && \\
[7fa9369]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 ; \\
112 fi ; \\
113 cd /\$(SCRIPT_ROOT) ; \\
114 fi ;
115EOF
116) >> $MKFILE.tmp
117}
Note: See TracBrowser for help on using the repository browser.