lib/oe/patch: Use force option when creating symlinks to patches

Submitted by Richard Purdie on Dec. 14, 2012, 5:21 p.m.

Details

Message ID 1355505665.32519.29.camel@ted
State Accepted
Commit e651c1a109cb5d480e32354cdaa81f86032f71dd
Headers show

Commit Message

Richard Purdie Dec. 14, 2012, 5:21 p.m.
Under the scenario where you have an existing source tree and you then
change one of the patches, maybe to be architecture or machine specific,
then rebuild, the build will fail since the symlink already exists
but should now point at a different file.

The easiest fix is to tell the system to remove and recreate the link
which is done with the force option.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---

Patch hide | download patch | download mbox

diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index bc86bb5..7ab74fa 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -278,7 +278,7 @@  class QuiltTree(PatchSet):
         if not self.initialized:
             self.InitFromDir()
         PatchSet.Import(self, patch, force)
-        oe.path.symlink(patch["file"], self._quiltpatchpath(patch["file"]))
+        oe.path.symlink(patch["file"], self._quiltpatchpath(patch["file"]), force=True)
         f = open(os.path.join(self.dir, "patches","series"), "a");
         f.write(os.path.basename(patch["file"]) + " -p" + patch["strippath"]+"\n")
         f.close()

Comments

Saul Wold Dec. 14, 2012, 5:33 p.m.
On 12/14/2012 09:21 AM, Richard Purdie wrote:
> Under the scenario where you have an existing source tree and you then
> change one of the patches, maybe to be architecture or machine specific,
> then rebuild, the build will fail since the symlink already exists
> but should now point at a different file.
>
> The easiest fix is to tell the system to remove and recreate the link
> which is done with the force option.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Acked-by: Saul Wold <sgw@linux.intel.com>

> ---
> diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
> index bc86bb5..7ab74fa 100644
> --- a/meta/lib/oe/patch.py
> +++ b/meta/lib/oe/patch.py
> @@ -278,7 +278,7 @@ class QuiltTree(PatchSet):
>           if not self.initialized:
>               self.InitFromDir()
>           PatchSet.Import(self, patch, force)
> -        oe.path.symlink(patch["file"], self._quiltpatchpath(patch["file"]))
> +        oe.path.symlink(patch["file"], self._quiltpatchpath(patch["file"]), force=True)
>           f = open(os.path.join(self.dir, "patches","series"), "a");
>           f.write(os.path.basename(patch["file"]) + " -p" + patch["strippath"]+"\n")
>           f.close()
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
>