mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
stage-manager: Various fixes/ehacements
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3271 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
@@ -79,33 +79,54 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
found = False
|
found = False
|
||||||
|
|
||||||
|
def updateCache(path, fstamp):
|
||||||
|
cache[path] = {}
|
||||||
|
cache[path]['ts'] = fstamp[stat.ST_MTIME]
|
||||||
|
cache[path]['size'] = fstamp[stat.ST_SIZE]
|
||||||
|
found = True
|
||||||
|
|
||||||
|
def copyfile(path):
|
||||||
|
if options.copydir:
|
||||||
|
copypath = os.path.join(options.copydir, path.replace(options.parentdir, '', 1))
|
||||||
|
mkdirhier(os.path.split(copypath)[0])
|
||||||
|
os.system("cp -dp " + path + " " + copypath)
|
||||||
|
|
||||||
|
def copydir(path, fstamp):
|
||||||
|
if options.copydir:
|
||||||
|
copypath = os.path.join(options.copydir, path.replace(options.parentdir, '', 1))
|
||||||
|
if os.path.islink(path):
|
||||||
|
os.symlink(os.readlink(path), copypath)
|
||||||
|
else:
|
||||||
|
mkdirhier(copypath)
|
||||||
|
os.utime(copypath, (fstamp[stat.ST_ATIME], fstamp[stat.ST_MTIME]))
|
||||||
|
|
||||||
for root, dirs, files in os.walk(options.parentdir):
|
for root, dirs, files in os.walk(options.parentdir):
|
||||||
for f in files:
|
for f in files:
|
||||||
path = os.path.join(root, f)
|
path = os.path.join(root, f)
|
||||||
if not os.access(path, os.R_OK):
|
if not os.access(path, os.R_OK):
|
||||||
continue
|
continue
|
||||||
fstamp = os.stat(path)
|
fstamp = os.lstat(path)
|
||||||
if path not in cache:
|
if path not in cache:
|
||||||
print "new file %s" % path
|
print "new file %s" % path
|
||||||
cache[path] = {}
|
updateCache(path, fstamp)
|
||||||
cache[path]['ts'] = fstamp[stat.ST_MTIME]
|
copyfile(path)
|
||||||
cache[path]['size'] = fstamp[stat.ST_SIZE]
|
|
||||||
if options.copydir:
|
|
||||||
copypath = os.path.join(options.copydir, path.replace(options.parentdir, '', 1))
|
|
||||||
mkdirhier(os.path.split(copypath)[0])
|
|
||||||
os.system("cp " + path + " " + copypath)
|
|
||||||
found = True
|
|
||||||
else:
|
else:
|
||||||
if cache[path]['ts'] != fstamp[stat.ST_MTIME] or cache[path]['size'] != fstamp[stat.ST_SIZE]:
|
if cache[path]['ts'] != fstamp[stat.ST_MTIME] or cache[path]['size'] != fstamp[stat.ST_SIZE]:
|
||||||
print "file %s changed" % path
|
print "file %s changed" % path
|
||||||
cache[path] = {}
|
updateCache(path, fstamp)
|
||||||
cache[path]['ts'] = fstamp[stat.ST_MTIME]
|
copyfile(path)
|
||||||
cache[path]['size'] = fstamp[stat.ST_SIZE]
|
for d in dirs:
|
||||||
if options.copydir:
|
path = os.path.join(root, d)
|
||||||
copypath = os.path.join(options.copydir, path.replace(options.parentdir, '', 1))
|
fstamp = os.lstat(path)
|
||||||
mkdirhier(os.path.split(copypath)[0])
|
if path not in cache:
|
||||||
os.system("cp " + path + " " + copypath)
|
print "new dir %s" % path
|
||||||
found = True
|
updateCache(path, fstamp)
|
||||||
|
copydir(path, fstamp)
|
||||||
|
else:
|
||||||
|
if cache[path]['ts'] != fstamp[stat.ST_MTIME]:
|
||||||
|
print "dir %s changed" % path
|
||||||
|
updateCache(path, fstamp)
|
||||||
|
copydir(path, fstamp)
|
||||||
|
|
||||||
if options.update:
|
if options.update:
|
||||||
print "Updating"
|
print "Updating"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
DESCRIPTION = "Helper script for packaged-staging.bbclass"
|
DESCRIPTION = "Helper script for packaged-staging.bbclass"
|
||||||
PR = "r2"
|
PR = "r7"
|
||||||
|
|
||||||
SRC_URI = "file://stage-manager"
|
SRC_URI = "file://stage-manager"
|
||||||
LICENSE = "GPLv2"
|
LICENSE = "GPLv2"
|
||||||
|
|||||||
Reference in New Issue
Block a user