1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Use jq to generate package json

This commit is contained in:
Ivan Grokhotkov 2015-10-30 17:40:17 +03:00
parent 4bd694bf61
commit 444a37987e
5 changed files with 209 additions and 201 deletions

2
.gitignore vendored
View File

@ -3,5 +3,5 @@ tools/dist/
tools/xtensa-lx106-elf/ tools/xtensa-lx106-elf/
tools/esptool/ tools/esptool/
tools/mkspiffs/ tools/mkspiffs/
versions/ package/versions/
exclude.txt exclude.txt

View File

@ -17,17 +17,16 @@ echo "Package name: $package_name"
# Create directory for the package # Create directory for the package
outdir=versions/$ver/$package_name outdir=versions/$ver/$package_name
srcdir=$PWD srcdir=$PWD/..
rm -rf versions/$ver rm -rf versions/$ver
mkdir -p $outdir mkdir -p $outdir
# Some files should be excluded from the package # Some files should be excluded from the package
cat << EOF > exclude.txt cat << EOF > exclude.txt
versions
.git .git
.gitignore .gitignore
.travis.yml .travis.yml
build_boards_manager_package.sh package
EOF EOF
# Also include all files which are ignored by git # Also include all files which are ignored by git
git ls-files --other --ignored --exclude-standard --directory >> exclude.txt git ls-files --other --ignored --exclude-standard --directory >> exclude.txt
@ -71,76 +70,13 @@ echo Size: $size
echo SHA-256: $sha echo SHA-256: $sha
echo "Making package_esp8266com_index.json" echo "Making package_esp8266com_index.json"
cat << EOF > package_esp8266com_index.json cat $srcdir/package/package_esp8266com_index.template.json | \
{ jq ".packages[0].platforms[0].version = \"$ver\" | \
"packages": [ { .packages[0].platforms[0].url = \"$REMOTE_URL/versions/$ver/$package_name.zip\" |\
"name":"esp8266", .packages[0].platforms[0].archiveFileName = \"$package_name.zip\" |\
"maintainer":"ESP8266 Community", .packages[0].platforms[0].checksum = \"SHA-256:$sha\" |\
"websiteURL":"https://github.com/esp8266/Arduino", .packages[0].platforms[0].size = \"$size\" |\
"email":"ivan@esp8266.com", .packages[0].platforms[0].help.online = \"$REMOTE_URL/versions/$ver/doc/reference.html\"" \
"help":{ > package_esp8266com_index.json
"online":"$REMOTE_URL/versions/$ver/doc/reference.html"
},
"platforms": [ {
"name":"esp8266",
"architecture":"esp8266",
"version":"$ver",
"category":"ESP8266",
"url":"$REMOTE_URL/versions/$ver/$package_name.zip",
"archiveFileName":"$package_name.zip",
"checksum":"SHA-256:$sha",
"size":"$size",
"help":{
"online":"$REMOTE_URL/versions/$ver/doc/reference.html"
},
"boards":[
{
"name":"Generic ESP8266 Module"
},
{
"name":"Olimex MOD-WIFI-ESP8266(-DEV)"
},
{
"name":"NodeMCU 0.9 (ESP-12 Module)"
},
{
"name":"NodeMCU 1.0 (ESP-12E Module)"
},
{
"name":"Adafruit HUZZAH ESP8266 (ESP-12)"
},
{
"name":"SparkFun Thing"
},
{
"name":"SweetPea ESP-210"
}
],
"toolsDependencies":[ {
"packager":"esp8266",
"name":"esptool",
"version":"0.4.6"
},
{
"packager":"esp8266",
"name":"xtensa-lx106-elf-gcc",
"version":"1.20.0-26-gb404fb9-2"
},
{
"packager":"esp8266",
"name":"mkspiffs",
"version":"0.1.2"
} ]
} ],
"tools":
EOF
cat $srcdir/tools/tools.json >> package_esp8266com_index.json
cat << EOF >> package_esp8266com_index.json
} ]
}
EOF
popd popd

View File

@ -0,0 +1,193 @@
{
"packages": [
{
"name": "esp8266",
"maintainer": "ESP8266 Community",
"websiteURL": "https://github.com/esp8266/Arduino",
"email": "ivan@esp8266.com",
"help": {
"online": "http://esp8266.com/arduino"
},
"platforms": [
{
"name": "esp8266",
"architecture": "esp8266",
"version": "",
"category": "ESP8266",
"url": "",
"archiveFileName": "",
"checksum": "",
"size": "",
"help": {
"online": ""
},
"boards": [
{
"name": "Generic ESP8266 Module"
},
{
"name": "Olimex MOD-WIFI-ESP8266(-DEV)"
},
{
"name": "NodeMCU 0.9 (ESP-12 Module)"
},
{
"name": "NodeMCU 1.0 (ESP-12E Module)"
},
{
"name": "Adafruit HUZZAH ESP8266 (ESP-12)"
},
{
"name": "SparkFun Thing"
},
{
"name": "SweetPea ESP-210"
}
],
"toolsDependencies": [
{
"packager": "esp8266",
"name": "esptool",
"version": "0.4.6"
},
{
"packager": "esp8266",
"name": "xtensa-lx106-elf-gcc",
"version": "1.20.0-26-gb404fb9-2"
},
{
"packager": "esp8266",
"name": "mkspiffs",
"version": "0.1.2"
}
]
}
],
"tools": [
{
"name": "esptool",
"version": "0.4.6",
"systems": [
{
"host": "i686-mingw32",
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-win32.zip",
"archiveFileName": "esptool-0.4.6-win32.zip",
"checksum": "SHA-256:0248bf78514a3195f583e29218ca7828a66e13c6e5545a078f1c1257033e4927",
"size": "17481"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-osx.tar.gz",
"archiveFileName": "esptool-0.4.6-osx.tar.gz",
"checksum": "SHA-256:0fe87ba7e29ee90a9fc72492aada8c0796f9e8f8a1c594b6b26cee2610d09bb3",
"size": "20926"
},
{
"host": "i386-apple-darwin",
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-osx.tar.gz",
"archiveFileName": "esptool-0.4.6-osx.tar.gz",
"checksum": "SHA-256:0fe87ba7e29ee90a9fc72492aada8c0796f9e8f8a1c594b6b26cee2610d09bb3",
"size": "20926"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-linux64.tar.gz",
"archiveFileName": "esptool-0.4.6-linux64.tar.gz",
"checksum": "SHA-256:f9f456e9a42bb2597126c513cb8865f923fb978865d4838b9623d322216b74d0",
"size": "12885"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-linux32.tar.gz",
"archiveFileName": "esptool-0.4.6-linux32.tar.gz",
"checksum": "SHA-256:85275ca03a82bfc456f5a84e86962ca1e470ea2e168829c38ca29ee668831d93",
"size": "13417"
}
]
},
{
"name": "xtensa-lx106-elf-gcc",
"version": "1.20.0-26-gb404fb9-2",
"systems": [
{
"host": "i686-mingw32",
"url": "http://arduino.esp8266.com/win32-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"archiveFileName": "win32-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"checksum": "SHA-256:10476b9c11a7a90f40883413ddfb409f505b20692e316c4e597c4c175b4be09c",
"size": "153527527"
},
{
"host": "x86_64-apple-darwin",
"url": "http://arduino.esp8266.com/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"archiveFileName": "osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"checksum": "SHA-256:0cf150193997bd1355e0f49d3d49711730035257bc1aee1eaaad619e56b9e4e6",
"size": "35385382"
},
{
"host": "i386-apple-darwin",
"url": "http://arduino.esp8266.com/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"archiveFileName": "osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"checksum": "SHA-256:0cf150193997bd1355e0f49d3d49711730035257bc1aee1eaaad619e56b9e4e6",
"size": "35385382"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "http://arduino.esp8266.com/linux64-xtensa-lx106-elf-gb404fb9.tar.gz",
"archiveFileName": "linux64-xtensa-lx106-elf-gb404fb9.tar.gz",
"checksum": "SHA-256:46f057fbd8b320889a26167daf325038912096d09940b2a95489db92431473b7",
"size": "30262903"
},
{
"host": "i686-pc-linux-gnu",
"url": "http://arduino.esp8266.com/linux32-xtensa-lx106-elf.tar.gz",
"archiveFileName": "linux32-xtensa-lx106-elf.tar.gz",
"checksum": "SHA-256:b24817819f0078fb05895a640e806e0aca9aa96b47b80d2390ac8e2d9ddc955a",
"size": "32734156"
}
]
},
{
"name": "mkspiffs",
"version": "0.1.2",
"systems": [
{
"host": "i686-mingw32",
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-windows.zip",
"archiveFileName": "mkspiffs-0.1.2-windows.zip",
"checksum": "SHA-256:0a29119b8458b61a877408f7995e4944623a712e0d313a2c2f76af9ab55cc9f2",
"size": "230802"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-osx.tar.gz",
"archiveFileName": "mkspiffs-0.1.2-osx.tar.gz",
"checksum": "SHA-256:df656fae21a41c1269ea50cb53752dcaf6a4e1437255f3a9fb50b4025549b58e",
"size": "115091"
},
{
"host": "i386-apple-darwin",
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-osx.tar.gz",
"archiveFileName": "mkspiffs-0.1.2-osx.tar.gz",
"checksum": "SHA-256:df656fae21a41c1269ea50cb53752dcaf6a4e1437255f3a9fb50b4025549b58e",
"size": "115091"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-linux64.tar.gz",
"archiveFileName": "mkspiffs-0.1.2-linux64.tar.gz",
"checksum": "SHA-256:1a1dd81b51daf74c382db71b42251757ca4136e8762107e69feaa8617bac315f",
"size": "46281"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-linux32.tar.gz",
"archiveFileName": "mkspiffs-0.1.2-linux32.tar.gz",
"checksum": "SHA-256:e990d545dfcae308aabaac5fa9e1db734cc2b08167969e7eedac88bd0839667c",
"size": "45272"
}
]
}
]
}
]
}

View File

@ -6,6 +6,7 @@
from __future__ import print_function from __future__ import print_function
import urllib import urllib
import os import os
import shutil
import errno import errno
import os.path import os.path
import hashlib import hashlib
@ -56,7 +57,8 @@ def unpack(filename, destination):
rename_to = re.match(r'^([a-z][^\-]*\-*)+', dirname).group(0).encode('ascii').strip('-') rename_to = re.match(r'^([a-z][^\-]*\-*)+', dirname).group(0).encode('ascii').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))
os.rename(dirname, rename_to) shutil.rmtree(rename_to)
shutil.move(dirname, rename_to)
def get_tool(tool): def get_tool(tool):
archive_name = tool['archiveFileName'] archive_name = tool['archiveFileName']
@ -77,7 +79,7 @@ def get_tool(tool):
unpack(local_path, '.') unpack(local_path, '.')
def load_tools_list(filename, platform): def load_tools_list(filename, platform):
tools_info = json.load(open(filename)) tools_info = json.load(open(filename))['packages'][0]['tools']
tools_to_download = [] tools_to_download = []
for t in tools_info: for t in tools_info:
tool_platform = [p for p in t['systems'] if p['host'] == platform] tool_platform = [p for p in t['systems'] if p['host'] == platform]
@ -97,7 +99,7 @@ def identify_platform():
if __name__ == '__main__': if __name__ == '__main__':
print('Platform: {0}'.format(identify_platform())) print('Platform: {0}'.format(identify_platform()))
tools_to_download = load_tools_list('tools.json', identify_platform()) tools_to_download = load_tools_list('../package/package_esp8266com_index.template.json', identify_platform())
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)

View File

@ -1,123 +0,0 @@
[ {
"name":"esptool",
"version":"0.4.6",
"systems": [
{
"host":"i686-mingw32",
"url":"https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-win32.zip",
"archiveFileName":"esptool-0.4.6-win32.zip",
"checksum":"SHA-256:0248bf78514a3195f583e29218ca7828a66e13c6e5545a078f1c1257033e4927",
"size":"17481"
},
{
"host":"x86_64-apple-darwin",
"url":"https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-osx.tar.gz",
"archiveFileName":"esptool-0.4.6-osx.tar.gz",
"checksum":"SHA-256:0fe87ba7e29ee90a9fc72492aada8c0796f9e8f8a1c594b6b26cee2610d09bb3",
"size":"20926"
},
{
"host":"i386-apple-darwin",
"url":"https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-osx.tar.gz",
"archiveFileName":"esptool-0.4.6-osx.tar.gz",
"checksum":"SHA-256:0fe87ba7e29ee90a9fc72492aada8c0796f9e8f8a1c594b6b26cee2610d09bb3",
"size":"20926"
},
{
"host":"x86_64-pc-linux-gnu",
"url":"https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-linux64.tar.gz",
"archiveFileName":"esptool-0.4.6-linux64.tar.gz",
"checksum":"SHA-256:f9f456e9a42bb2597126c513cb8865f923fb978865d4838b9623d322216b74d0",
"size":"12885"
},
{
"host":"i686-pc-linux-gnu",
"url":"https://github.com/igrr/esptool-ck/releases/download/0.4.6/esptool-0.4.6-linux32.tar.gz",
"archiveFileName":"esptool-0.4.6-linux32.tar.gz",
"checksum":"SHA-256:85275ca03a82bfc456f5a84e86962ca1e470ea2e168829c38ca29ee668831d93",
"size":"13417"
}
]
},
{
"name":"xtensa-lx106-elf-gcc",
"version":"1.20.0-26-gb404fb9-2",
"systems": [
{
"host":"i686-mingw32",
"url":"http://arduino.esp8266.com/win32-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"archiveFileName":"win32-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"checksum":"SHA-256:10476b9c11a7a90f40883413ddfb409f505b20692e316c4e597c4c175b4be09c",
"size":"153527527"
},
{
"host":"x86_64-apple-darwin",
"url":"http://arduino.esp8266.com/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"archiveFileName":"osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"checksum":"SHA-256:0cf150193997bd1355e0f49d3d49711730035257bc1aee1eaaad619e56b9e4e6",
"size":"35385382"
},
{
"host":"i386-apple-darwin",
"url":"http://arduino.esp8266.com/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"archiveFileName":"osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"checksum":"SHA-256:0cf150193997bd1355e0f49d3d49711730035257bc1aee1eaaad619e56b9e4e6",
"size":"35385382"
},
{
"host":"x86_64-pc-linux-gnu",
"url":"http://arduino.esp8266.com/linux64-xtensa-lx106-elf-gb404fb9.tar.gz",
"archiveFileName":"linux64-xtensa-lx106-elf-gb404fb9.tar.gz",
"checksum":"SHA-256:46f057fbd8b320889a26167daf325038912096d09940b2a95489db92431473b7",
"size":"30262903"
},
{
"host":"i686-pc-linux-gnu",
"url":"http://arduino.esp8266.com/linux32-xtensa-lx106-elf.tar.gz",
"archiveFileName":"linux32-xtensa-lx106-elf.tar.gz",
"checksum":"SHA-256:b24817819f0078fb05895a640e806e0aca9aa96b47b80d2390ac8e2d9ddc955a",
"size":"32734156"
}
]
},
{
"name":"mkspiffs",
"version":"0.1.2",
"systems": [
{
"host":"i686-mingw32",
"url":"https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-windows.zip",
"archiveFileName":"mkspiffs-0.1.2-windows.zip",
"checksum":"SHA-256:0a29119b8458b61a877408f7995e4944623a712e0d313a2c2f76af9ab55cc9f2",
"size":"230802"
},
{
"host":"x86_64-apple-darwin",
"url":"https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-osx.tar.gz",
"archiveFileName":"mkspiffs-0.1.2-osx.tar.gz",
"checksum":"SHA-256:df656fae21a41c1269ea50cb53752dcaf6a4e1437255f3a9fb50b4025549b58e",
"size":"115091"
},
{
"host":"i386-apple-darwin",
"url":"https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-osx.tar.gz",
"archiveFileName":"mkspiffs-0.1.2-osx.tar.gz",
"checksum":"SHA-256:df656fae21a41c1269ea50cb53752dcaf6a4e1437255f3a9fb50b4025549b58e",
"size":"115091"
},
{
"host":"x86_64-pc-linux-gnu",
"url":"https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-linux64.tar.gz",
"archiveFileName":"mkspiffs-0.1.2-linux64.tar.gz",
"checksum":"SHA-256:1a1dd81b51daf74c382db71b42251757ca4136e8762107e69feaa8617bac315f",
"size":"46281"
},
{
"host":"i686-pc-linux-gnu",
"url":"https://github.com/igrr/mkspiffs/releases/download/0.1.2/mkspiffs-0.1.2-linux32.tar.gz",
"archiveFileName":"mkspiffs-0.1.2-linux32.tar.gz",
"checksum":"SHA-256:e990d545dfcae308aabaac5fa9e1db734cc2b08167969e7eedac88bd0839667c",
"size":"45272"
}
]
} ]