Commit 5d8348a4 authored by Joseph Morrow's avatar Joseph Morrow Committed by Erich Keane

Add check for dos2unix package in build process.

This check will prompt the enduser to retrieve the package themselves.

Change-Id: Ic58302f1491ac787822f70ed43939eca81c746f7
Signed-off-by: default avatarJoseph Morrow <joseph.l.morrow@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1652Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarCaiwen Zhang <caiwen.zhang@intel.com>
Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
parent b7b528f1
......@@ -69,85 +69,112 @@ if target_os == 'arduino':
timelib_dir = arduinolib_dir + '/libraries/Time'
if not os.path.exists(timelib_dir):
timelib_zip_file = src_dir + '/extlibs/arduino/Time.zip'
timelib_url = 'http://playground.arduino.cc/uploads/Code/Time.zip'
# Install Arduino Time library
# If the zip file is not already present, download it
os.mkdir(timelib_dir)
os.chdir(timelib_dir)
if not os.path.exists(timelib_zip_file):
timelib_zip = env.Download(timelib_zip_file, timelib_url)
else:
timelib_zip = timelib_zip_file
if WhereIs('dos2unix') is not None:
timelib_zip_file = src_dir + '/extlibs/arduino/Time.zip'
timelib_url = 'http://playground.arduino.cc/uploads/Code/Time.zip'
# Install Arduino Time library
# If the zip file is not already present, download it
os.mkdir(timelib_dir)
os.chdir(timelib_dir)
if not os.path.exists(timelib_zip_file):
timelib_zip = env.Download(timelib_zip_file, timelib_url)
else:
timelib_zip = timelib_zip_file
# Unzip the lib
print 'Unzipping Arduino Time lib...'
env.UnpackAll(timelib_dir + '/Time', timelib_zip)
# Unzip the lib
print 'Unzipping Arduino Time lib...'
env.UnpackAll(timelib_dir + '/Time', timelib_zip)
# Apply patches to ARDUINO_HOME directory.
os.chdir(arduinolib_dir)
print 'Patching Arduino libraries...'
os.system("find ./libraries/Time/Time/DateStrings.cpp -type f -exec dos2unix {} \;")
os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_libraries.patch --directory=" + arduinolib_dir)
# Apply patches to ARDUINO_HOME directory.
os.chdir(arduinolib_dir)
print 'Patching Arduino libraries...'
# Remove downloaded file
os.remove(timelib_zip_file)
os.system("find ./libraries/Time/Time/DateStrings.cpp -type f -exec dos2unix {} \;")
os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_libraries.patch --directory=" + arduinolib_dir)
# Remove downloaded file
os.remove(timelib_zip_file)
else:
print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.'
print 'You may likely retrieve this package as follows:'
print ' sudo apt-get install dos2unix'
print ' or'
print ' sudo yum install dos2unix'
exit(1)
redbearlib_dir = arduinolib_dir + '/libraries/RBL_nRF8001'
if not os.path.exists(redbearlib_dir):
redbearlib_zip_file = src_dir + '/extlibs/arduino/25643e7b1b7da3740406325a471e3faa4b948747.zip'
redbearlib_url = 'https://github.com/RedBearLab/nRF8001/archive/25643e7b1b7da3740406325a471e3faa4b948747.zip'
if not os.path.exists(redbearlib_zip_file):
redbearlib_zip = env.Download(redbearlib_zip_file, redbearlib_url)
else:
redbearlib_zip = redbearlib_zip_file
if WhereIs('dos2unix') is not None:
redbearlib_zip_file = src_dir + '/extlibs/arduino/25643e7b1b7da3740406325a471e3faa4b948747.zip'
redbearlib_url = 'https://github.com/RedBearLab/nRF8001/archive/25643e7b1b7da3740406325a471e3faa4b948747.zip'
if not os.path.exists(redbearlib_zip_file):
redbearlib_zip = env.Download(redbearlib_zip_file, redbearlib_url)
else:
redbearlib_zip = redbearlib_zip_file
# Unzip the lib
print 'Unzipping Red Bear lib...'
os.chdir(arduinolib_dir + '/libraries')
env.UnpackAll(redbearlib_dir, redbearlib_zip)
# Unzip the lib
print 'Unzipping Red Bear lib...'
os.chdir(arduinolib_dir + '/libraries')
env.UnpackAll(redbearlib_dir, redbearlib_zip)
# Because the way Red Bear lib is distributed... All Red Bear source files must be moved up a few directories.
shutil.move('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747/Arduino/libraries/RBL_nRF8001/', '.')
shutil.rmtree('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747')
# Because the way Red Bear lib is distributed... All Red Bear source files must be moved up a few directories.
shutil.move('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747/Arduino/libraries/RBL_nRF8001/', '.')
shutil.rmtree('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747')
# Apply Red Bear patches
print 'Patching Red Bear library...'
os.chdir(arduinolib_dir + '/libraries/RBL_nRF8001/')
# Apply Red Bear patches
print 'Patching Red Bear library...'
os.chdir(arduinolib_dir + '/libraries/RBL_nRF8001/')
os.system("find . -type f -exec dos2unix {} \;")
os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/RBL_nRF8001.patch")
os.system("find . -type f -exec dos2unix {} \;")
os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/RBL_nRF8001.patch")
# Remove downloaded file
os.remove(redbearlib_zip_file)
# Remove downloaded file
os.remove(redbearlib_zip_file)
else:
print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.'
print 'You may likely retrieve this package as follows:'
print ' sudo apt-get install dos2unix'
print ' or'
print ' sudo yum install dos2unix'
exit(1)
nordiclib_dir = arduinolib_dir + '/libraries/BLE'
if not os.path.exists(nordiclib_dir):
nordiclib_zip_file = src_dir + '/extlibs/arduino/ble-sdk-arduino-0.9.5.beta.zip'
nordiclib_url = 'https://github.com/NordicSemiconductor/ble-sdk-arduino/archive/0.9.5.beta.zip'
if not os.path.exists(nordiclib_zip_file):
nordiclib_zip = env.Download(nordiclib_zip_file, nordiclib_url)
else:
nordiclib_zip = nordiclib_zip_file
# Unzip the lib
print 'Unzipping Nordic lib...'
os.chdir(arduinolib_dir + '/libraries')
env.UnpackAll(nordiclib_dir, nordiclib_zip)
# Because the way Nordic lib is distributed... All Nordic source files must be moved up a few directories.
shutil.move('ble-sdk-arduino-0.9.5.beta/libraries/BLE/', '.')
shutil.rmtree('ble-sdk-arduino-0.9.5.beta')
# Apply Nordic lib patches
print 'Patching Nordic library...'
os.chdir(arduinolib_dir + '/libraries/BLE/')
os.system("find . -type f -exec dos2unix {} \;")
os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_due_ble.patch")
if WhereIs('dos2unix') is not None:
nordiclib_zip_file = src_dir + '/extlibs/arduino/ble-sdk-arduino-0.9.5.beta.zip'
nordiclib_url = 'https://github.com/NordicSemiconductor/ble-sdk-arduino/archive/0.9.5.beta.zip'
if not os.path.exists(nordiclib_zip_file):
nordiclib_zip = env.Download(nordiclib_zip_file, nordiclib_url)
else:
nordiclib_zip = nordiclib_zip_file
# Unzip the lib
print 'Unzipping Nordic lib...'
os.chdir(arduinolib_dir + '/libraries')
env.UnpackAll(nordiclib_dir, nordiclib_zip)
# Because the way Nordic lib is distributed... All Nordic source files must be moved up a few directories.
shutil.move('ble-sdk-arduino-0.9.5.beta/libraries/BLE/', '.')
shutil.rmtree('ble-sdk-arduino-0.9.5.beta')
# Apply Nordic lib patches
print 'Patching Nordic library...'
os.chdir(arduinolib_dir + '/libraries/BLE/')
os.system("find . -type f -exec dos2unix {} \;")
os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_due_ble.patch")
# Remove downloaded file
os.remove(nordiclib_zip_file)
# Remove downloaded file
os.remove(nordiclib_zip_file)
else:
print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.'
print 'You may likely retrieve this package as follows:'
print ' sudo apt-get install dos2unix'
print ' or'
print ' sudo yum install dos2unix'
exit(1)
# Set the ARDUINO_HOME
env.Replace(ARDUINO_HOME = arduinolib_dir)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment