source: contrib/jhalfs-paco.patch@ 6821737

1.0 2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 6821737 was 6821737, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Updated paco patch.

  • Property mode set to 100644
File size: 17.4 KB
RevLine 
[059822c]1Index: LFS/master.sh
2===================================================================
[6821737]3--- LFS/master.sh (revision 2542)
[059822c]4+++ LFS/master.sh (working copy)
[6821737]5@@ -158,6 +158,13 @@
6 *stripping*) [[ "${STRIP}" = "0" ]] && continue ;;
7 esac
8
9+ # Install paco as the first package in ch6, before installing linux-libc-headers.
10+ case "${this_script}" in
11+ *linux-libc-headers)
12+ PACO_NUM=`echo ${this_script} | sed -e 's/linux-libc-headers/a-paco/'`
13+ wrt_paco_inst "$PACO_NUM"
14+ esac
15+
16 # First append each name of the script files to a list (this will become
17 # the names of the targets in the Makefile
18 chapter6="$chapter6 ${this_script}"
19@@ -188,7 +195,9 @@
[059822c]20 # and not to use chroot.
21 case "${this_script}" in
22 *kernfs) wrt_run_as_root "${this_script}" "$file" ;;
23- *) wrt_run_as_chroot1 "${this_script}" "$file" ;;
24+ *) wrt_paco_prep
25+ wrt_run_as_chroot1 "${this_script}" "$file"
26+ wrt_paco_log "$name" "$vrs" ;;
27 esac
28
29 # Remove the build directory(ies) except if the package build fails.
[6821737]30@@ -206,6 +215,14 @@
[059822c]31
32 # Keep the script file name for Makefile dependencies.
33 PREV=${this_script}
34+
[6821737]35+ # Reinstalling paco after readsjusting the toolchain.
[059822c]36+ case "${this_script}" in
[6821737]37+ *readjusting)
38+ PACO_NUM=`echo ${this_script} | sed -e 's/readjusting/x-paco/'`
39+ wrt_paco_inst "$PACO_NUM" ;;
[059822c]40+ esac
41+
42 done # end for file in chapter06/*
43 }
44
[6821737]45@@ -267,6 +284,14 @@
[059822c]46 wrt_run_as_chroot2 "$this_script" "$file"
47 fi
48 ;;
49+ *kernel) wrt_paco_prep
50+ wrt_run_as_chroot2 "$this_script" "$file"
51+ wrt_paco_log "linux-kernel" "$vrs"
52+ ;;
53+ *bootscripts) wrt_paco_prep
54+ wrt_run_as_chroot2 "$this_script" "$file"
55+ wrt_paco_log "lfs-bootscripts" "$vrs"
56+ ;;
57 *) wrt_run_as_chroot2 "$this_script" "$file"
58 ;;
59 esac
60Index: LFS/lfs.xsl
61===================================================================
[6821737]62--- LFS/lfs.xsl (revision 2542)
[059822c]63+++ LFS/lfs.xsl (working copy)
64@@ -32,6 +32,9 @@
65 <!-- Locale settings -->
66 <xsl:param name="lang" select="en_CA"/>
67
68+ <!-- Use paco? -->
69+ <xsl:param name="use_paco" select="1"/>
70+
71 <xsl:template match="/">
72 <xsl:apply-templates select="//sect1"/>
73 </xsl:template>
74@@ -190,6 +193,33 @@
75 <xsl:apply-templates/>
76 <xsl:text> || true&#xA;</xsl:text>
77 </xsl:when>
78+ <!-- paco begin -->
79+ <!-- General rule -->
80+ <xsl:when test="$use_paco != '0' and
81+ ancestor::chapter[@id != 'chapter-temporary-tools'] and
82+ contains(string(),'make') and
83+ contains(string(),'install')">
84+ <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
85+ <xsl:apply-templates/>
86+ <xsl:text>&#xA;</xsl:text>
87+ </xsl:when>
88+ <!-- Linux-libc-headers -->
89+ <xsl:when test="$use_paco != '0' and
90+ ancestor::sect1[@id='ch-system-linux-libc-headers'] and
91+ contains(string(),'install ')">
92+ <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
93+ <xsl:apply-templates/>
94+ <xsl:text>&#xA;</xsl:text>
95+ </xsl:when>
96+ <!-- Unset LD_PRELOAD before second make in Zlib -->
97+ <xsl:when test="$use_paco != '0' and
98+ ancestor::sect1[@id='ch-system-zlib'] and
99+ contains(string(),'make clean')">
100+ <xsl:text>unset LD_PRELOAD&#xA;</xsl:text>
101+ <xsl:apply-templates/>
102+ <xsl:text>&#xA;</xsl:text>
103+ </xsl:when>
104+ <!-- paco end -->
105 <!-- The rest of commands -->
106 <xsl:otherwise>
107 <xsl:apply-templates/>
108Index: BLFS/master.sh
109===================================================================
[6821737]110--- BLFS/master.sh (revision 2542)
[059822c]111+++ BLFS/master.sh (working copy)
112@@ -79,6 +79,19 @@
113 EOF
114 ) >> $MKFILE
115
116+ if [[ $USE_PACO != 0 ]]; then
117+(
118+ cat << EOF
119+ @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" >logs/$this_script && \\
120+ source $JHALFSDIR/pacovars && \\
121+ rm -f $PACO_TMPFILE && \\
122+ $JHALFSDIR/${PROGNAME}-commands/$file >>logs/$this_script 2>&1 && \\
123+ echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" >>logs/$this_script
124+EOF
125+) >> $MKFILE
126+ wrt_paco_log_blfs
127+
128+ else
129 # Insert date and disk usage at the top of the log file, the script run
130 # and date and disk usage again at the bottom of the log file.
131 (
132Index: BLFS/blfs.xsl
133===================================================================
[6821737]134--- BLFS/blfs.xsl (revision 2542)
[059822c]135+++ BLFS/blfs.xsl (working copy)
136@@ -159,7 +159,7 @@
137 <xsl:when test="@role = 'nodump'"/>
138 <xsl:otherwise>
139 <xsl:if test="@role = 'root'">
140- <xsl:text>sudo </xsl:text>
141+ <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
142 </xsl:if>
143 <xsl:apply-templates select="userinput" mode="screen"/>
144 </xsl:otherwise>
145Index: common/config
146===================================================================
[6821737]147--- common/config (revision 2542)
[059822c]148+++ common/config (working copy)
[d748b31]149@@ -58,6 +58,23 @@
150 # Not used in LFS
151 KEYMAP=none
152
[059822c]153+
154+#==== PACO VARIABLES ====
155+#--- Use paco? 0/1 0(no)/1(yes)
156+USE_PACO=1
157+PACO_VERSION=1.10.4
158+
159+#--- Name of the Paco source package
160+PACO_FILE=paco-$PACO_VERSION.tar.*
161+
162+#--- Variables needed
163+# Don't change unless you know what you're doing
164+PACO_INCLUDE=/
165+PACO_EXCLUDE=/sys:/dev:/proc:/tmp:/usr/src:/usr/share/info/dir
166+PACO_TMPFILE=/tmp/paco.tmp
167+LD_PRELOAD=/usr/lib/libpaco-log.so
[d748b31]168+
169+
170 #=== Variables needed by ICA (Not implemented yet :-/)===
171 #--- Run ICA testing 0/1 0(no)/1(yes)
172 RUN_ICA=0
[059822c]173Index: common/func_validate_configs.sh
174===================================================================
[6821737]175--- common/func_validate_configs.sh (revision 2542)
[059822c]176+++ common/func_validate_configs.sh (working copy)
177@@ -85,10 +85,10 @@
178 inline_doc
179
180 # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
181- local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG DEPEND TEST"
182- local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST STRIP FSTAB CONFIG KEYMAP PAGE TIMEZONE LANG LC_ALL"
183- local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD ARCH TARGET TEST STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
184- local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE TEST STRIP FSTAB CONFIG VIMLANG PAGE TIMEZONE LANG"
[d748b31]185+ local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE USE_PACO HPKG DEPEND TEST"
[059822c]186+ local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE USE_PACO HPKG RUNMAKE MODEL GRSECURITY_HOST TEST STRIP FSTAB CONFIG KEYMAP PAGE TIMEZONE LANG LC_ALL"
187+ local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE USE_PACO HPKG RUNMAKE METHOD ARCH TARGET TEST STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
188+ local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE USE_PACO HPKG RUNMAKE TEST STRIP FSTAB CONFIG VIMLANG PAGE TIMEZONE LANG"
189
190 local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
191 local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
192@@ -130,6 +130,7 @@
193 continue ;;
194 TIMEZONE) continue;;
195 MKFILE) continue;;
196+ USE_PACO) validation_str="x0x x1x"; validate_str; continue ;;
197 HPKG) validation_str="x0x x1x"; validate_str; continue ;;
198 RUNMAKE) validation_str="x0x x1x"; validate_str; continue ;;
199 TEST) validation_str="x0x x1x x2x x3x"; validate_str; continue ;;
200Index: common/paco-functions
201===================================================================
202--- common/paco-functions (revision 0)
203+++ common/paco-functions (revision 0)
[6821737]204@@ -0,0 +1,112 @@
[059822c]205+#!/bin/bash
206+
207+
208+#----------------------------#
209+wrt_paco_inst() { #
210+#----------------------------#
[d748b31]211+
212+# Not using Paco with uClibc, even if requested
213+if [ $PROGNAME = "hlfs" ]; then
214+ if [ $MODEL = "uclibc" ]; then
[6821737]215+ USE_PACO=0
[d748b31]216+ fi
217+fi
218+
219+if [ $USE_PACO != 0 ]; then
[6821737]220+ paco_script="$1"
221+ paco_file="chapter06/$paco_script"
222+ chapter6="$chapter6 $paco_script"
223+
224+ # Copy the paco build script to the correct directory and make it executable
225+ cp $JHALFSDIR/paco-build.sh $JHALFSDIR/${PROGNAME}-commands/$paco_file &&
226+ chmod +x $JHALFSDIR/${PROGNAME}-commands/$paco_file
[059822c]227+
228+ # Write target, dependency and unpack
[6821737]229+ wrt_target "$paco_script" "$PREV"
[059822c]230+ wrt_unpack2 "$PACO_FILE"
231+
232+ # Run the script
[6821737]233+ wrt_run_as_chroot1 "${paco_script}" "${paco_file}"
[059822c]234+
235+ # Clean up
[6821737]236+ wrt_remove_build_dirs "paco"
[059822c]237+ echo -e '\t@touch $@' >> $MKFILE.tmp
238+
239+ # Override the PREV variable
[6821737]240+ PREV="$paco_script"
[059822c]241+fi
242+}
243+
244+
245+#----------------------------------#
246+wrt_paco_prep() { # Export Paco variables
247+#----------------------------------# and remove tmpfile
[d748b31]248+
249+# Not using Paco with uClibc, even if requested
250+if [ $PROGNAME = "hlfs" ]; then
251+ if [ $MODEL = "uclibc" ]; then
[6821737]252+ USE_PACO=0
[d748b31]253+ fi
254+fi
255+
256+if [ $USE_PACO != 0 ] && [ "$vrs" != "" ]; then
[059822c]257+(
258+cat << EOF
259+ @echo "export PACO_INCLUDE=$PACO_INCLUDE" >> envars && \\
260+ echo "export PACO_EXCLUDE=\$(SRC):$JHALFSDIR:$PACO_EXCLUDE" >> envars && \\
261+ echo "export PACO_TMPFILE=$PACO_TMPFILE" >> envars && \\
262+ rm -f \$(MOUNT_PT)$PACO_TMPFILE
263+EOF
264+) >> $MKFILE.tmp
265+fi
266+}
267+
268+
269+#----------------------------------#
270+wrt_paco_log() { # If the tmpfile exist, then log the current package
271+#----------------------------------# and remove tempfile
[d748b31]272+local PACKAGE
273+
274+# Allow packages to be logged without version
275+if [[ $2 != "" ]] ; then
276+ PACKAGE="$1-$2";
277+else
278+ PACKAGE="$1"
279+fi
[059822c]280+
[d748b31]281+# Not using Paco with uClibc, even if requested
282+if [ $PROGNAME = "hlfs" ]; then
283+ if [ $MODEL = "uclibc" ]; then
[6821737]284+ USE_PACO=0
[059822c]285+ fi
[d748b31]286+fi
[059822c]287+
[d748b31]288+if [ $USE_PACO != 0 ] && [ "$vrs" != "" ]; then
[059822c]289+(
290+cat << EOF
291+ @if [ -e \$(MOUNT_PT)$PACO_TMPFILE ]; then \\
292+ \$(CHROOT1) 'paco -lp $PACKAGE < $PACO_TMPFILE' && \\
293+ rm -f \$(MOUNT_PT)$PACO_TMPFILE; \\
294+ fi;
295+EOF
296+) >> $MKFILE.tmp
297+fi
298+}
299+
300+
301+#----------------------------------#
302+wrt_paco_log_blfs() { # If the tmpfile exist, then log the current package
303+#----------------------------------# and remove tempfile
304+if [ $USE_PACO != 0 ] ; then
305+(
306+cat << EOF
307+ @PACKAGE=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
308+ if [ -e $PACO_TMPFILE ]; then \\
[d748b31]309+ paco -lp \$\$PACKAGE < $PACO_TMPFILE && \\
[059822c]310+ rm -f $PACO_TMPFILE; \\
311+ fi;
312+EOF
313+) >> $MKFILE
314+fi
315+}
316+
[6821737]317Index: common/paco-build.sh
318===================================================================
319--- common/paco-build.sh (revision 0)
320+++ common/paco-build.sh (revision 0)
321@@ -0,0 +1,9 @@
322+#!/bin/sh
323+set -e
324+
325+cd $PKGDIR
326+./configure --disable-gpaco \
327+ --sysconfdir=/etc &&
328+make &&
329+make install &&
330+make logme
[059822c]331Index: common/common-functions
332===================================================================
[6821737]333--- common/common-functions (revision 2542)
[059822c]334+++ common/common-functions (working copy)
335@@ -60,6 +60,9 @@
336 in the configuration file has the proper packages and patches for the
337 book version being processed.
338
339+${BOLD} --no-paco${OFF}
340+ dissables paco logging feature.
341+
342 ${BOLD} -T, --testsuites N ${OFF}
343 Run test suites [0-3]
344 0 = none
345@@ -623,6 +626,7 @@
346 --stringparam lc_all $LC_ALL \
347 --stringparam keymap $KEYMAP \
348 --stringparam grsecurity_host $GRSECURITY_HOST \
349+ --stringparam use_paco $USE_PACO \
350 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
351 ;;
352 lfs)
353@@ -634,6 +638,7 @@
354 --stringparam timezone $TIMEZONE \
355 --stringparam page $PAGE \
356 --stringparam lang $LANG \
357+ --stringparam use_paco $USE_PACO \
358 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
359 ;;
360 blfs)
361Index: HLFS/hlfs.xsl
362===================================================================
[6821737]363--- HLFS/hlfs.xsl (revision 2542)
[059822c]364+++ HLFS/hlfs.xsl (working copy)
365@@ -39,6 +39,9 @@
366 <xsl:param name="lang" select="en_CA"/>
367 <xsl:param name="lc_all" select="en_CA"/>
368
369+ <!-- Use paco? -->
370+ <xsl:param name="use_paco" select="1"/>
371+
372 <xsl:template match="/">
373 <xsl:apply-templates select="//sect1"/>
374 </xsl:template>
375@@ -191,6 +194,10 @@
376 <!-- Fixing bootscripts installation -->
377 <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
378 string() = 'make install'">
379+ <!-- inserting LD_PRELOAD before installing bootscripts -->
380+ <xsl:if test="$use_paco != '0' and $model != 'uclibc'">
381+ <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
382+ </xsl:if>
383 <xsl:text>make install&#xA;</xsl:text>
384 <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;&#xA;</xsl:text>
385 </xsl:when>
386@@ -248,6 +255,25 @@
387 <xsl:apply-templates/>
388 <xsl:text> || true&#xA;</xsl:text>
389 </xsl:when>
390+ <!-- paco begin -->
391+ <!-- General rule -->
392+ <xsl:when test="$use_paco != '0' and $model != 'uclibc' and
393+ ancestor::chapter[@id != 'chapter-temporary-tools'] and
394+ contains(string(),'make') and
395+ contains(string(),'install')">
396+ <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
397+ <xsl:apply-templates/>
398+ <xsl:text>&#xA;</xsl:text>
399+ </xsl:when>
400+ <!-- Linux-libc-headers -->
401+ <xsl:when test="$use_paco != '0' and $model != 'uclibc' and
402+ ancestor::sect1[@id='ch-system-linux-libc-headers'] and
403+ contains(string(),'install ')">
404+ <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
405+ <xsl:apply-templates/>
406+ <xsl:text>&#xA;</xsl:text>
407+ </xsl:when>
408+ <!-- paco end -->
409 <!-- The rest of commands -->
410 <xsl:otherwise>
411 <xsl:apply-templates/>
412Index: HLFS/master.sh
413===================================================================
[6821737]414--- HLFS/master.sh (revision 2542)
[059822c]415+++ HLFS/master.sh (working copy)
[6821737]416@@ -318,6 +318,13 @@
417 *) ;;
418 esac
419
420+ # Install paco as the first package in ch6, befire installing linux-libc-headers
421+ case $this_script in
422+ *linux-libc-headers)
423+ PACO_NUM=`echo $this_script | sed -e 's/linux-libc-headers/a-paco/'`
424+ wrt_paco_inst "$PACO_NUM"
425+ esac
426+
427 # First append each name of the script files to a list (this will become
428 # the names of the targets in the Makefile
429 chapter6="$chapter6 $this_script"
430@@ -376,7 +383,9 @@
[059822c]431 wrt_run_as_root "${this_script}" "${file}"
432 ;;
433 *) # The rest of Chapter06
434+ wrt_paco_prep
435 wrt_run_as_chroot1 "${this_script}" "${file}"
436+ wrt_paco_log "$name" "$vrs"
437 ;;
438 esac
439 #
[6821737]440@@ -407,6 +416,14 @@
[059822c]441
442 # Keep the script file name for Makefile dependencies.
443 PREV=$this_script
444+
[6821737]445+ # Reinstall paco after the toolchain has been readjusted.
[059822c]446+ case "${this_script}" in
[6821737]447+ *readjusting)
448+ PACO_NUM=`echo $this_script | sed -e 's/readjusting/x-paco/'`
449+ wrt_paco_inst "$PACO_NUM" ;;
[059822c]450+ esac
451+
452 done # end for file in chapter06/*
453
454 }
[6821737]455@@ -469,6 +486,15 @@
[059822c]456 wrt_run_as_chroot2 "${this_script}" "${file}"
457 fi
458 ;;
459+ *kernel) wrt_paco_prep
460+ wrt_run_as_chroot2 "$this_script" "$file"
461+ version=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
462+ wrt_paco_log "linux-kernel" "$version"
463+ ;;
464+ *bootscripts) wrt_paco_prep
465+ wrt_run_as_chroot2 "$this_script" "$file"
466+ wrt_paco_log "hlfs-bootscripts"
467+ ;;
468 *) # All other scripts
469 wrt_run_as_chroot2 "${this_script}" "${file}"
470 ;;
[d748b31]471Index: master.sh
472===================================================================
[6821737]473--- master.sh (revision 2542)
[d748b31]474+++ master.sh (working copy)
475@@ -66,6 +66,11 @@
476 source $MODULE
477 [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
478 [[ $VERBOSITY > 0 ]] && echo "OK"
479+# Load paco-functions
480+[[ $VERBOSITY > 0 ]] && echo -n "Loading paco module..."
481+source $COMMON_DIR/paco-functions
482+[[ $? > 0 ]] && echo "$COMMON_DIR/paco-functions did not load.." && exit 2
483+[[ $VERBOSITY > 0 ]] && echo "OK"
484 #
485 [[ $VERBOSITY > 0 ]] && echo "---------------${nl_}"
486
487@@ -146,6 +151,8 @@
488
489 --help | -h ) usage | more && exit ;;
490
491+ --no-paco ) USE_PACO=0 ;;
492+
493 --testsuites | -T )
494 test $# = 1 && eval "$exit_missing_arg"
495 shift
496@@ -455,6 +462,15 @@
497
498 if [[ "$PWD" != "$JHALFSDIR" ]]; then
499 cp $COMMON_DIR/makefile-functions $JHALFSDIR/
500+ if [[ $USE_PACO != "0" ]] ; then
501+ if [[ $PROGNAME != "blfs" ]]; then
502+ cp $COMMON_DIR/paco-build.sh $JHALFSDIR/
503+ else
504+ echo -e "export PACO_INCLUDE=$PACO_INCLUDE" > $JHALFSDIR/pacovars
505+ echo -e "export PACO_EXCLUDE=~/sources:$JHALFSDIR:$PACO_EXCLUDE" >> $JHALFSDIR/pacovars
506+ echo -e "export PACO_TMPFILE=$PACO_TMPFILE" >> $JHALFSDIR/pacovars
507+ fi
508+ fi
509 if [[ -n "$FILES" ]]; then
510 # pushd/popd necessary to deal with mulitiple files
511 pushd $PACKAGE_DIR 1> /dev/null
Note: See TracBrowser for help on using the repository browser.