Patchwork [1/1] perl: fix re-execution of patch/configure

login
register
mail settings
Submitter Paul Eggleton
Date April 16, 2012, 4:43 p.m.
Message ID <d019790ba99d06f2f520d26b0f0a862c77353645.1334594354.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/25949/
State Accepted
Commit 19255032e7744fce5cbe466e4869ded378d3b4f5
Headers show

Comments

Paul Eggleton - April 16, 2012, 4:43 p.m.
The perl recipe's do_configure() does some manual sed replacements over
the entire WORKDIR. Fix the following issues with this:

* Skip patches, which fixes re-execution of do_patch after do_configure
  has run once
* Ensure that the replacement operation does nothing if do_configure is
  re-executed
* Avoid unnecessarily modifying /usr/include paths within documentation
  that will end up being packaged
* Fix a quoting issue in the expression used in the grep command that
  ended up causing files that did not contain .*\.h after /usr/include
  to be matched and modified.

The files modified during do_configure have been compared before and
after this patch to ensure there are no unexpected changes. Some
/usr/include paths that are not within documentation are no longer
being substituted however these are all within comments or scripts for
other Unix operating systems that are not applicable.

[YOCTO #2194]

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/recipes-devtools/perl/perl_5.14.2.bb |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Enrico Scholz - April 18, 2012, 3:48 p.m.
Paul Eggleton <paul.eggleton-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
writes:

> -        for foo in `grep -I -m1 \/usr\/include\/.*\\.h ${WORKDIR}/* -r | cut -f 1 -d ":"` ; do
> +        for foo in `grep -I --exclude="*.patch" --exclude="*.diff" --exclude="*.pod" --exclude="README*" -m1 "/usr/include/.*\.h" ${WORKDIR}/* -r -l` ${S}/utils/h2xs.PL ; do

It would be much better to replace the 'grep -r' by 'find -type f ... |
xargs grep'.  'grep -r' is very bad because:

* '-r' is not standardized

* it can return symlinks which might point to read-only locations
  (e.g. patches/config.sh* are such links).  'sed -i' on such files
  can make the build fail.


Enrico

Patch

diff --git a/meta/recipes-devtools/perl/perl_5.14.2.bb b/meta/recipes-devtools/perl/perl_5.14.2.bb
index 8f3ad25..ecb2262 100644
--- a/meta/recipes-devtools/perl/perl_5.14.2.bb
+++ b/meta/recipes-devtools/perl/perl_5.14.2.bb
@@ -7,7 +7,7 @@  LIC_FILES_CHKSUM = "file://Copying;md5=2b4c6ffbcfcbdee469f02565f253d81a \
 # We need gnugrep (for -I)
 DEPENDS = "virtual/db grep-native"
 DEPENDS += "gdbm zlib"
-PR = "r5"
+PR = "r6"
 
 # 5.10.1 has Module::Build built-in
 PROVIDES += "libmodule-build-perl"
@@ -163,9 +163,9 @@  do_configure() {
 			;;
 	esac
         # These are strewn all over the source tree
-        for foo in `grep -I -m1 \/usr\/include\/.*\\.h ${WORKDIR}/* -r | cut -f 1 -d ":"` ; do
+        for foo in `grep -I --exclude="*.patch" --exclude="*.diff" --exclude="*.pod" --exclude="README*" -m1 "/usr/include/.*\.h" ${WORKDIR}/* -r -l` ${S}/utils/h2xs.PL ; do
             echo Fixing: $foo
-            sed -e "s%/usr/include/%${STAGING_INCDIR}/%g" -i $foo
+            sed -e 's|\([ "^'\''I]\+\)/usr/include/|\1${STAGING_INCDIR}/|g' -i $foo
         done
 
         rm -f config