daca2: allow skipping packages and allow setting workdir
This commit is contained in:
parent
efe8e261dc
commit
15c1942a64
|
@ -177,11 +177,17 @@ def scanarchive(filepath, jobs):
|
||||||
FOLDER = None
|
FOLDER = None
|
||||||
JOBS = '-j1'
|
JOBS = '-j1'
|
||||||
REV = None
|
REV = None
|
||||||
|
SKIP = []
|
||||||
|
WORKDIR = os.path.expanduser('~/daca2');
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
if arg[:6] == '--rev=':
|
if arg[:6] == '--rev=':
|
||||||
REV = arg[6:]
|
REV = arg[6:]
|
||||||
elif arg[:2] == '-j':
|
elif arg[:2] == '-j':
|
||||||
JOBS = arg
|
JOBS = arg
|
||||||
|
elif arg[:7] == '--skip=':
|
||||||
|
SKIP.append(arg[7:])
|
||||||
|
elif arg[:10] == '--workdir=':
|
||||||
|
WORKDIR = arg[10:]
|
||||||
else:
|
else:
|
||||||
FOLDER = arg
|
FOLDER = arg
|
||||||
|
|
||||||
|
@ -189,6 +195,10 @@ if not FOLDER:
|
||||||
print('no folder given')
|
print('no folder given')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if not os.path.isdir(WORKDIR):
|
||||||
|
print('workdir \'' + WORKDIR + '\' is not a folder')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
archives = getpackages(FOLDER)
|
archives = getpackages(FOLDER)
|
||||||
if len(archives) == 0:
|
if len(archives) == 0:
|
||||||
print('failed to load packages')
|
print('failed to load packages')
|
||||||
|
@ -197,12 +207,13 @@ if len(archives) == 0:
|
||||||
print('Sleep for 10 seconds..')
|
print('Sleep for 10 seconds..')
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
workdir = os.path.expanduser('~/daca2/')
|
if not WORKDIR.endswith('/'):
|
||||||
|
WORKDIR = WORKDIR + '/'
|
||||||
|
|
||||||
print('~/daca2/' + FOLDER)
|
print('~/daca2/' + FOLDER)
|
||||||
if not os.path.isdir(workdir + FOLDER):
|
if not os.path.isdir(WORKDIR + FOLDER):
|
||||||
os.makedirs(workdir + FOLDER)
|
os.makedirs(WORKDIR + FOLDER)
|
||||||
os.chdir(workdir + FOLDER)
|
os.chdir(WORKDIR + FOLDER)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
results = open('results.txt', 'wt')
|
results = open('results.txt', 'wt')
|
||||||
|
@ -214,6 +225,11 @@ try:
|
||||||
results.close()
|
results.close()
|
||||||
|
|
||||||
for archive in archives:
|
for archive in archives:
|
||||||
|
if len(SKIP) > 0:
|
||||||
|
a = archive[:archive.rfind('/')]
|
||||||
|
a = a[a.rfind('/')+1:]
|
||||||
|
if a in SKIP:
|
||||||
|
continue
|
||||||
scanarchive(archive, JOBS)
|
scanarchive(archive, JOBS)
|
||||||
|
|
||||||
results = open('results.txt', 'at')
|
results = open('results.txt', 'at')
|
||||||
|
|
Loading…
Reference in New Issue