[elbe-devel] [PATCH] Fix cp and mv commands in finetuning

Philipp Arras philipp.arras at linutronix.de
Wed Jun 14 12:31:05 CEST 2017


Now finetuning commands like
`<cp path="/usr/lib/u-boot/u*">/boot</cp>`
are supported. Previously, elbe did not understand placeholders like `*`.
---
 elbepack/finetuning.py | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index de19f7e..4e9cd0d 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -114,7 +114,9 @@ class CpAction(FinetuningAction):
         FinetuningAction.__init__(self, node)
 
     def execute(self, log, buildenv, target):
-        log.do( "cp -av " + target.fname( self.node.et.attrib['path'] ) + " " + target.fname( self.node.et.text ) )
+        src = target.glob(self.node.et.attrib['path'])
+        for f in src:
+            log.do("cp -av " + f + " " + target.fname(self.node.et.text))
 
 FinetuningAction.register( CpAction )
 
@@ -126,7 +128,9 @@ class BuildenvCpAction(FinetuningAction):
         FinetuningAction.__init__(self, node)
 
     def execute(self, log, buildenv, target):
-        log.do( "cp -av " + buildenv.rfs.fname( self.node.et.attrib['path'] ) + " " + buildenv.rfs.fname( self.node.et.text ) )
+        src = buildenv.glob(self.node.et.attrib['path'])
+        for f in src:
+            log.do("cp -av " + f + " " + buildenv.rfs.fname(self.node.et.text))
 
 FinetuningAction.register( BuildenvCpAction )
 
@@ -138,7 +142,9 @@ class B2TCpAction(FinetuningAction):
         FinetuningAction.__init__(self, node)
 
     def execute(self, log, buildenv, target):
-        log.do( "cp -av " + buildenv.rfs.fname( self.node.et.attrib['path'] ) + " " + target.fname( self.node.et.text ) )
+        src = buildenv.rfs.glob(self.node.et.attrib['path'])
+        for f in src:
+            log.do("cp -av " + f + " " + target.fname(self.node.et.text))
 
 FinetuningAction.register( B2TCpAction )
 
@@ -150,7 +156,9 @@ class T2BCpAction(FinetuningAction):
         FinetuningAction.__init__(self, node)
 
     def execute(self, log, buildenv, target):
-        log.do( "cp -av " + target.fname( self.node.et.attrib['path'] ) + " " + buildenv.rfs.fname( self.node.et.text ) )
+        src = target.glob(self.node.et.attrib['path'])
+        for f in src:
+            log.do("cp -av " + f + " " + buildenv.rfs.fname(self.node.et.text))
 
 FinetuningAction.register( T2BCpAction )
 
@@ -167,7 +175,10 @@ class T2PMvAction(FinetuningAction):
         else:
             dest = self.node.et.text
         dest = os.path.join ('..', dest)
-        log.do( "mv -v " + target.fname( self.node.et.attrib['path'] ) + " " + dest )
+
+        src = target.glob(self.node.et.attrib['path'])
+        for f in src:
+            log.do("mv -v " + f + " " + dest)
 
 FinetuningAction.register( T2PMvAction )
 
@@ -179,7 +190,9 @@ class MvAction(FinetuningAction):
         FinetuningAction.__init__(self, node)
 
     def execute(self, log, buildenv, target):
-        log.do( "mv -v " + target.fname( self.node.et.attrib['path'] ) + " " + target.fname( self.node.et.text ) )
+        src = target.glob(self.node.et.attrib['path'])
+        for f in src:
+            log.do("mv -v " + f + " " + target.fname(self.node.et.text))
 
 FinetuningAction.register( MvAction )
 
@@ -206,7 +219,9 @@ class BuildenvMvAction(FinetuningAction):
         FinetuningAction.__init__(self, node)
 
     def execute(self, log, buildenv, target):
-        log.do( "mv -v " + buildenv.rfs.fname( self.node.et.attrib['path'] ) + " " + buildenv.rfs.fname( self.node.et.text ) )
+        src = buildenv.rfs.glob(self.node.et.attrib['path'])
+        for f in src:
+            log.do("mv -v " + f + " " + buildenv.rfs.fname(self.node.et.text))
 
 FinetuningAction.register( BuildenvMvAction )
 
-- 
2.1.4





More information about the elbe-devel mailing list