Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: [PATCH] scripts/cp-noerror: Add a special copy function to fix autotools issues
Date: Tue, 29 May 2012 13:28:48 +0100	[thread overview]
Message-ID: <1338294528.20169.102.camel@ted> (raw)

Currently we copy the aclocal directory to the build so that autotools
doesn't see .m4 files disappear when its processing them. This can happen
if for example, package X is being rebuilt at the same time as Y and it
gets uninstalled from sstate (assuming there are no dependencies between
X and Y). This code making the copy was added to avoid races but introduces
a race of its own, namely that the files can disappear during the copy.

This patch adds a cp-noerror script which silently ignores such errors
and gives the behaviour we need in this case. It hence fixes issues which
crop up for users and the autobuilder occasionally.

[YOCTO #2485]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index 941c06d..9b36f3c 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -124,10 +124,9 @@ autotools_do_configure() {
 			# uninstalling data from the sysroot. See Yocto #861 for details.
 			# We avoid this by taking a copy here and then files cannot disappear.
 			if [ -d ${STAGING_DATADIR}/aclocal ]; then
-				mkdir -p ${B}/aclocal-copy/
 				# for scratch build this directory can be empty
 				# so avoid cp's no files to copy error
-				cp -r ${STAGING_DATADIR}/aclocal/. ${B}/aclocal-copy/
+				cp-noerror ${STAGING_DATADIR}/aclocal ${B}/aclocal-copy/
 				acpaths="$acpaths -I ${B}/aclocal-copy/"
 			fi
 			# autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
diff --git a/scripts/cp-noerror b/scripts/cp-noerror
new file mode 100755
index 0000000..fdb3d2d
--- a/dev/null
+++ b/scripts/cp-noerror
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+#
+# Allow copying of $1 to $2 but if files in $1 disappear during the copy operation,
+# don't error.
+#
+
+import sys
+import shutil
+
+try:
+    shutil.copytree(sys.argv[1], sys.argv[2])
+except shutil.Error:
+   pass
+
+





                 reply	other threads:[~2012-05-29 12:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338294528.20169.102.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox