@@ -69,75 +69,106 @@ manifest.write("manifest.xml")
69
69
70
70
print "DONE"
71
71
72
- # GENERATE SOURCE ENTRIES FOR UNKNOWN DEPS
73
- print "trying to open existing overrides.yml"
74
72
75
- #open overrides.yml
73
+ # ADVERTISE LOCAL DEPS IN LOCAL.AUTOBUILD
74
+ # ADVERTISE REMOTE DEPS IN UNIVERSE PACKAGE SET
76
75
77
- path = os .environ ['AUTOPROJ_CURRENT_ROOT' ]+ "/autoproj/overrides.yml"
76
+ localpath = os .environ ['AUTOPROJ_CURRENT_ROOT' ]+ "/autoproj/" + project_name + ".autobuild"
77
+ remotepath = os .environ ['AUTOPROJ_CURRENT_ROOT' ]+ "/autoproj/remotes/esrocos.universe/" + project_name + ".autobuild"
78
+
79
+ try :
80
+ with open (localpath , 'w' ) as localout , open (remotepath , 'w' ) as remoteout :
81
+ localout .write ('import_package "' + project_name + '"\n ' )
82
+ for dep in pkg_deps :
83
+ name = ''
84
+ remote = False
85
+ for key in dep :
86
+ if key == 'github' :
87
+ remote = True
88
+ if not dep [key ]:
89
+ name = key
90
+ if remote :
91
+ remoteout .write ('import_package "' + name + '"\n ' )
92
+ else :
93
+ localout .write ('import_package "' + name + '"\n ' )
94
+
95
+ except IOError as err :
96
+ print "could not write to file, exit..."
97
+ sys .exit ()
98
+
99
+ print "DONE"
100
+
101
+ # GENERATE SOURCE ENTRIES FOR REMOTE DEPS
102
+ print "trying to open existing source.yml"
103
+
104
+ #open universe source.yml
105
+
106
+ path = os .environ ['AUTOPROJ_CURRENT_ROOT' ]+ "/autoproj/remotes/esrocos.universe/source.yml"
78
107
data = {}
79
108
80
109
try :
81
- with open (path , 'r' ) as overrides :
82
- print "parsing yml data"
83
- data = yaml .load (overrides )
110
+ with open (path , 'r' ) as sources :
111
+ print "parsing source.yml data"
112
+ data = yaml .load (sources )
113
+ if not data ['version_control' ]:
114
+ data ['version_control' ] = []
84
115
except IOError as err :
85
- print "did not find existing overrides .yml..."
116
+ print "did not find existing source .yml..."
86
117
data = {'version_control' :[]}
87
118
88
- # manipulate overrides.yml
119
+ # create hash map of existing entries to avoid doubles
120
+
121
+ existing_deps = {}
122
+ for dep in data ['version_control' ]:
123
+ for key in dep :
124
+ if not dep [key ]:
125
+ existing_deps [key ] = True
126
+
127
+ # manipulate source.yml data
89
128
90
129
for dep in pkg_deps :
130
+ name = ''
131
+ remote = False
132
+
91
133
for key in dep :
92
- if key == 'github' :
93
- data ['version_control' ].append (dep )
134
+ if key == 'github' :
135
+ remote = True
136
+ if not dep [key ]:
137
+ name = key
138
+
139
+ if remote and not existing_deps [name ]:
140
+ data ['version_control' ].append (dep )
94
141
95
- # write back to overrides .yml
142
+ # write back to source .yml
96
143
try :
97
144
with open (path , 'w' ) as outfile :
98
145
yaml .dump (data , outfile , default_flow_style = False , allow_unicode = True )
99
146
except IOError as err :
100
147
print "could not write to file, aborting..."
101
148
sys .exit ()
102
149
103
- # ADVERTISE LOCAL AND REMOTE DEPS IN LOCAL.AUTOBUILD
104
- path = os .environ ['AUTOPROJ_CURRENT_ROOT' ]+ "/autoproj/" + project_name + ".autobuild"
105
-
106
- try :
107
- with open (path , 'w' ) as outfile :
108
- outfile .write ('import_package "' + project_name + '"\n ' )
109
- for dep in pkg_deps :
110
- for key in dep :
111
- if not dep [key ]:
112
- outfile .write ('import_package "' + key + '"\n ' )
113
-
114
- except IOError as err :
115
- print "could not write to file, exit..."
116
- sys .exit ()
117
-
118
- print "DONE"
119
-
120
150
# AUP
121
151
122
152
aup_arguments = ["autoproj" ,"update" ]
123
153
124
154
call (aup_arguments )
125
155
126
- sys .exit ()
127
-
128
- # REMOVE tmp FILES
156
+ # REMOVE OLD FILES AND RESET CHANGES
129
157
130
- print "DONE"
158
+ # print "clean tmp files...",
131
159
132
- # remove manifest
160
+ #remote_autobuild_path = os.environ['AUTOPROJ_CURRENT_ROOT']+"/autoproj/remotes/esrocos.universe/"+project_name+".autobuild"
161
+ #local_autobuild_path = os.environ['AUTOPROJ_CURRENT_ROOT']+"/autoproj/"+project_name+".autobuild"
162
+ #manifest_path = "manifest.xml"
133
163
134
- os .remove (path )
164
+ #os.remove(manifest_path)
165
+ #os.remove(local_autobuild_path)
166
+ #os.remove(remote_autobuild_path)
135
167
136
- # remove overrides.yml
168
+ #print "DONE"
137
169
138
- os .remove (path )
139
170
140
- print "clean tmp files..." ,
171
+ sys . exit ()
141
172
142
173
# COPY ASN
143
174
0 commit comments