diff options
| -rwxr-xr-x | meta/packages/stage-manager/files/stage-manager | 55 | ||||
| -rw-r--r-- | meta/packages/stage-manager/stagemanager-native_0.0.1.bb | 2 |
2 files changed, 39 insertions, 18 deletions
diff --git a/meta/packages/stage-manager/files/stage-manager b/meta/packages/stage-manager/files/stage-manager index 06495dbb02..35453992f4 100755 --- a/meta/packages/stage-manager/files/stage-manager +++ b/meta/packages/stage-manager/files/stage-manager | |||
| @@ -79,33 +79,54 @@ if __name__ == "__main__": | |||
| 79 | 79 | ||
| 80 | found = False | 80 | found = False |
| 81 | 81 | ||
| 82 | def updateCache(path, fstamp): | ||
| 83 | cache[path] = {} | ||
| 84 | cache[path]['ts'] = fstamp[stat.ST_MTIME] | ||
| 85 | cache[path]['size'] = fstamp[stat.ST_SIZE] | ||
| 86 | found = True | ||
| 87 | |||
| 88 | def copyfile(path): | ||
| 89 | if options.copydir: | ||
| 90 | copypath = os.path.join(options.copydir, path.replace(options.parentdir, '', 1)) | ||
| 91 | mkdirhier(os.path.split(copypath)[0]) | ||
| 92 | os.system("cp -dp " + path + " " + copypath) | ||
| 93 | |||
| 94 | def copydir(path, fstamp): | ||
| 95 | if options.copydir: | ||
| 96 | copypath = os.path.join(options.copydir, path.replace(options.parentdir, '', 1)) | ||
| 97 | if os.path.islink(path): | ||
| 98 | os.symlink(os.readlink(path), copypath) | ||
| 99 | else: | ||
| 100 | mkdirhier(copypath) | ||
| 101 | os.utime(copypath, (fstamp[stat.ST_ATIME], fstamp[stat.ST_MTIME])) | ||
| 102 | |||
| 82 | for root, dirs, files in os.walk(options.parentdir): | 103 | for root, dirs, files in os.walk(options.parentdir): |
| 83 | for f in files: | 104 | for f in files: |
| 84 | path = os.path.join(root, f) | 105 | path = os.path.join(root, f) |
| 85 | if not os.access(path, os.R_OK): | 106 | if not os.access(path, os.R_OK): |
| 86 | continue | 107 | continue |
| 87 | fstamp = os.stat(path) | 108 | fstamp = os.lstat(path) |
| 88 | if path not in cache: | 109 | if path not in cache: |
| 89 | print "new file %s" % path | 110 | print "new file %s" % path |
| 90 | cache[path] = {} | 111 | updateCache(path, fstamp) |
| 91 | cache[path]['ts'] = fstamp[stat.ST_MTIME] | 112 | copyfile(path) |
| 92 | cache[path]['size'] = fstamp[stat.ST_SIZE] | ||
| 93 | if options.copydir: | ||
| 94 | copypath = os.path.join(options.copydir, path.replace(options.parentdir, '', 1)) | ||
| 95 | mkdirhier(os.path.split(copypath)[0]) | ||
| 96 | os.system("cp " + path + " " + copypath) | ||
| 97 | found = True | ||
| 98 | else: | 113 | else: |
| 99 | if cache[path]['ts'] != fstamp[stat.ST_MTIME] or cache[path]['size'] != fstamp[stat.ST_SIZE]: | 114 | if cache[path]['ts'] != fstamp[stat.ST_MTIME] or cache[path]['size'] != fstamp[stat.ST_SIZE]: |
| 100 | print "file %s changed" % path | 115 | print "file %s changed" % path |
| 101 | cache[path] = {} | 116 | updateCache(path, fstamp) |
| 102 | cache[path]['ts'] = fstamp[stat.ST_MTIME] | 117 | copyfile(path) |
| 103 | cache[path]['size'] = fstamp[stat.ST_SIZE] | 118 | for d in dirs: |
| 104 | if options.copydir: | 119 | path = os.path.join(root, d) |
| 105 | copypath = os.path.join(options.copydir, path.replace(options.parentdir, '', 1)) | 120 | fstamp = os.lstat(path) |
| 106 | mkdirhier(os.path.split(copypath)[0]) | 121 | if path not in cache: |
| 107 | os.system("cp " + path + " " + copypath) | 122 | print "new dir %s" % path |
| 108 | found = True | 123 | updateCache(path, fstamp) |
| 124 | copydir(path, fstamp) | ||
| 125 | else: | ||
| 126 | if cache[path]['ts'] != fstamp[stat.ST_MTIME]: | ||
| 127 | print "dir %s changed" % path | ||
| 128 | updateCache(path, fstamp) | ||
| 129 | copydir(path, fstamp) | ||
| 109 | 130 | ||
| 110 | if options.update: | 131 | if options.update: |
| 111 | print "Updating" | 132 | print "Updating" |
diff --git a/meta/packages/stage-manager/stagemanager-native_0.0.1.bb b/meta/packages/stage-manager/stagemanager-native_0.0.1.bb index b1f3367209..828af1fbb5 100644 --- a/meta/packages/stage-manager/stagemanager-native_0.0.1.bb +++ b/meta/packages/stage-manager/stagemanager-native_0.0.1.bb | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | DESCRIPTION = "Helper script for packaged-staging.bbclass" | 1 | DESCRIPTION = "Helper script for packaged-staging.bbclass" |
| 2 | PR = "r2" | 2 | PR = "r7" |
| 3 | 3 | ||
| 4 | SRC_URI = "file://stage-manager" | 4 | SRC_URI = "file://stage-manager" |
| 5 | LICENSE = "GPLv2" | 5 | LICENSE = "GPLv2" |
