rundaca: do not read password from command line argument

This commit is contained in:
Daniel Marjamäki 2018-08-06 13:37:42 +02:00
parent 1b933f4dd1
commit 750ba1a4c1
1 changed files with 16 additions and 18 deletions

View File

@ -6,17 +6,6 @@ import os
import sys
import time
START = 0
PASSWORD = ''
for arg in sys.argv[1:]:
if len(arg) == 1:
START = '0123456789abcdefghijklmnopqrstuvwxyz'.find(arg)
if START < 0:
START = 0
else:
PASSWORD = arg
def compilecppcheck(CPPFLAGS):
subprocess.call(['nice', 'make', 'clean'])
subprocess.call(['nice', 'make', 'SRCDIR=build', 'CFGDIR=' +
@ -38,8 +27,8 @@ def daca2report(reportfolder):
# Upload file to sourceforge server using scp
def upload(localfolder, webfolder):
if len(PASSWORD) < 3:
def upload(localfolder, webfolder, password):
if len(password) < 3:
return
tries = 1
while tries <= 5:
@ -48,7 +37,7 @@ def upload(localfolder, webfolder):
'scp -r ' + localfolder + ' danielmarjamaki,cppcheck@web.sf.net:htdocs/' + webfolder)
# child.expect('upload@trac.cppcheck.net\'s password:')
child.expect('Password:')
child.sendline(PASSWORD)
child.sendline(password)
child.interact()
return
except (IOError, OSError, pexpect.TIMEOUT, pexpect.EOF):
@ -57,7 +46,7 @@ def upload(localfolder, webfolder):
tries = tries + 1
def daca2(foldernum):
def daca2(foldernum, password):
folders = '0123456789abcdefghijklmnopqrstuvwxyz'
folder = folders[foldernum % len(folders)]
@ -82,9 +71,18 @@ def daca2(foldernum):
daca2report(os.path.expanduser('~/daca2-report'))
print('rundaca2.py: upload')
upload(os.path.expanduser('~/daca2-report'), 'devinfo/')
upload(os.path.expanduser('~/daca2-report'), 'devinfo/', password)
foldernum = START
foldernum = 0
for arg in sys.argv[1:]:
if len(arg) == 1:
folderNum = '0123456789abcdefghijklmnopqrstuvwxyz'.find(arg)
if folderNum < 0:
folderNum = 0
print('enter password:')
password = sys.stdin.readline().rstrip()
while True:
daca2(foldernum)
daca2(foldernum, password)
foldernum = foldernum + 1