@@ -131,13 +131,15 @@ def main():
131
131
group1 = parser .add_mutually_exclusive_group ()
132
132
group1 .add_argument ('-d' , '--directory' ,
133
133
help = 'Directory to process' )
134
- group1 .add_argument ('-P' , '--projects ' , nargs = '*' ,
135
- help = 'List of projects to process' )
134
+ group1 .add_argument ('-P' , '--project ' , nargs = '*' ,
135
+ help = 'project(s) to process' )
136
136
137
137
parser .add_argument ('-I' , '--indexed' , action = 'store_true' ,
138
138
help = 'Sync indexed projects only' )
139
139
parser .add_argument ('-i' , '--ignore_errors' , nargs = '*' ,
140
140
help = 'ignore errors from these projects' )
141
+ parser .add_argument ('--ignore_project' , nargs = '+' ,
142
+ help = 'do not process given project(s)' )
141
143
parser .add_argument ('-c' , '--config' , required = True ,
142
144
help = 'config file in JSON/YAML format' )
143
145
parser .add_argument ('-U' , '--uri' , default = 'http://localhost:8080/source' ,
@@ -193,7 +195,7 @@ def main():
193
195
headers .update (config_headers )
194
196
195
197
directory = args .directory
196
- if not args .directory and not args .projects and not args .indexed :
198
+ if not args .directory and not args .project and not args .indexed :
197
199
# Assume directory, get the source root value from the webapp.
198
200
directory = get_config_value (logger , 'sourceRoot' , uri , headers = headers )
199
201
if not directory :
@@ -211,11 +213,11 @@ def main():
211
213
ignore_errors = config ["ignore_errors" ]
212
214
except KeyError :
213
215
pass
214
- logger .debug ("Ignored projects: {}" .format (ignore_errors ))
216
+ logger .debug ("Ignoring errors from projects: {}" .format (ignore_errors ))
215
217
216
218
dirs_to_process = []
217
- if args .projects :
218
- dirs_to_process = args .projects
219
+ if args .project :
220
+ dirs_to_process = args .project
219
221
logger .debug ("Processing directories: {}" .
220
222
format (dirs_to_process ))
221
223
elif args .indexed :
@@ -235,16 +237,37 @@ def main():
235
237
if path .isdir (path .join (directory , entry )):
236
238
dirs_to_process .append (entry )
237
239
240
+ ignored_projects = []
241
+ config_ignored_projects = config .get ("ignore_projects" )
242
+ if config_ignored_projects :
243
+ logger .debug ("Updating list of ignored projects list from the configuration: {}" .
244
+ format (config_ignored_projects ))
245
+ ignored_projects .extend (config_ignored_projects )
246
+
247
+ if args .ignore_project :
248
+ logger .debug ("Updating list of ignored projects based on options: {}" .
249
+ format (args .ignore_project ))
250
+ ignored_projects .extend (args .ignore_project )
251
+
252
+ if ignored_projects :
253
+ dirs_to_process = list (set (dirs_to_process ) - set (ignored_projects ))
254
+ logger .debug ("Removing projects: {}" .format (ignored_projects ))
255
+
238
256
logger .debug ("directories to process: {}" .format (dirs_to_process ))
239
257
258
+ if len (args .project ) == 1 :
259
+ lockfile_name = args .project [0 ]
260
+ else :
261
+ lockfile_name = os .path .basename (sys .argv [0 ])
262
+
240
263
if args .nolock :
241
264
r = do_sync (args .loglevel , commands , config .get ("cleanup" ),
242
265
dirs_to_process ,
243
266
ignore_errors , uri , args .workers ,
244
267
driveon = args .driveon , http_headers = headers )
245
268
else :
246
269
lock = FileLock (os .path .join (tempfile .gettempdir (),
247
- "opengrok-sync .lock" ))
270
+ lockfile_name + " .lock" ))
248
271
try :
249
272
with lock .acquire (timeout = 0 ):
250
273
r = do_sync (args .loglevel , commands , config .get ("cleanup" ),
0 commit comments