Fix CI Builds for Linux (#3313)
This commit is contained in:
parent
c8e3f0c732
commit
85c77a9c3f
6
.github/scripts/install-arduino-core-esp32.sh
vendored
Normal file → Executable file
6
.github/scripts/install-arduino-core-esp32.sh
vendored
Normal file → Executable file
@ -18,7 +18,7 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd esp32 && \
|
cd esp32 && \
|
||||||
echo "Updating submodules..." && \
|
echo "Updating Submodules..." && \
|
||||||
git submodule update --init --recursive > /dev/null 2>&1
|
git submodule update --init --recursive > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Submodule update failed"; exit 1; fi
|
if [ $? -ne 0 ]; then echo "ERROR: Submodule update failed"; exit 1; fi
|
||||||
|
|
||||||
@ -32,8 +32,8 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
|
|||||||
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
|
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading the tools and the toolchain..."
|
echo "Installing Platform Tools..."
|
||||||
cd tools && python get.py > /dev/null
|
cd tools && python get.py
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Download failed"; exit 1; fi
|
if [ $? -ne 0 ]; then echo "ERROR: Download failed"; exit 1; fi
|
||||||
cd $script_init_path
|
cd $script_init_path
|
||||||
|
|
||||||
|
21
tools/get.py
21
tools/get.py
@ -60,7 +60,7 @@ def report_progress(count, blockSize, totalSize):
|
|||||||
|
|
||||||
def unpack(filename, destination):
|
def unpack(filename, destination):
|
||||||
dirname = ''
|
dirname = ''
|
||||||
print('Extracting {0}'.format(os.path.basename(filename)))
|
print('Extracting {0} ...'.format(os.path.basename(filename)))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if filename.endswith('tar.gz'):
|
if filename.endswith('tar.gz'):
|
||||||
tfile = tarfile.open(filename, 'r:gz')
|
tfile = tarfile.open(filename, 'r:gz')
|
||||||
@ -76,7 +76,7 @@ def unpack(filename, destination):
|
|||||||
# a little trick to rename tool directories so they don't contain version number
|
# a little trick to rename tool directories so they don't contain version number
|
||||||
rename_to = re.match(r'^([a-z][^\-]*\-*)+', dirname).group(0).strip('-')
|
rename_to = re.match(r'^([a-z][^\-]*\-*)+', dirname).group(0).strip('-')
|
||||||
if rename_to != dirname:
|
if rename_to != dirname:
|
||||||
print('Renaming {0} to {1}'.format(dirname, rename_to))
|
print('Renaming {0} to {1} ...'.format(dirname, rename_to))
|
||||||
if os.path.isdir(rename_to):
|
if os.path.isdir(rename_to):
|
||||||
shutil.rmtree(rename_to)
|
shutil.rmtree(rename_to)
|
||||||
shutil.move(dirname, rename_to)
|
shutil.move(dirname, rename_to)
|
||||||
@ -106,9 +106,8 @@ def get_tool(tool):
|
|||||||
archive_name = tool['archiveFileName']
|
archive_name = tool['archiveFileName']
|
||||||
local_path = dist_dir + archive_name
|
local_path = dist_dir + archive_name
|
||||||
url = tool['url']
|
url = tool['url']
|
||||||
#real_hash = tool['checksum'].split(':')[1]
|
|
||||||
if not os.path.isfile(local_path):
|
if not os.path.isfile(local_path):
|
||||||
print('Downloading ' + archive_name)
|
print('Downloading ' + archive_name + ' ...')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if 'CYGWIN_NT' in sys_name:
|
if 'CYGWIN_NT' in sys_name:
|
||||||
import ssl
|
import ssl
|
||||||
@ -127,15 +126,11 @@ def get_tool(tool):
|
|||||||
download_file(url, local_path)
|
download_file(url, local_path)
|
||||||
else:
|
else:
|
||||||
urlretrieve(url, local_path, report_progress)
|
urlretrieve(url, local_path, report_progress)
|
||||||
sys.stdout.write("\rDone\n")
|
sys.stdout.write("\rDone\n")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
else:
|
else:
|
||||||
print('Tool {0} already downloaded'.format(archive_name))
|
print('Tool {0} already downloaded'.format(archive_name))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
#local_hash = sha256sum(local_path)
|
|
||||||
#if local_hash != real_hash:
|
|
||||||
# print('Hash mismatch for {0}, delete the file and try again'.format(local_path))
|
|
||||||
# raise RuntimeError()
|
|
||||||
unpack(local_path, '.')
|
unpack(local_path, '.')
|
||||||
|
|
||||||
def load_tools_list(filename, platform):
|
def load_tools_list(filename, platform):
|
||||||
@ -158,11 +153,11 @@ def identify_platform():
|
|||||||
bits = 64
|
bits = 64
|
||||||
sys_name = platform.system()
|
sys_name = platform.system()
|
||||||
sys_platform = platform.platform()
|
sys_platform = platform.platform()
|
||||||
print('System: %s, Info: %s' % (sys_name, sys_platform))
|
if 'Linux' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('aarch64') > 0):
|
||||||
if 'Linux' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('aarch64')):
|
|
||||||
sys_name = 'LinuxARM'
|
sys_name = 'LinuxARM'
|
||||||
if 'CYGWIN_NT' in sys_name:
|
if 'CYGWIN_NT' in sys_name:
|
||||||
sys_name = 'Windows'
|
sys_name = 'Windows'
|
||||||
|
print('System: %s, Bits: %d, Info: %s' % (sys_name, bits, sys_platform))
|
||||||
return arduino_platform_names[sys_name][bits]
|
return arduino_platform_names[sys_name][bits]
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -172,4 +167,4 @@ if __name__ == '__main__':
|
|||||||
mkdir_p(dist_dir)
|
mkdir_p(dist_dir)
|
||||||
for tool in tools_to_download:
|
for tool in tools_to_download:
|
||||||
get_tool(tool)
|
get_tool(tool)
|
||||||
print('Done')
|
print('Platform Tools Installed')
|
||||||
|
Loading…
Reference in New Issue
Block a user