Skip to contentSkip to conversation

Remove invalid sed command

PATCH In review Robert Yang 2 participants 14 messages Jul 10, 2015

lore
Share & tools
lore
#0 lore raw

cover Remove invalid sed command

The sed doesn't return false when miss match, I use a rough wrapper to find out the mis matches:

1) s/sed -i/mysed -i/ in the recipes

  $ find meta -name '*.bbclass' -o -name '*.bb' -o -name '*.inc' -exec sed -i 's/[[:space:]]sed -i/ mysed -i/g' {} \;
2)  Add mysed to tmp/sysroots/x86_64-linux/usr/bin:
#!/bin/sh

for i in "$@"; do

    if [ -e "$i" ]; then
        cp "$i" "$i".sedbak
        /bin/sed "$@"
        num=`diff "$i" "$i".sedbak | wc -l`
        if [ $num -eq 0 ]; then
            echo "`pwd` XXX $@" >>/tmp/nothing_did_sed
        fi  
        rm -f "$i".sedbak
    fi  

done

3) Check /tmp/nothing_did_sed one by one and fix them.

// Robert

The following changes since commit 5a1f80e15d7fb60fd7c2b82aa769adef95d877a9:

libtool: Fix regression from previous commit (2015-07-09 17:58:50 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib rbt/sed
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/sed

Robert Yang (12):
elfutils 0.163: remove do_configure_prepend
opkg: remove do_configure_prepend
glibc-initial: remove invalid sed command
qemu: remove invalid sed command
rpm: remove invalid sed command
mdadm: remove do_configure_prepend
perl: remove invalid sed command
python: remove invalid sed command
python-pygtk: remove invalid sed command
perf: remove invalid sed command
cups: remove invalid sed command
qt4: fixes for sed command

 meta/recipes-core/glibc/glibc-initial.inc          |    2 --
 .../{elfutils => elfutils-0.148}/i386_dis.h        |    0
 .../{elfutils => elfutils-0.148}/x86_64_dis.h      |    0
 meta/recipes-devtools/elfutils/elfutils_0.163.bb   |   10 ----------
 meta/recipes-devtools/opkg/opkg_0.2.4.bb           |    5 -----
 meta/recipes-devtools/perl/perl_5.22.0.bb          |    3 ---
 .../recipes-devtools/python/python-pygtk_2.24.0.bb |   21 --------------------
 meta/recipes-devtools/python/python3_3.4.3.bb      |    2 --
 meta/recipes-devtools/python/python_2.7.9.bb       |    3 ---
 meta/recipes-devtools/qemu/qemu.inc                |   10 ----------
 meta/recipes-devtools/rpm/rpm_5.4+cvs.bb           |    1 -
 meta/recipes-devtools/rpm/rpm_5.4.14.bb            |    1 -
 meta/recipes-extended/cups/cups.inc                |    3 ---
 meta/recipes-extended/mdadm/mdadm_3.3.2.bb         |    5 -----
 meta/recipes-kernel/perf/perf.bb                   |    6 ------
 meta/recipes-qt/qt4/qt4-4.8.7.inc                  |    8 ++------
 meta/recipes-qt/qt4/qt4.inc                        |    3 ---
 17 files changed, 2 insertions(+), 81 deletions(-)
 rename meta/recipes-devtools/elfutils/{elfutils => elfutils-0.148}/i386_dis.h (100%)
 rename meta/recipes-devtools/elfutils/{elfutils => elfutils-0.148}/x86_64_dis.h (100%)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/12 elfutils 0.163: remove do_configure_prepend

It is derived from elfutils 0.148, but 0.162 doesn't need them, it doesn't need i386_dis.h or x86_64_dis.h either, there are the same two files in the source, so move elfutils/i386_dis.h to elfutils-0.148/i386_dis.h and elfutils/x86_64_dis.h to elfutils-0.148/x86_64_dis.h for elfutils 0.148 only.

---
 .../{elfutils => elfutils-0.148}/i386_dis.h        |    0
 .../{elfutils => elfutils-0.148}/x86_64_dis.h      |    0
 meta/recipes-devtools/elfutils/elfutils_0.163.bb   |   10 ----------
 3 files changed, 10 deletions(-)
 rename meta/recipes-devtools/elfutils/{elfutils => elfutils-0.148}/i386_dis.h (100%)
 rename meta/recipes-devtools/elfutils/{elfutils => elfutils-0.148}/x86_64_dis.h (100%)
meta/recipes-devtools/elfutils/elfutils-0.148/i386_dis.h renamed from meta/recipes-devtools/elfutils/elfutils/i386_dis.h +0 -0
similarity index 100%
rename from meta/recipes-devtools/elfutils/elfutils/i386_dis.h
rename to meta/recipes-devtools/elfutils/elfutils-0.148/i386_dis.h
meta/recipes-devtools/elfutils/elfutils-0.148/x86_64_dis.h renamed from meta/recipes-devtools/elfutils/elfutils/x86_64_dis.h +0 -0
similarity index 100%
rename from meta/recipes-devtools/elfutils/elfutils/x86_64_dis.h
rename to meta/recipes-devtools/elfutils/elfutils-0.148/x86_64_dis.h
meta/recipes-devtools/elfutils/elfutils_0.163.bb +0 -10
index b34bfdd..c4fdabd 100644
@@ -42,22 +42,12 @@ SRC_URI_append_libc-uclibc = " file://uclibc-support-for-elfutils-0.161.patch"
 # which can not pass the cross compiling, so let's work around it by adding 2 .h files
 # along with the do_configure_prepend()
 
-SRC_URI += "\
-        file://i386_dis.h \
-        file://x86_64_dis.h \
-"
 inherit autotools gettext
 
 EXTRA_OECONF = "--program-prefix=eu- --without-lzma"
 EXTRA_OECONF_append_class-native = " --without-bzlib"
 EXTRA_OECONF_append_libc-uclibc = " --enable-uclibc"
 
-do_configure_prepend() {
-	sed -i '/^i386_dis.h:/,+4 {/.*/d}' ${S}/libcpu/Makefile.am
-
-	cp ${WORKDIR}/*dis.h ${S}/libcpu
-}
-
 do_install_append() {
 	if [ "${TARGET_ARCH}" != "x86_64" ] && [ -z `echo "${TARGET_ARCH}"|grep 'i.86'` ];then
 		rm ${D}${bindir}/eu-objdump
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/12 opkg: remove do_configure_prepend

In reply to Robert Yang

There is no -Werror in libopkg/Makefile.am any more.

---
 meta/recipes-devtools/opkg/opkg_0.2.4.bb |    5 -----
 1 file changed, 5 deletions(-)
meta/recipes-devtools/opkg/opkg_0.2.4.bb +0 -5
index a9ba037..ec0f923 100644
@@ -41,11 +41,6 @@ EXTRA_OECONF = "\
   --with-opkglibdir=${OPKGLIBDIR} \
 "
 
-# Werror gives all kinds bounds issuses with gcc 4.3.3
-do_configure_prepend() {
-	sed -i -e s:-Werror::g ${S}/libopkg/Makefile.am
-}
-
 do_install_append () {
 	install -d ${D}${sysconfdir}/opkg
 	install -m 0644 ${WORKDIR}/opkg.conf ${D}${sysconfdir}/opkg/opkg.conf
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/12 glibc-initial: remove invalid sed command

In reply to Robert Yang

There is no "{ (exit 1); exit 1; }; }" in configure any more, and also remove chmod since sed command is removed.

---
 meta/recipes-core/glibc/glibc-initial.inc |    2 --
 1 file changed, 2 deletions(-)
meta/recipes-core/glibc/glibc-initial.inc +0 -2
index 7db3dea..3500848 100644
@@ -9,8 +9,6 @@ STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
 TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
 
 do_configure () {
-	sed -ie 's,{ (exit 1); exit 1; }; },{ (exit 0); }; },g' ${S}/configure
-	chmod +x ${S}/configure
 	(cd ${S} && gnu-configize) || die "failure in running gnu-configize"
 	find ${S} -name "configure" | xargs touch
 	${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/12 qemu: remove invalid sed command

In reply to Robert Yang

The sed command was used for editting to code added by linker-flags.patch, but the patch had been gone in 2013, and verified that there is no -lX11 in Makefile.target, so remove the sed command.

---
 meta/recipes-devtools/qemu/qemu.inc |   10 ----------
 1 file changed, 10 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +0 -10
index ca94fb2..d794af9 100644
@@ -37,16 +37,6 @@ do_configure_prepend_class-native() {
 	if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
 		export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
 	fi
-
-	# Undo the -lX11 added by linker-flags.patch, don't assume that host has libX11 installed
-	sed -i 's/-lX11//g' ${S}/Makefile.target
-}
-
-do_configure_prepend_class-nativesdk() {
-	if [ "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}" = "" ] ; then
-		# Undo the -lX11 added by linker-flags.patch
-		sed -i 's/-lX11//g' ${S}/Makefile.target
-	fi
 }
 
 KVMENABLE = "--enable-kvm"
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/12 rpm: remove invalid sed command

In reply to Robert Yang

There is no __check_files in rpm/macros any more, so remove the sed command.

---
 meta/recipes-devtools/rpm/rpm_5.4+cvs.bb |    1 -
 meta/recipes-devtools/rpm/rpm_5.4.14.bb  |    1 -
 2 files changed, 2 deletions(-)
meta/recipes-devtools/rpm/rpm_5.4+cvs.bb +0 -1
index a85e28f..8903f3b 100644
@@ -411,7 +411,6 @@ do_configure() {
 }
 
 do_install_append() {
-	sed -i -e 's,%__check_files,#%%__check_files,' ${D}/${libdir}/rpm/macros
 	sed -i -e 's,%__scriptlet_requires,#%%__scriptlet_requires,' ${D}/${libdir}/rpm/macros
 	sed -i -e 's,%__perl_provides,#%%__perl_provides,' ${D}/${libdir}/rpm/macros ${D}/${libdir}/rpm/macros.d/*
 	sed -i -e 's,%__perl_requires,#%%__perl_requires,' ${D}/${libdir}/rpm/macros ${D}/${libdir}/rpm/macros.d/*
meta/recipes-devtools/rpm/rpm_5.4.14.bb +0 -1
index bff0687..ddbdcb9 100644
@@ -396,7 +396,6 @@ do_configure() {
 }
 
 do_install_append() {
-	sed -i -e 's,%__check_files,#%%__check_files,' ${D}/${libdir}/rpm/macros
 	sed -i -e 's,%__scriptlet_requires,#%%__scriptlet_requires,' ${D}/${libdir}/rpm/macros
 	sed -i -e 's,%__perl_provides,#%%__perl_provides,' ${D}/${libdir}/rpm/macros ${D}/${libdir}/rpm/macros.d/*
 	sed -i -e 's,%__perl_requires,#%%__perl_requires,' ${D}/${libdir}/rpm/macros ${D}/${libdir}/rpm/macros.d/*
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 6/12 mdadm: remove do_configure_prepend

In reply to Robert Yang

There is no '.*ansidecl.h.*/d' in sha1.h any more.

---
 meta/recipes-extended/mdadm/mdadm_3.3.2.bb |    5 -----
 1 file changed, 5 deletions(-)
meta/recipes-extended/mdadm/mdadm_3.3.2.bb +0 -5
index 87e06f5..b2fbe4a 100644
@@ -23,11 +23,6 @@ CFLAGS += "-fno-strict-aliasing"
 
 inherit autotools-brokensep
 
-# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header
-do_configure_prepend () {
-	sed -i -e '/.*ansidecl.h.*/d' ${S}/sha1.h
-}
-
 EXTRA_OEMAKE = "CHECK_RUN_DIR=0"
 # PPC64 and MIPS64 uses long long for u64 in the kernel, but powerpc's asm/types.h
 # prevents 64-bit userland from seeing this definition, instead defaulting
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 7/12 perl: remove invalid sed command

In reply to Robert Yang

There is no match of sed pattern any more.

---
 meta/recipes-devtools/perl/perl_5.22.0.bb |    3 ---
 1 file changed, 3 deletions(-)
meta/recipes-devtools/perl/perl_5.22.0.bb +0 -3
index 050a98c..f72afa7 100644
@@ -211,9 +211,6 @@ do_configure() {
 
 do_compile() {
         # Fix to avoid recursive substitution of path
-        sed -i -e "s|\([ \"\']\+\)/usr/include|\1${STAGING_INCDIR}|g" ext/Errno/Errno_pm.PL
-        sed -i -e "s|\([ \"\']\+\)/usr/include|\1${STAGING_INCDIR}|g" cpan/Compress-Raw-Zlib/config.in
-        sed -i -e 's|/usr/lib|""|g' cpan/Compress-Raw-Zlib/config.in
         sed -i -e 's|(@libpath, ".*"|(@libpath, "${STAGING_LIBDIR}"|g' cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
 
         cd Cross
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 8/12 python: remove invalid sed command

In reply to Robert Yang

There is no ccache in Makefile any more.

---
 meta/recipes-devtools/python/python3_3.4.3.bb |    2 --
 meta/recipes-devtools/python/python_2.7.9.bb  |    3 ---
 2 files changed, 5 deletions(-)
meta/recipes-devtools/python/python3_3.4.3.bb +0 -2
index 7eb99b1..3efa7de 100644
@@ -92,8 +92,6 @@ do_compile() {
         sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
         cd -
 
-	# remove hardcoded ccache, see http://bugs.openembedded.net/show_bug.cgi?id=4144
-	sed -i -e s,ccache\ ,'$(CCACHE) ', Makefile
 
 	# remove any bogus LD_LIBRARY_PATH
 	sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
meta/recipes-devtools/python/python_2.7.9.bb +0 -3
index 7918550..19190c3 100644
@@ -59,9 +59,6 @@ do_compile() {
         sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
         cd -
 
-	# remove hardcoded ccache, see http://bugs.openembedded.net/show_bug.cgi?id=4144
-	sed -i -e s,ccache\ ,'$(CCACHE) ', Makefile
-
 	# remove any bogus LD_LIBRARY_PATH
 	sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
 
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 9/12 python-pygtk: remove invalid sed command

In reply to Robert Yang

* There is no 'tests docs' in Makefile.am any more, so remove:

    sed -i 's:tests docs:tests:' ${S}/Makefile.am

* Remove the invalid sed command in do_install_append, only the one for pygtk-demo is needed.

---
 .../recipes-devtools/python/python-pygtk_2.24.0.bb |   21 --------------------
 1 file changed, 21 deletions(-)
meta/recipes-devtools/python/python-pygtk_2.24.0.bb +0 -21
index 053f37f..e4c33a8 100644
@@ -37,31 +37,10 @@ do_configure_prepend() {
 		-e s:'`$PKG_CONFIG --variable codegendir pygobject-2.0`':\"${STAGING_DATADIR}/pygobject/2.0/codegen\":g \
 		-e s:'`$PKG_CONFIG --variable=fixxref pygobject-2.0`':\"${STAGING_DATADIR}/pygobject/xsl/fixxref.py\":g \
 		${S}/configure.ac
-	sed -i 's:tests docs:tests:' ${S}/Makefile.am
 }
 
 # dirty fix #2: fix build system paths leaking in
 do_install_append() {
-        for i in `find ${D} -name "*.py"` ; do \
-            sed -i -e s:${D}::g $i
-        done
-
-        for i in `find ${D} -name "*.la"` ; do \
-            sed -i -e s:${STAGING_LIBDIR}:${libdir}:g $i
-        done
-        
-        if test -e ${D}${bindir} ; then
-            for i in ${D}${bindir}/* ; do \
-                sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
-            done
-        fi
-
-        if test -e ${D}${sbindir} ; then
-            for i in ${D}${sbindir}/* ; do \
-                sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
-            done
-        fi
-
 	sed -i -e '1s|^#!.*python|#!/usr/bin/env python|' ${D}${bindir}/pygtk-demo
 }
 
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 10/12 perf: remove invalid sed command

In reply to Robert Yang

The current kernel supports WERROR now, and there is no Werror in tools/perf/Makefile, remove both sed commands.

---
 meta/recipes-kernel/perf/perf.bb |    6 ------
 1 file changed, 6 deletions(-)
meta/recipes-kernel/perf/perf.bb +0 -6
index eb27374..0cadcdc 100644
@@ -120,12 +120,6 @@ do_configure_prepend () {
     rm -rf ${B}/
     mkdir ${B}/
 
-    #kernels before 3.1 do not support WERROR env variable
-    sed -i 's,-Werror ,,' ${S}/tools/perf/Makefile
-    if [ -e "${S}/tools/perf/config/Makefile" ]; then
-        sed -i 's,-Werror ,,' ${S}/tools/perf/config/Makefile
-    fi
-
     # If building a multlib based perf, the incorrect library path will be
     # detected by perf, since it triggers via: ifeq ($(ARCH),x86_64). In a 32 bit
     # build, with a 64 bit multilib, the arch won't match and the detection of a 
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH 11/12 cups: remove invalid sed command

In reply to Robert Yang

There is no STRIP in Makedefs, no serial in backend/Makefile either, so remove the sed commands.

---
 meta/recipes-extended/cups/cups.inc |    3 ---
 1 file changed, 3 deletions(-)
meta/recipes-extended/cups/cups.inc +0 -3
index ba50296..57cdf26 100644
@@ -46,9 +46,6 @@ EXTRA_OECONF = " \
 EXTRA_AUTORECONF += "--exclude=autoheader"
 
 do_compile () {
-	sed -i s:STRIP:NOSTRIP: Makedefs
-	sed -i s:serial:: backend/Makefile
-
 	echo "all:"    >  man/Makefile
 	echo "libs:" >> man/Makefile
 	echo "install:" >> man/Makefile
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 12/12 qt4: fixes for sed command

In reply to Robert Yang

* There is no $$QT_BUILD_TREE/bin/lrelease in any .pro file, so remove the sed command.
* Only translations/translations.pro has "qtPrepareTool(LRELEASE", so use the file name directly rather than find all the .pro files.
* The SEDME in linux.conf had been gone in 2010, and no '-Wl,-rpath-link' in linux.conf either, so remove the sed commands.

---
 meta/recipes-qt/qt4/qt4-4.8.7.inc |    8 ++------
 meta/recipes-qt/qt4/qt4.inc       |    3 ---
 2 files changed, 2 insertions(+), 9 deletions(-)
meta/recipes-qt/qt4/qt4-4.8.7.inc +2 -6
index 67fad3a..5257e76 100644
@@ -52,13 +52,9 @@ FILES_${QT_BASE_NAME}-tests-dbg        = "${prefix}/tests/qt4/*/.debug"
 FILES_${QT_BASE_NAME}-tests            = "${prefix}/tests/qt4/*"
 
 do_configure_prepend() {
-    for pro in $(find ${S} -name "*.pro") ; do
-        sed -i \
-            -e 's:$$QT_BUILD_TREE/bin/lrelease:${OE_QMAKE_LRELEASE}:g' \
-            -e 's:qtPrepareTool(LRELEASE, lrelease):LRELEASE = ${OE_QMAKE_LRELEASE}:g' $pro
-    done
+    sed -i 's:qtPrepareTool(LRELEASE, lrelease):LRELEASE = ${OE_QMAKE_LRELEASE}:g' \
+        ${S}/translations/translations.pro
 
-    sed -i s:SEDME:${S}: ${WORKDIR}/linux.conf
     sed -i \
     -e /QMAKE_MOC\ /d \
     -e /QMAKE_UIC\ /d \
meta/recipes-qt/qt4/qt4.inc +0 -3
index f1c792b..2058e54 100644
@@ -350,9 +350,6 @@ do_install() {
 			-e 's#-ljscore##g' \
 			${D}${libdir}/*.la ${D}${libdir}/*.prl ${D}${libdir}/pkgconfig/*.pc
 
-	sed -i -e s#" -Wl,-rpath-link,${S}/lib"##g \
-			${D}${datadir}/${QT_DIR_NAME}/mkspecs/common/linux.conf
-
 	# fix pkgconfig files
 	sed -i -e s#"moc_location=.*$"#"moc_location=${bindir}/moc4"# \
 			-e s#"uic_location=.*$"#"uic_location=${bindir}/uic4"# \
Signature · 1 line
1.7.9.5
#13 lore raw
In reply to Robert Yang
Quoted 19 lines · Robert Yang

The sed doesn't return false when miss match, I use a rough wrapper to find out the mis matches:

1) s/sed -i/mysed -i/ in the recipes

  $ find meta -name '*.bbclass' -o -name '*.bb' -o -name '*.inc' -exec sed
-i 's/[[:space:]]sed -i/ mysed -i/g' {} \;
2)  Add mysed to tmp/sysroots/x86_64-linux/usr/bin:
#!/bin/sh

for i in "$@"; do

    if [ -e "$i" ]; then
        cp "$i" "$i".sedbak
        /bin/sed "$@"
        num=`diff "$i" "$i".sedbak | wc -l`
        if [ $num -eq 0 ]; then
            echo "`pwd` XXX $@" >>/tmp/nothing_did_sed
        fi
        rm -f "$i".sedbak
    fi
Quoted 4 lines

done

3) Check /tmp/nothing_did_sed one by one and fix them.

Nicely done.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics