Skip to content

Commit 861cff6

Browse files
committed
top: Initial commit.
Signed-off-by: Damien George <[email protected]>
0 parents  commit 861cff6

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Alif Security Toolkit
2+
=====================
3+
4+
This repository contains a copy of the Alif Security Toolkit, for Alif
5+
Semiconductor microcontrollers. Minor changes are applied to the Toolkit to
6+
make it easier to use within a wider project.
7+
8+
The "vendor" branch contains the original Toolkit source and is updated from
9+
time-to-time when new versions become available. The commits in the "vendor"
10+
branch are tagged as appropriate with a tag that describes the Toolkit release
11+
at that commit, for example v1.104.0.
12+
13+
There are then working branches that branch at a given vendor tag and apply
14+
minor patches to the vendor code, for example work-v1.104.0. The commits that
15+
form a given working branch are reapplied (with conflict resolution) to newer
16+
vendor tags to create the next working branch.
17+
18+
Original sources
19+
================
20+
21+
The sources are obtained from Alif Semiconductor, and placed in the `toolkit`
22+
directory.
23+
24+
The provided `fetch_from_upstream.sh` script can be used to copy and process a
25+
new Toolkit release into this repository. It does some cleaning and formatting
26+
of the Toolkit source files to make them more uniform.

fetch_from_upstream.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
#
3+
# Fetch new code for the Alif Security Toolkit, and clean it up a little.
4+
5+
if [ $# -ne 1 ]; then
6+
echo "usage: $0 <src>"
7+
echo ""
8+
echo "eg: $0 path/to/app-release"
9+
exit 1
10+
fi
11+
12+
alifsrc=$1
13+
alifdest=./toolkit/
14+
15+
if [ ! -f $alifsrc/maintenance.py ]; then
16+
echo "ERROR: $alifsrc does not contain an Alif Security Toolkit"
17+
exit 1
18+
fi
19+
20+
# Remove any old files and copy across the new ones.
21+
echo "Fetching Alif Security Toolkit"
22+
rm -rf $alifdest
23+
mkdir -p $alifdest
24+
cp -r $alifsrc/* $alifdest
25+
26+
# Remove __pycache__.
27+
rm -rf `find $alifdest -name __pycache__`
28+
29+
# Convert newlines to Unix style, and ensure there's a newline at the end of the file.
30+
for file in `find $alifdest -regex '.+\.\(py\|txt\|json\)'`; do
31+
cat $file | sed 's/$//' | sed '$a\' > tmp$$
32+
/bin/mv tmp$$ $file
33+
done
34+
35+
# Make sure permission flags are sensible.
36+
for file in `find $alifdest -type f`; do
37+
if grep -q argparse $file; then
38+
chmod 755 $file
39+
else
40+
chmod 644 $file
41+
fi
42+
done
43+
44+
# Format Python code.
45+
ruff format `find $alifdest -name \*.py`

0 commit comments

Comments
 (0)