Skip to contentSkip to conversation

infra: fix autotools .la fixing when no .la files are present

PATCH Superseded Thomas De Schampheleire 3 participants 5 messages Jul 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 infra: fix autotools .la fixing when no .la files are present

Commit 6f638ea9c9c7bacc646430a74ad3dd2740eae676 ("infra: /usr support:
STAGING_DIR can be outside BASE_DIR") changed a for-construct around 'sed -i' in a 'find | xargs sed -i'. However, if the find returns no results, sed complains with:
'/bin/sed: no input files'

This commit adds the extra parameter -r / --no-run-if-empty to the xargs call, effectively fixing this problem case.

---
 package/pkg-autotools.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
package/pkg-autotools.mk +1 -1
diff -r c8ed6565ea09 -r bb03ffeaa528 package/pkg-autotools.mk
@@ -281,7 +281,7 @@
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_STAGING_OPT) -C $$($$(PKG)_SRCDIR)
-	find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs \
+	find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \
 		$$(SED) "s:$$(BASE_DIR):@BASE_DIR@:g" \
 			-e "s:$$(STAGING_DIR):@STAGING_DIR@:g" \
 			-e "s:\(['= ]\)/usr:\\1 at STAGING_DIR@/usr:g" \
#1 lore raw

PATCH v2 1/1 infra: fix autotools .la fixing when no .la files are present

All,

Quoted 21 lines · Thomas De Schampheleire

Commit 6f638ea9c9c7bacc646430a74ad3dd2740eae676 ("infra: /usr support:
STAGING_DIR can be outside BASE_DIR") changed a for-construct around 'sed -i' in a 'find | xargs sed -i'. However, if the find returns no results, sed complains with:
'/bin/sed: no input files'

This commit adds the extra parameter -r / --no-run-if-empty to the xargs call, effectively fixing this problem case.

---
 package/pkg-autotools.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff -r c8ed6565ea09 -r bb03ffeaa528 package/pkg-autotools.mk

package/pkg-autotools.mk Sun Jul 06 16:19:04 2014 +0200 line 287

Quoted 8 lines
package/pkg-autotools.mk Sun Jul 06 16:19:04 2014 +0200 renamed from package/pkg-autotools.mk Thu Jul 03 12:35:57 2014 +0300 +1 -1
@@ -281,7 +281,7 @@
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
        $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_STAGING_OPT) -C $$($$(PKG)_SRCDIR)
-       find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs \
+       find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \
                $$(SED) "s:$$(BASE_DIR):@BASE_DIR@:g" \
                        -e "s:$$(STAGING_DIR):@STAGING_DIR@:g" \
                        -e "s:\(['= ]\)/usr:\\1 at STAGING_DIR@/usr:g" \

Note that I chose for the xargs solution here. Do you prefer the xargs-like find solution instead?
find DIR PREDICATES -exec commands +

Let me know,

Thanks,
Thomas

#3 lore raw

PATCH v2 1/1 infra: fix autotools .la fixing when no .la files are present

In reply to Thomas De Schampheleire

Thomas, All,

On 2014-07-06 17:10 +0200, Thomas De Schampheleire spake thusly:

Quoted 6 lines

Commit 6f638ea9c9c7bacc646430a74ad3dd2740eae676 ("infra: /usr support:
STAGING_DIR can be outside BASE_DIR") changed a for-construct around 'sed -i' in a 'find | xargs sed -i'. However, if the find returns no results, sed complains with:
'/bin/sed: no input files'

Quoted 6 lines

This commit adds the extra parameter -r / --no-run-if-empty to the xargs call, effectively fixing this problem case.

Regards,
Yann E. MORIN.

Quoted 16 lines
---
 package/pkg-autotools.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff -r c8ed6565ea09 -r bb03ffeaa528 package/pkg-autotools.mk

package/pkg-autotools.mk +1 -1
@@ -281,7 +281,7 @@
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_STAGING_OPT) -C $$($$(PKG)_SRCDIR)
-	find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs \
+	find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \
 		$$(SED) "s:$$(BASE_DIR):@BASE_DIR@:g" \
 			-e "s:$$(STAGING_DIR):@STAGING_DIR@:g" \
 			-e "s:\(['= ]\)/usr:\\1 at STAGING_DIR@/usr:g" \
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v2 1/1 infra: fix autotools .la fixing when no .la files are present

In reply to Thomas De Schampheleire

Thomas, All,

On 2014-07-06 17:21 +0200, Thomas De Schampheleire spake thusly:

Quoted 19 lines
Quoted 17 lines · Thomas De Schampheleire

Commit 6f638ea9c9c7bacc646430a74ad3dd2740eae676 ("infra: /usr support:
STAGING_DIR can be outside BASE_DIR") changed a for-construct around 'sed -i' in a 'find | xargs sed -i'. However, if the find returns no results, sed complains with:
'/bin/sed: no input files'

This commit adds the extra parameter -r / --no-run-if-empty to the xargs call, effectively fixing this problem case.

---
 package/pkg-autotools.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 16 lines

package/pkg-autotools.mk Sun Jul 06 16:19:04 2014 +0200 line 287

Quoted 12 lines

diff -r c8ed6565ea09 -r bb03ffeaa528 package/pkg-autotools.mk

package/pkg-autotools.mk Sun Jul 06 16:19:04 2014 +0200 renamed from package/pkg-autotools.mk Thu Jul 03 12:35:57 2014 +0300 +1 -1
@@ -281,7 +281,7 @@
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
        $$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_STAGING_OPT) -C $$($$(PKG)_SRCDIR)
-       find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs \
+       find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \
                $$(SED) "s:$$(BASE_DIR):@BASE_DIR@:g" \
                        -e "s:$$(STAGING_DIR):@STAGING_DIR@:g" \
                        -e "s:\(['= ]\)/usr:\\1 at STAGING_DIR@/usr:g" \

Note that I chose for the xargs solution here. Do you prefer the xargs-like find solution instead?
find DIR PREDICATES -exec commands +

As I said on IRC, I'm fine with the xargs solution.

If people are more accustomed to using 'find |xargs' rather than using 'find -exec {} +', then no problem.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH v2 1/1 infra: fix autotools .la fixing when no .la files are present

In reply to Thomas De Schampheleire
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

Commit 6f638ea9c9c7bacc646430a74ad3dd2740eae676 ("infra: /usr support:
STAGING_DIR can be outside BASE_DIR") changed a for-construct around 'sed -i' in a 'find | xargs sed -i'. However, if the find returns no results, sed complains with:
'/bin/sed: no input files'

Quoted 6 lines

This commit adds the extra parameter -r / --no-run-if-empty to the xargs call, effectively fixing this problem case.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard