Skip to content

Commit 887b064

Browse files
committed
Fix the change in codeql messages and other bugfixes
1 parent d0e531a commit 887b064

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ RUN apt-get update && \
3131
dos2unix \
3232
gettext && \
3333
apt-get clean && \
34+
rm -f /usr/bin/python /usr/bin/pip && \
3435
ln -s /usr/bin/python3.8 /usr/bin/python && \
3536
ln -s /usr/bin/pip3 /usr/bin/pip
3637

container/libs/codeql.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def download_and_install_latest_codeql(self, github_version):
4040
download_url = f'https://github.com/github/codeql-cli-binaries/releases/download/{github_version.title}/codeql-win64.zip'
4141
download_path = f'{self.TEMP_DIR}/codeql_windows.zip'
4242
else:
43-
exit(ERROR_UNKNOWN_OS)
43+
exit(self.ERROR_UNKNOWN_OS)
4444

4545
logger.info(f'Downloading codeql-cli version {github_version.title}...')
4646
check_output_wrapper(f"wget -q {download_url} -O {download_path}", shell=True).decode("utf-8")
@@ -61,17 +61,17 @@ def download_and_install_latest_codeql_queries(self):
6161
ret2 = check_output_wrapper(f'git clone {self.CODEQL_GO_QUERIES_URL} {codeql_go_repo_dir}', shell=True)
6262
if ret1 is CalledProcessError or ret2 is CalledProcessError:
6363
logger.error("Could not run git command")
64-
exit(ERROR_GIT_COMMAND)
64+
exit(self.ERROR_GIT_COMMAND)
6565

6666
def get_current_local_version(self):
6767
ret_string = check_output_wrapper(f'{self.CODEQL_HOME}/codeql/codeql version', shell=True).decode("utf-8")
6868
if ret_string is CalledProcessError:
6969
logger.error("Could not run codeql command")
70-
exit(ERROR_EXECUTING_CODEQL)
71-
version_match = search("Version: ([0-9.]+)\.", ret_string)
70+
exit(self.ERROR_EXECUTING_CODEQL)
71+
version_match = search("toolchain release ([0-9.]+)\.", ret_string)
7272
if not version_match:
7373
logger.error("Could not determine existing codeql version")
74-
exit(ERROR_EXECUTING_CODEQL)
74+
exit(self.ERROR_EXECUTING_CODEQL)
7575
version = f'v{version_match.group(1)}'
7676
return version
7777

@@ -80,7 +80,7 @@ def get_latest_codeql_github_version(self):
8080

8181
def install_codeql_cli(self, download_path):
8282
logger.info("Installing codeql-cli...")
83-
codeql_dir = f'{self.CODEQL_HOME}/codeql-cli'
83+
codeql_dir = f'{self.CODEQL_HOME}/codeql'
8484
wipe_and_create_dir(codeql_dir)
8585
ret1 = check_output_wrapper(f'unzip {download_path} -d {codeql_dir}', shell=True)
8686

@@ -91,5 +91,5 @@ def execute_codeql_command(self, args):
9191
ret_string = check_output_wrapper(f'{self.CODEQL_HOME}/codeql/codeql {args}', shell=True)
9292
if ret_string is CalledProcessError:
9393
logger.error("Could not run codeql command")
94-
exit(ERROR_EXECUTING_CODEQL)
94+
exit(self.ERROR_EXECUTING_CODEQL)
9595
return bytearray(ret_string).decode('utf-8')

container/libs/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def check_output_wrapper(*args, **kwargs):
4040
sys.exit(ERROR_EXECUTING_COMMAND);
4141

4242
def wipe_and_create_dir(dirname):
43-
rmtree(dirname)
43+
rmtree(dirname, True)
4444
mkdir(dirname)
4545

4646
def get_logger(log_level=INFO):

0 commit comments

Comments
 (0)