summaryrefslogtreecommitdiff
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-10-30 11:46:19 +0000
committerRichard Purdie <richard@openedhand.com>2007-10-30 11:46:19 +0000
commitc9be325eb9b3140dad277bfda03a34e7b2cf7fdb (patch)
treecd02f283bf72bbc2cb075c4cb3734efe654596d2 /bitbake
parent03446930ef7a5e87f4bfa14cf46146e359dec59a (diff)
downloadopenembedded-core-c9be325eb9b3140dad277bfda03a34e7b2cf7fdb.tar.gz
openembedded-core-c9be325eb9b3140dad277bfda03a34e7b2cf7fdb.tar.bz2
openembedded-core-c9be325eb9b3140dad277bfda03a34e7b2cf7fdb.zip
bitbake: Sync with upstream
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3040 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/__init__.py91
-rw-r--r--bitbake/lib/bb/taskdata.py6
2 files changed, 80 insertions, 17 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index 0460c96ff4..6179ef9a1c 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -155,8 +155,7 @@ def movefile(src,dest,newmtime=None,sstat=None):
if not sstat:
sstat=os.lstat(src)
except Exception, e:
- print "!!! Stating source file failed... movefile()"
- print "!!!",e
+ print "movefile: Stating source file failed...", e
return None
destexists=1
@@ -180,13 +179,11 @@ def movefile(src,dest,newmtime=None,sstat=None):
if destexists and not stat.S_ISDIR(dstat[stat.ST_MODE]):
os.unlink(dest)
os.symlink(target,dest)
-# os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+ #os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
os.unlink(src)
return os.lstat(dest)
except Exception, e:
- print "!!! failed to properly create symlink:"
- print "!!!",dest,"->",target
- print "!!!",e
+ print "movefile: failed to properly create symlink:", dest, "->", target, e
return None
renamefailed=1
@@ -198,8 +195,7 @@ def movefile(src,dest,newmtime=None,sstat=None):
import errno
if e[0]!=errno.EXDEV:
# Some random error.
- print "!!! Failed to move",src,"to",dest
- print "!!!",e
+ print "movefile: Failed to move", src, "to", dest, e
return None
# Invalid cross-device-link 'bind' mounted or actually Cross-Device
@@ -211,16 +207,13 @@ def movefile(src,dest,newmtime=None,sstat=None):
os.rename(dest+"#new",dest)
didcopy=1
except Exception, e:
- print '!!! copy',src,'->',dest,'failed.'
- print "!!!",e
+ print 'movefile: copy', src, '->', dest, 'failed.', e
return None
else:
#we don't yet handle special, so we need to fall back to /bin/mv
a=getstatusoutput("/bin/mv -f "+"'"+src+"' '"+dest+"'")
if a[0]!=0:
- print "!!! Failed to move special file:"
- print "!!! '"+src+"' to '"+dest+"'"
- print "!!!",a
+ print "movefile: Failed to move special file:" + src + "' to '" + dest + "'", a
return None # failure
try:
if didcopy:
@@ -228,9 +221,7 @@ def movefile(src,dest,newmtime=None,sstat=None):
os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
os.unlink(src)
except Exception, e:
- print "!!! Failed to chown/chmod/unlink in movefile()"
- print "!!!",dest
- print "!!!",e
+ print "movefile: Failed to chown/chmod/unlink", dest, e
return None
if newmtime:
@@ -240,7 +231,75 @@ def movefile(src,dest,newmtime=None,sstat=None):
newmtime=sstat[stat.ST_MTIME]
return newmtime
+def copyfile(src,dest,newmtime=None,sstat=None):
+ """
+ Copies a file from src to dest, preserving all permissions and
+ attributes; mtime will be preserved even when moving across
+ filesystems. Returns true on success and false on failure.
+ """
+ import os, stat, shutil
+
+ #print "copyfile("+src+","+dest+","+str(newmtime)+","+str(sstat)+")"
+ try:
+ if not sstat:
+ sstat=os.lstat(src)
+ except Exception, e:
+ print "copyfile: Stating source file failed...", e
+ return False
+
+ destexists=1
+ try:
+ dstat=os.lstat(dest)
+ except:
+ dstat=os.lstat(os.path.dirname(dest))
+ destexists=0
+
+ if destexists:
+ if stat.S_ISLNK(dstat[stat.ST_MODE]):
+ try:
+ os.unlink(dest)
+ destexists=0
+ except Exception, e:
+ pass
+
+ if stat.S_ISLNK(sstat[stat.ST_MODE]):
+ try:
+ target=os.readlink(src)
+ if destexists and not stat.S_ISDIR(dstat[stat.ST_MODE]):
+ os.unlink(dest)
+ os.symlink(target,dest)
+ #os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+ return os.lstat(dest)
+ except Exception, e:
+ print "copyfile: failed to properly create symlink:", dest, "->", target, e
+ return False
+
+ if stat.S_ISREG(sstat[stat.ST_MODE]):
+ try: # For safety copy then move it over.
+ shutil.copyfile(src,dest+"#new")
+ os.rename(dest+"#new",dest)
+ except Exception, e:
+ print 'copyfile: copy', src, '->', dest, 'failed.', e
+ return False
+ else:
+ #we don't yet handle special, so we need to fall back to /bin/mv
+ a=getstatusoutput("/bin/cp -f "+"'"+src+"' '"+dest+"'")
+ if a[0]!=0:
+ print "copyfile: Failed to copy special file:" + src + "' to '" + dest + "'", a
+ return False # failure
+ try:
+ os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+ os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
+ except Exception, e:
+ print "copyfile: Failed to chown/chmod/unlink", dest, e
+ return False
+ if newmtime:
+ os.utime(dest,(newmtime,newmtime))
+ else:
+ os.utime(dest, (sstat[stat.ST_ATIME], sstat[stat.ST_MTIME]))
+ newmtime=sstat[stat.ST_MTIME]
+ return newmtime
#######################################################################
#######################################################################
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py
index 5b2418f665..74a8b84bd5 100644
--- a/bitbake/lib/bb/taskdata.py
+++ b/bitbake/lib/bb/taskdata.py
@@ -559,7 +559,11 @@ class TaskData:
self.tasks_name[task],
self.tasks_tdepends[task]))
- bb.msg.debug(3, bb.msg.domain.TaskData, "runtime ids (per fn):")
+ bb.msg.debug(3, bb.msg.domain.TaskData, "dependency ids (per fn):")
+ for fnid in self.depids:
+ bb.msg.debug(3, bb.msg.domain.TaskData, " %s %s: %s" % (fnid, self.fn_index[fnid], self.depids[fnid]))
+
+ bb.msg.debug(3, bb.msg.domain.TaskData, "runtime dependency ids (per fn):")
for fnid in self.rdepids:
bb.msg.debug(3, bb.msg.domain.TaskData, " %s %s: %s" % (fnid, self.fn_index[fnid], self.rdepids[fnid]))