Skip to content

Commit 886ce9b

Browse files
committed
BPT maintenance and board def updates
1 parent 6bc385e commit 886ce9b

7 files changed

+171
-39
lines changed

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,22 @@ The current selected board needs the core 'arduino:arduino' that is not installe
1717
## List of 3rd Party Boards
1818

1919
https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls
20+
21+
## Command to update / build the MySensors board package
22+
23+
The scripts are written in Python and require Python 3.4 or later.
24+
```
25+
pip3 install --user click gitpython
26+
```
27+
28+
Run the check-updates command to have the tool scan the source package repositories and compare their platform.txt versions to the versions published in the board index. The tool will alert you of packages which are not up to date in the index. Run the tool as follows (use python, not python3 on Windows in all the subsequent commands):
29+
```
30+
python bpt.py check-updates
31+
```
32+
33+
To update the MySensors packages run the following commands:
34+
```
35+
python bpt.py update-index "MySensors AVR Boards"
36+
python bpt.py update-index "MySensors SAMD Boards"
37+
python bpt.py update-index "MySensors nRF5 Boards"
38+
```

boards/mysensors-avr-1.0.3.tar.bz2

49.5 KB
Binary file not shown.

boards/mysensors-samd-1.0.6.tar.bz2

175 KB
Binary file not shown.

bpt.ini

+51-25
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,30 @@ index_template =
4949
"checksum":"SHA-256:{sha256}",
5050
"size":"{size}",
5151
"help":{{
52-
"online":"https://forums.mysensors.org"
52+
"online":"https://forum.mysensors.org"
5353
}},
5454
"boards":[
5555
{{
5656
"name":"Sensebender Micro"
5757
}}
5858
],
59-
"toolsDependencies":[]
59+
"toolsDependencies": [
60+
{{
61+
"packager": "arduino",
62+
"name": "avr-gcc",
63+
"version": "5.4.0-atmel3.6.1-arduino2"
64+
}},
65+
{{
66+
"packager": "arduino",
67+
"name": "avrdude",
68+
"version": "6.3.0-arduino14"
69+
}},
70+
{{
71+
"packager": "arduino",
72+
"name": "arduinoOTA",
73+
"version": "1.2.1"
74+
}}
75+
]
6076
}}
6177

6278
[MySensors SAMD Boards]
@@ -74,35 +90,45 @@ index_template =
7490
"checksum":"SHA-256:{sha256}",
7591
"size":"{size}",
7692
"help":{{
77-
"online":"https://forums.mysensors.org"
93+
"online":"https://forum.mysensors.org"
7894
}},
7995
"boards":[
8096
{{
8197
"name":"Sensebender GW"
8298
}}
8399
],
84100
"toolsDependencies": [
85-
{{
86-
"packager": "arduino",
87-
"name": "arm-none-eabi-gcc",
88-
"version": "4.8.3-2014q1"
89-
}},
90-
{{
91-
"packager": "arduino",
92-
"name": "bossac",
93-
"version": "1.6.1-arduino"
94-
}},
95-
{{
96-
"packager": "arduino",
97-
"name": "openocd",
98-
"version": "0.9.0-arduino"
99-
}},
100-
{{
101-
"packager": "arduino",
102-
"name": "CMSIS",
103-
"version": "4.0.0-atmel"
104-
}}
105-
]
101+
{{
102+
"packager": "arduino",
103+
"name": "arm-none-eabi-gcc",
104+
"version": "7-2017q4"
105+
}},
106+
{{
107+
"packager": "arduino",
108+
"name": "bossac",
109+
"version": "1.7.0-arduino3"
110+
}},
111+
{{
112+
"packager": "arduino",
113+
"name": "openocd",
114+
"version": "0.10.0-arduino7"
115+
}},
116+
{{
117+
"packager": "arduino",
118+
"name": "CMSIS",
119+
"version": "4.5.0"
120+
}},
121+
{{
122+
"packager": "arduino",
123+
"name": "CMSIS-Atmel",
124+
"version": "1.2.0"
125+
}},
126+
{{
127+
"packager": "arduino",
128+
"name": "arduinoOTA",
129+
"version": "1.2.1"
130+
}}
131+
]
106132
}}
107133

108134
[MySensors nRF5 Boards]
@@ -120,7 +146,7 @@ index_template =
120146
"checksum":"SHA-256:{sha256}",
121147
"size":"{size}",
122148
"help":{{
123-
"online":"https://forums.mysensors.org"
149+
"online":"https://forum.mysensors.org"
124150
}},
125151
"boards":[
126152
{{

bpt.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2424
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525
import json
26-
import SimpleHTTPServer
27-
import SocketServer
26+
import http.server
27+
import socketserver
2828

2929
from bpt_model import *
3030
import click
@@ -111,12 +111,13 @@ def check_updates(ctx):
111111
version = package.get_version()
112112
click.echo('- {0}'.format(name))
113113
# Get all the associated packages in the board index.
114-
index_packages = ctx.obj.board_index.get_platforms(parent, name)
114+
index_packages = list(ctx.obj.board_index.get_platforms(parent, name))
115115
# Skip to the next package if nothing was found in the board index for this package.
116116
if len(index_packages) == 0:
117117
click.echo(' Not found in board index!')
118118
continue
119119
# Find the most recent version in the index packages.
120+
#print(index_packages)
120121
latest = max(map(lambda x: parse_version(x.get('version', '')), index_packages))
121122
click.echo(' latest index version = {0}'.format(str(latest)))
122123
# Warn if the latest published package is older than the current package
@@ -162,8 +163,8 @@ def update_index(ctx, package_name, force, output_board_index, output_board_dir)
162163
# has a newer version than in the index.
163164
if not force:
164165
# Get all the associated packages in the board index.
165-
index_packages = ctx.obj.board_index.get_platforms(package.get_parent(),
166-
package.get_name())
166+
index_packages = list(ctx.obj.board_index.get_platforms(package.get_parent(),
167+
package.get_name()))
167168
# Do version check if packages were found in the index.
168169
if len(index_packages) > 0:
169170
# Find the most recent version in the index packages.
@@ -234,7 +235,7 @@ def test_server(ctx, url_transform, port):
234235
with open(test_index, 'w') as bi:
235236
bi.write(ctx.obj.board_index.write_json())
236237
try:
237-
server = SocketServer.TCPServer(('', port), SimpleHTTPServer.SimpleHTTPRequestHandler)
238+
server = socketserver.TCPServer(('', port), http.server.SimpleHTTPRequestHandler)
238239
click.echo('Source board index file: {0}'.format(ctx.obj.board_index_file))
239240
click.echo('Test server listening at: http://localhost:{0}'.format(port))
240241
click.echo('Configure Arduino to use the following board package URL:')
@@ -257,4 +258,4 @@ def test_server(ctx, url_transform, port):
257258
# file locations, etc.
258259
if context.board_packages is not None:
259260
for package in context.board_packages:
260-
package.close()
261+
package.close()

bpt_model.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2222
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2323
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24-
import ConfigParser
24+
import configparser
2525
import hashlib
2626
import json
2727
import logging
@@ -148,11 +148,12 @@ def write_archive(self, target):
148148
SHA256 hash).
149149
"""
150150
# Create .tar.bz2 archive of the package directory.
151+
# Put files inside a folder with same name as archive (minus extension)
152+
arcname = os.path.basename(target)[:-len('.tar.bz2')]
151153
with tarfile.open(target, 'w:bz2') as archive:
152154
archive.add(self._directory,
153-
# Put files inside a folder with same name as archive (minus extension)
154-
arcname=os.path.basename(target)[:-len('.tar.bz2')],
155-
exclude=lambda x: x.startswith('.git')) # Don't add .git folder!
155+
arcname=arcname,
156+
filter=lambda x: None if x.name.startswith(arcname + '/.git') else x) # Don't add .git folder!
156157
# Get the size of the archive.
157158
size = os.stat(target).st_size
158159
# Generate a SHA256 hash of the archive.
@@ -281,7 +282,7 @@ def __init__(self, board_config):
281282
"""
282283
self._packages = []
283284
# Load the INI file and process all the sections.
284-
self._config = ConfigParser.RawConfigParser()
285+
self._config = configparser.RawConfigParser()
285286
self._config.read([board_config])
286287
for section in self._config.sections():
287288
logger.debug('Processing config file {0} section {1}'.format(board_config, section))
@@ -323,10 +324,10 @@ def get_package(self, package):
323324
"""Return the specified package (by name), or None if it does not exist
324325
in the config.
325326
"""
326-
packages = filter(lambda x: x.get_name() == package, self._packages)
327+
packages = list(filter(lambda x: x.get_name() == package, self._packages))
327328
if len(packages) == 0:
328329
return None
329330
elif len(packages) == 1:
330331
return packages[0]
331332
else:
332-
raise RuntimeError('Found multiple packages with same name in config, ambiguous result!')
333+
raise RuntimeError('Found multiple packages with same name in config, ambiguous result!')

package_mysensors.org_index.json

+85
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,91 @@
369369
],
370370
"toolsDependencies": [],
371371
"size": "144923"
372+
},
373+
{
374+
"name": "MySensors AVR Boards",
375+
"architecture": "avr",
376+
"version": "1.0.3",
377+
"category": "Contributed",
378+
"url": "https://github.com/mysensors/ArduinoBoards/raw/master/boards/mysensors-avr-1.0.3.tar.bz2",
379+
"archiveFileName": "mysensors-avr-1.0.3.tar.bz2",
380+
"checksum": "SHA-256:b4fad46657ae03b25c1d5154f62bc60b515397f2d0209d106e66bd4fe412c56c",
381+
"size": "50686",
382+
"help": {
383+
"online": "https://forum.mysensors.org"
384+
},
385+
"boards": [
386+
{
387+
"name": "Sensebender Micro"
388+
}
389+
],
390+
"toolsDependencies": [
391+
{
392+
"packager": "arduino",
393+
"name": "avr-gcc",
394+
"version": "5.4.0-atmel3.6.1-arduino2"
395+
},
396+
{
397+
"packager": "arduino",
398+
"name": "avrdude",
399+
"version": "6.3.0-arduino14"
400+
},
401+
{
402+
"packager": "arduino",
403+
"name": "arduinoOTA",
404+
"version": "1.2.1"
405+
}
406+
]
407+
},
408+
{
409+
"name": "MySensors SAMD Boards",
410+
"architecture": "samd",
411+
"version": "1.0.6",
412+
"category": "Contributed",
413+
"url": "https://github.com/mysensors/ArduinoBoards/raw/master/boards/mysensors-samd-1.0.6.tar.bz2",
414+
"archiveFileName": "mysensors-samd-1.0.6.tar.bz2",
415+
"checksum": "SHA-256:7f520244bfacf70c47e039dbd403602a1e37670e7dd0edd42882a9f0740dea01",
416+
"size": "179021",
417+
"help": {
418+
"online": "https://forum.mysensors.org"
419+
},
420+
"boards": [
421+
{
422+
"name": "Sensebender GW"
423+
}
424+
],
425+
"toolsDependencies": [
426+
{
427+
"packager": "arduino",
428+
"name": "arm-none-eabi-gcc",
429+
"version": "7-2017q4"
430+
},
431+
{
432+
"packager": "arduino",
433+
"name": "bossac",
434+
"version": "1.7.0-arduino3"
435+
},
436+
{
437+
"packager": "arduino",
438+
"name": "openocd",
439+
"version": "0.10.0-arduino7"
440+
},
441+
{
442+
"packager": "arduino",
443+
"name": "CMSIS",
444+
"version": "4.5.0"
445+
},
446+
{
447+
"packager": "arduino",
448+
"name": "CMSIS-Atmel",
449+
"version": "1.2.0"
450+
},
451+
{
452+
"packager": "arduino",
453+
"name": "arduinoOTA",
454+
"version": "1.2.1"
455+
}
456+
]
372457
}
373458
],
374459
"tools": [],

0 commit comments

Comments
 (0)