Skip to contentSkip to conversation

gen-lockedsig-cache: catch os.link error

PATCH In review brian avery 2 participants 3 messages Mar 15, 2017 – Mar 17, 2017

lore
Share & tools
lore
#0 lore raw

cover gen-lockedsig-cache: catch os.link error

If your sstate-cache directory is on a different filesystem from the one your build is on, gen-lockedsig-cache fails which causes the esdk creation to fail. This catches the hard link failure and does a copy in those cases.

-brian

The following changes since commit 6e20b31d5d17133e0fca086e12a0ad06ab5c4cc8:

wic: selftest: account for occasional newline in debugfs file names (2017-03-14 14:42:18 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib bavery/gen-sigs-linkfix
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=bavery/gen-sigs-linkfix

brian avery (1):
gen-lockedsig-cache: catch os.link error

 scripts/gen-lockedsig-cache | 6 ++++++
 1 file changed, 6 insertions(+)

--
1.9.1

#1 lore raw

PATCH 1/1 gen-lockedsig-cache: catch os.link error

We do a hard link to speed up sdk creation but if your sstate-cache is across a file system boundary, this tries and fails. This patch catches that error and does a copy instead.

---
 scripts/gen-lockedsig-cache | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/gen-lockedsig-cache +6 -0
index 49de74ed..1cfbeae 100755
@@ -63,6 +63,12 @@ for f in files:
     if (os.stat(src).st_dev == os.stat(destdir).st_dev):
         print('linking')
         os.link(src, dst)
+        try:
+            os.link(src, dst)
+        except Exception:
+            print('hard linking failed, copying')
+            shutil.copyfile(src, dst)
+        os.link(src, dst)
     else:
         print('copying')
         shutil.copyfile(src, dst)
Signature · 1 line
1.9.1
#2 lore raw
Quoted 21 lines · brian avery

We do a hard link to speed up sdk creation but if your sstate-cache is
across a file system boundary, this tries and fails. This patch catches
that error and does a copy instead.

---
 scripts/gen-lockedsig-cache | 6 ++++++

 1 file changed, 6 insertions(+)
scripts/gen-lockedsig- renamed from scripts/gen-lockedsig-cache +0 -0

cache
index 49de74ed..1cfbeae 100755

scripts/gen-lockedsig-cache +0 -0
@@ -63,6 +63,12 @@ for f in files:

     if (os.stat(src).st_dev == os.stat(destdir).st_dev):
         print('linking')
         os.link(src, dst)
+        try:

Quoted 8 lines

+            os.link(src, dst)
+        except Exception:
+            print('hard linking failed, copying') +            shutil.copyfile(src, dst)
+        os.link(src, dst)
     else:
         print('copying') shutil.copyfile(src, dst)

Really? How many os.link() calls do we need?

Also, "Exception" without a specific exception you want to catch tends to be a bad idea.

Cheers,

Richard