Skip to content

Commit e8606ed

Browse files
committed
package.sh: explicitly list files to include in the package
Reduce the number of files included in the packaged core by explicitly listing the ones to include. This is achieved in two steps: - common files and directories that are always included in the core archive are listed in 'extra/package.lst'; - board-specific files are automatically added by 'package.sh' using the variants defined in 'boards.txt'.
1 parent 3c1cf99 commit e8606ed

File tree

4 files changed

+42
-7
lines changed

4 files changed

+42
-7
lines changed

.github/workflows/package_core.yml

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
- name: Package
5151
run: |
5252
./extra/package.sh ${{ env.CORE_TAG }}
53-
mv ../${{ env.CORE_ARTIFACT }}.tar.bz2 .
5453
5554
- name: Archive core
5655
uses: actions/upload-artifact@v4

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
extra/post_build_tool/distrib/
22
build/
33
venv/
4+
ArduinoCore-zephyr-*.tar.bz2

extra/package.lst

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file contains all the *static* files and directories that will be added
2+
# to any core package archive.
3+
#
4+
# NOTE: board-specific entries in the 'firmwares/' and 'variants/' directories
5+
# are automatically added by package.sh depending on the information in
6+
# 'boards.txt', so they should not be included here.
7+
8+
boards.txt
9+
platform.txt
10+
programmers.txt
11+
LICENSE
12+
README.md
13+
doc/
14+
cores/
15+
libraries/
16+
variants/_llext/
17+
variants/_linked/

extra/package.sh

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
#!/bin/bash
22

3-
if [ ! -f platform.txt ]; then
4-
echo Launch this script from the root core folder as ./extras/package.sh VERSION
5-
exit 2
3+
set -e
4+
5+
if [ -z "$1" ]; then
6+
echo "Usage: $0 VERSION"
7+
exit 1
68
fi
79

8-
FOLDER=`basename $PWD`
10+
if [ ! -f platform.txt ]; then
11+
echo "Launch this script from the root core folder as ./extra/package.sh VERSION"
12+
exit 2
13+
fi
914

15+
PACKAGE=ArduinoCore-zephyr
1016
VERSION=$1
1117

12-
cd ..
13-
tar --exclude=extras/** --exclude=.git* --exclude=build --exclude=venv --exclude=samples -cjhf ArduinoCore-zephyr-${VERSION}.tar.bz2 $FOLDER
18+
TEMP_LIST=$(mktemp)
19+
20+
# import a basic list of files and directories
21+
cat extra/package.lst | sed -e 's/\s*#.*//' | grep -v '^\s*$' > ${TEMP_LIST}
22+
23+
# add the board-specific files
24+
extra/get_board_details.sh | jq -cr '.[]' | while read -r item; do
25+
variant=$(jq -cr '.variant' <<< "$item")
26+
echo "variants/${variant}/" >> ${TEMP_LIST}
27+
ls firmwares/zephyr-${variant}.* >> ${TEMP_LIST}
28+
done
29+
cat ${TEMP_LIST}
30+
tar -cjhf ${PACKAGE}-${VERSION}.tar.bz2 -T ${TEMP_LIST} --transform "s,^,${PACKAGE}/,"
31+
rm -f ${TEMP_LIST}

0 commit comments

Comments
 (0)