Skip to content

Commit b138285

Browse files
committed
Workflow parser: Insert escaped DPL JSON file as DDS asset
1 parent d9c4fea commit b138285

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

DATA/tools/parse

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,17 @@ for line in f:
153153
if 'GEN_TOPO_OOM_WORKAROUND' in os.environ and int(os.environ['GEN_TOPO_OOM_WORKAROUND']):
154154
command = 'sed -i \'s,^\( *.exe.*sleep [0-9.]*;\).*\(|[^|]*./exe.\)$,\\1 cat ' + filename + ' \\2,\' ' + filename_xml
155155
if 'GEN_TOPO_DDS_ASSETS' in os.environ and int(os.environ['GEN_TOPO_DDS_ASSETS']):
156+
command = 'sed -i \'s/\\(["\'"\'"\'<>]\\)/\\\\\\1/g\' ' + filename
157+
print('Running SED command', command)
158+
if os.system(command) != 0:
159+
print('Error running sed on XML file')
156160
asset_name = 'dpl_json_' + wf[0] + '_' + str(i)
157161
command = 'sed -i ' + \
158162
'-e \'s,^\( *.exe.*sleep [0-9.]*;\).*\(|[^|]*./exe.\)$,\\1 cat ${DDS_LOCATION}/' + asset_name + ' \\2,\' ' + \
159-
'-e \'s,^\( *.decltask name.*>$\),\\1 <assets><name>' + asset_name + '</name></assets>,\' ' + \
160-
'-e \'s,^\( *.topology name.*>$\),\\1 <asset name="' + asset_name + '" type="inline" visibility="global" value="foo" />,\' ' + \
163+
'-e \'/^\( *.decltask name.*>$\)/a <assets><name>' + asset_name + '</name></assets>\' ' + \
164+
'-e \'/^\( *.topology name.*>$\)/a <asset name="' + asset_name + '" type="inline" visibility="global" value="\' ' + \
165+
'-e \'/^\( *.topology name.*>$\)/r ' + filename + '\' ' + \
166+
'-e \'/^\( *.topology name.*>$\)/a " />\' ' + \
161167
filename_xml
162168
print('Running SED command', command)
163169
if os.system(command) != 0:

0 commit comments

Comments
 (0)