-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Used git clone instead to download source from a branch of a tag #832
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,48 +193,33 @@ def write_lines_to_copy_source(driver, file): | |
file.write('@CALL ROBOCOPY ' + source + ' ' + dest + ' /s /xx /xo' + os.linesep) | ||
|
||
@staticmethod | ||
def download_msphpsql_source(repo, branch, dest_folder = 'Source', clean_up = True): | ||
def download_msphpsql_source(repo, branch, dest_folder = 'Source'): | ||
"""Download to *dest_folder* the msphpsql archive of the specified | ||
GitHub *repo* and *branch*. The downloaded files will be removed by default. | ||
""" | ||
try: | ||
work_dir = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
temppath = os.path.join(work_dir, 'temp') | ||
if os.path.exists(temppath): | ||
shutil.rmtree(temppath) | ||
os.makedirs(temppath) | ||
# There is no need to remove tree - | ||
# for Bamboo, it will be cleaned up eventually | ||
# for local development, this can act as a cached copy of the repo | ||
if not os.path.exists(temppath): | ||
os.makedirs(temppath) | ||
os.chdir(temppath) | ||
|
||
file = branch + '.zip' | ||
url = 'https://github.com/' + repo + '/msphpsql/archive/' + branch + '.zip' | ||
|
||
print('Downloading ' + url + ' ...') | ||
try: | ||
with urllib.request.urlopen(url) as response, open(file, 'wb') as out_file: | ||
shutil.copyfileobj(response, out_file) | ||
except: | ||
print ("Resort to skip ssl verification...") | ||
# need to skip ssl verification on some agents | ||
# see https://www.python.org/dev/peps/pep-0476/ | ||
with urllib.request.urlopen(url, context=ssl._create_unverified_context()) as response, open(file, 'wb') as out_file: | ||
shutil.copyfileobj(response, out_file) | ||
|
||
print('Extracting ' + file + ' ...') | ||
zip = zipfile.ZipFile(file) | ||
zip.extractall() | ||
zip.close() | ||
|
||
msphpsqlFolder = os.path.join(temppath, 'msphpsql-' + branch) | ||
|
||
url = 'https://github.com/' + repo + '/msphpsql.git' | ||
command = 'git clone ' + url + ' -b ' + branch + ' --single-branch --depth 1 ' + msphpsqlFolder | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. git is always in the PATH, right? Is there a check for this somewhere else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what you meant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a check somewhere else in the script that git is actually installed and in the PATH? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is meant to be a sample script, which assumes Git is in the path. FYI please check README . |
||
os.system(command) | ||
|
||
source = os.path.join(msphpsqlFolder, 'source') | ||
os.chdir(work_dir) | ||
|
||
os.system('ROBOCOPY ' + source + '\shared ' + dest_folder + '\shared /xx /xo') | ||
os.system('ROBOCOPY ' + source + '\pdo_sqlsrv ' + dest_folder + '\pdo_sqlsrv /xx /xo') | ||
os.system('ROBOCOPY ' + source + '\sqlsrv ' + dest_folder + '\sqlsrv /xx /xo') | ||
|
||
if clean_up: | ||
shutil.rmtree(temppath) | ||
|
||
except: | ||
print('Error occurred when downloading source') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clean_up has been removed entirely and it's not used anywhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it was a default parameter, which was never used