summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/migrate-chunks30
1 files changed, 23 insertions, 7 deletions
diff --git a/scripts/migrate-chunks b/scripts/migrate-chunks
index f93619d7..2e669122 100755
--- a/scripts/migrate-chunks
+++ b/scripts/migrate-chunks
@@ -34,12 +34,11 @@ definitions_repo = sb.get_git_directory_name(sb.root_repository_url)
def move_morphs(morphs, kind):
if kind == 'cluster':
print 'Moving %s into subdirectory' % kind
- subdir = os.path.join(definitions_repo, 'cluster')
+ subdir = os.path.join(definitions_repo, 'clusters')
subprocess.call(['mkdir', '-p', subdir])
for morph in morphs:
for m in morph['systems']:
- m['morph'] = str('systems/' + m['morph'] + '.morph')
- #loader.save_to_file(morph.filename, morph)
+ m['morph'] = 'systems/' + m['name'] + '.morph'
loader.save_to_file(morph.filename, morph)
new_location = os.path.join(subdir, morph.filename)
#subprocess.call(['git', 'mv', morph.filename, new_location])
@@ -48,18 +47,35 @@ def move_morphs(morphs, kind):
# 'Move %s into subdirectory' %kind])
if kind == 'system':
print 'Moving %s into subdirectory' % kind
- subdir = os.path.join(definitions_repo, 'system')
+ subdir = os.path.join(definitions_repo, 'systems')
subprocess.call(['mkdir', '-p', subdir])
for morph in morphs:
- #print 'Initial: %s' % str(morph)
for stratum in morph['strata']:
- stratum['morph'] = str('strata/' + stratum['morph'] + '.morph')
+ stratum['morph'] = 'strata/' + stratum['name'] + '.morph'
loader.save_to_file(morph.filename,morph)
new_location = os.path.join(subdir, morph.filename)
#subprocess.call(['git', 'mv', morph.filename, new_location])
#morph.filename = new_location
#subprocess.call(['git', 'commit', '--quiet', '-m',
# 'Move %s into subdirectory' %kind])
+ if kind == 'stratum':
+ print 'Moving %s into subdirectory' % kind
+ for morph in morphs:
+ # Add path to the build-depends morphologies
+ for build_depends in morph['build-depends']:
+ build_depends['morph'] = 'strata/' + build_depends['morph'] + '.morph'
+ subpath = 'strata/' + morph['name']
+ subdir = os.path.join(definitions_repo, subpath)
+ subprocess.call(['mkdir', '-p', subdir])
+ for chunk in morph['chunks']:
+ chunk['morph'] = subpath + '/' + chunk['name'] + '.morph'
+ loader.save_to_file(morph.filename,morph)
+ new_location = os.path.join(subdir, morph.filename)
+ #subprocess.call(['git', 'mv', morph.filename, new_location])
+ #morph.filename = new_location
+ #subprocess.call(['git', 'commit', '--quiet', '-m',
+ # 'Move %s into subdirectory' %kind])
+ sys.exit(0)
#for morph in morphs:
# print '%s' %morph
@@ -76,7 +92,7 @@ def move_morphs(morphs, kind):
for key in morphologies.iterkeys():
print "Moving %s....\n" %key
- move_morphs(morphologies[key], key)
+ if key == 'stratum': move_morphs(morphologies[key], key)
#move_morphs(chunks, 'chunks')
#move_morphs(strata, 'strata')