Skip to contentSkip to conversation

src_distribute_local.bbclass: add an error message and exit if a file is not found

PATCH In review Frans Meulenbroeks 1 participant 3 messages Aug 12, 2010 – Sep 2, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 src_distribute_local.bbclass: add an error message and exit if a file is not found

When a file was not found do_distribute_local would still continue. This patch adds an error message and terminates do_distribute_local

---
 classes/src_distribute_local.bbclass |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)
classes/src_distribute_local.bbclass +23 -5
index 7b1e7d7..bdf03e9 100644
@@ -7,21 +7,39 @@ SRC_DISTRIBUTECOMMAND[dirs] = "${SRC_DISTRIBUTEDIR}/${LIC}/${PN}"
 # symlinks the files to the SRC_DISTRIBUTEDIR
 SRC_DISTRIBUTECOMMAND-symlink () {
     test -e "${SRC}.md5" && ln -sf "${SRC}.md5" .
-    ln -sf "${SRC}" .
+    if test -e {SRC}
+    then
+        ln -sf "${SRC}" .
+    else
+    	echo "File does not exist:" ${SRC}
+	exit 1
+    fi
 }
 
 # copies the files to the SRC_DISTRIBUTEDIR
 SRC_DISTRIBUTECOMMAND-copy () {
     test -e "${SRC}.md5" && cp -f "${SRC}.md5" .
-    cp -fr "${SRC}" .
+    if test -e {SRC}
+    then
+        cp -fr "${SRC}" .
+    else
+    	echo "File does not exist:" ${SRC}
+	exit 1
+    fi
 }
 
 # moves the files to the SRC_DISTRIBUTEDIR and symlinks them back
 SRC_DISTRIBUTECOMMAND-move+symlink () {
     if ! [ -L ${SRC} ]; then
-        src=`basename "${SRC}"`
-        mv ${SRC} .
-        ln -sf $src "${SRC}"
+        if test -e {SRC}
+        then
+            src=`basename "${SRC}"`
+            mv ${SRC} .
+            ln -sf $src "${SRC}"
+        else
+    	    echo "File does not exist:" ${SRC}
+	    exit 1
+        fi
         if [ -e ${SRC}.md5 ]; then
             mv ${SRC}.md5 .
             ln -sf $src "${SRC}.md5"
Signature · 1 line
1.6.4.2
#1 lore raw

2010/8/12 Frans Meulenbroeks <[email protected]>:

Quoted 50 lines

When a file was not found do_distribute_local would still continue. This patch adds an error message and terminates do_distribute_local

---
 classes/src_distribute_local.bbclass |   28 +++++++++++++++++++++++-----

 1 files changed, 23 insertions(+), 5 deletions(-)
classes/src_distribute_local.bbclass +0 -0
index 7b1e7d7..bdf03e9 100644
@@ -7,21 +7,39 @@ SRC_DISTRIBUTECOMMAND[dirs] = "${SRC_DISTRIBUTEDIR}/${LIC}/${PN}"
  # symlinks the files to the SRC_DISTRIBUTEDIR
  SRC_DISTRIBUTECOMMAND-symlink () {

    test -e "${SRC}.md5" && ln -sf "${SRC}.md5" .
-    ln -sf "${SRC}" .
+    if test -e {SRC}
+    then
+        ln -sf "${SRC}" .
+    else
+       echo "File does not exist:" ${SRC}
+       exit 1
+    fi
 }

 # copies the files to the SRC_DISTRIBUTEDIR
 SRC_DISTRIBUTECOMMAND-copy () {
    test -e "${SRC}.md5" && cp -f "${SRC}.md5" .
-    cp -fr "${SRC}" .
+    if test -e {SRC}
+    then
+        cp -fr "${SRC}" .
+    else
+       echo "File does not exist:" ${SRC}
+       exit 1
+    fi
 }
 # moves the files to the SRC_DISTRIBUTEDIR and symlinks them back
 SRC_DISTRIBUTECOMMAND-move+symlink () {
    if ! [ -L ${SRC} ]; then
-        src=`basename "${SRC}"`
-        mv ${SRC} .
-        ln -sf $src "${SRC}"
+        if test -e {SRC}
+        then
+            src=`basename "${SRC}"`
+            mv ${SRC} .
+            ln -sf $src "${SRC}"
Quoted 8 lines
+        else
+           echo "File does not exist:" ${SRC}
+           exit 1
+        fi
        if [ -e ${SRC}.md5 ]; then
            mv ${SRC}.md5 .
            ln -sf $src "${SRC}.md5"
--

This has been in review for a week & no comments. Unless someone reacts soon, I'm going to push this.

Frans.

#2 lore raw

Bump

2010/8/19 Frans Meulenbroeks <[email protected]>:

Quoted 65 lines

2010/8/12 Frans Meulenbroeks <[email protected]>:

Quoted 50 lines

When a file was not found do_distribute_local would still continue. This patch adds an error message and terminates do_distribute_local

---
 classes/src_distribute_local.bbclass |   28 +++++++++++++++++++++++-----

 1 files changed, 23 insertions(+), 5 deletions(-)
classes/src_distribute_local.bbclass +0 -0
index 7b1e7d7..bdf03e9 100644
@@ -7,21 +7,39 @@ SRC_DISTRIBUTECOMMAND[dirs] = "${SRC_DISTRIBUTEDIR}/${LIC}/${PN}"
  # symlinks the files to the SRC_DISTRIBUTEDIR
  SRC_DISTRIBUTECOMMAND-symlink () {

    test -e "${SRC}.md5" && ln -sf "${SRC}.md5" .
-    ln -sf "${SRC}" .
+    if test -e {SRC}
+    then
+        ln -sf "${SRC}" .
+    else
+       echo "File does not exist:" ${SRC}
+       exit 1
+    fi
 }

 # copies the files to the SRC_DISTRIBUTEDIR
 SRC_DISTRIBUTECOMMAND-copy () {
    test -e "${SRC}.md5" && cp -f "${SRC}.md5" .
-    cp -fr "${SRC}" .
+    if test -e {SRC}
+    then
+        cp -fr "${SRC}" .
+    else
+       echo "File does not exist:" ${SRC}
+       exit 1
+    fi
 }
 # moves the files to the SRC_DISTRIBUTEDIR and symlinks them back
 SRC_DISTRIBUTECOMMAND-move+symlink () {
    if ! [ -L ${SRC} ]; then
-        src=`basename "${SRC}"`
-        mv ${SRC} .
-        ln -sf $src "${SRC}"
+        if test -e {SRC}
+        then
+            src=`basename "${SRC}"`
+            mv ${SRC} .
+            ln -sf $src "${SRC}"
Quoted 8 lines
+        else
+           echo "File does not exist:" ${SRC}
+           exit 1
+        fi
        if [ -e ${SRC}.md5 ]; then
            mv ${SRC}.md5 .
            ln -sf $src "${SRC}.md5"
--

This has been in review for a week & no comments. Unless someone reacts soon, I'm going to push this.

Frans.