Move to MANIFEST.JSON

This commit is contained in:
Thomas Farstrike
2025-05-07 16:11:32 +02:00
parent 7cd208411d
commit 9cb146bce6
14 changed files with 190 additions and 94 deletions
+1
View File
@@ -2,6 +2,7 @@
=====
- Move from MANIFEST.MF to MANIFEST.JSON format for apps
- wificonf: scan and connect to wifi in background thread so app stays responsive
- appstore: improve icon download handling
0.0.2
=====
+140 -70
View File
@@ -1,72 +1,142 @@
[
{
"name": "Animation Tester",
"publisher": "ACME Inc",
"short_description": "Testing on-display animations",
"long_description": "Stress testing multiple concurrent animations on the display by adding more and more spinners",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk",
"fullname": "com.example.lvgltest",
"version": "0.0.1"
},
{
"name": "BTC Ticker",
"publisher": "ACME Inc",
"short_description": "Bitcoin Price Ticker",
"long_description": "Uses a websocket to show the current price of Bitcoin in US Dollar.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk",
"fullname": "com.example.btcticker",
"version": "0.0.1"
},
{
"name": "Camera Tester",
"publisher": "ACME Inc",
"short_description": "Simple test of the camera",
"long_description": "A simple test of the camera makes it possible to validate the hardware.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk",
"fullname": "com.example.camtest",
"version": "0.0.2"
},
{
"name": "CPU Tester",
"publisher": "ACME Inc",
"short_description": "Testing the CPU speed",
"long_description": "Experimentally determines how many idle loops and sha256-hashing loops the CPU can perform per second.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk",
"fullname": "com.example.cputest",
"version": "0.0.1"
},
{
"name": "HelloWorld",
"publisher": "ACME Inc",
"short_description": "Minimal app",
"long_description": "Demonstrates the simplest app.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk",
"fullname": "com.example.memtest",
"version": "0.0.1"
},
{
"name": "IMU Tester",
"publisher": "ACME Inc",
"short_description": "Test the Inertial Measurement Unit",
"long_description": "It is always good to make sure the accelerometer is working properly. How else can you measure acceleration and position?",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk",
"fullname": "com.example.imutest",
"version": "0.0.1"
},
{
"name": "Memory Tester",
"publisher": "ACME Inc",
"short_description": "RAM Memory Test",
"long_description": "Experimentally determines how many RAM memory buffers can be allocated.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk",
"fullname": "com.example.memtest",
"version": "0.0.1"
}
{
"name": "BTC Ticker",
"publisher": "ACME Inc",
"short_description": "Bitcoin Price Ticker",
"long_description": "Uses a websocket to show the current price of Bitcoin in US Dollar.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk",
"fullname": "com.example.btcticker",
"version": "0.0.1",
"entrypoint": "assets/bitcoin_price.py",
"category": "money"
}
,{
"name": "Camera Tester",
"publisher": "ACME Inc",
"short_description": "Simple test of the camera",
"long_description": "A simple test of the camera makes it possible to validate the hardware.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk",
"fullname": "com.example.camtest",
"version": "0.0.2",
"entrypoint": "assets/camtest.py",
"category": "camera"
}
,{
"name": "CPU Tester",
"publisher": "ACME Inc",
"short_description": "Testing the CPU speed",
"long_description": "Experimentally determines how many idle loops and sha256-hashing loops the CPU can perform per second.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk",
"fullname": "com.example.cputest",
"version": "0.0.1",
"entrypoint": "assets/cputest.py",
"category": "benchmarking"
}
,{
"name": "HelloWorld",
"publisher": "ACME Inc",
"short_description": "Minimal app",
"long_description": "Demonstrates the simplest app.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk",
"fullname": "com.example.memtest",
"version": "0.0.1",
"entrypoint": "assets/hello.py",
"category": "development"
}
,{
"name": "IMU Tester",
"publisher": "ACME Inc",
"short_description": "Test the Inertial Measurement Unit",
"long_description": "It is always good to make sure the accelerometer is working properly. How else can you measure acceleration and position?",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk",
"fullname": "com.example.imutest",
"version": "0.0.1",
"entrypoint": "assets/imutest.py",
"category": "benchmarking"
}
,{
"name": "Animation Tester",
"publisher": "ACME Inc",
"short_description": "Testing on-display animations",
"long_description": "Stress testing multiple concurrent animations on the display by adding more and more spinners",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk",
"fullname": "com.example.lvgltest",
"version": "0.0.1",
"entrypoint": "assets/lvgltest.py",
"category": "benchmarking"
}
,{
"name": "Memory Tester",
"publisher": "ACME Inc",
"short_description": "RAM Memory Test",
"long_description": "Experimentally determines how many RAM memory buffers can be allocated.",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk",
"fullname": "com.example.memtest",
"version": "0.0.1",
"entrypoint": "assets/memtest.py"
"category": "benchmarking"
}
,{
"name": "AppStore",
"publisher": "ACME Inc",
"short_description": "Store for App(lication)s",
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.appstore_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.appstore_0.0.2.mpk",
"fullname": "com.example.appstore",
"version": "0.0.2",
"entrypoint": "assets/appstore.py",
"category": "appstore"
}
,{
"name": "Launcher",
"publisher": "ACME Inc",
"short_description": "Simple launcher to start apps.",
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.launcher_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.launcher_0.0.1.mpk",
"fullname": "com.example.launcher",
"version": "0.0.1",
"entrypoint": "assets/launcher.py",
"category": "launcher"
}
,{
"name": "OSUpdate",
"publisher": "ACME Inc",
"short_description": "Operating System Updater",
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk",
"fullname": "com.example.osupdate",
"version": "0.0.1",
"entrypoint": "assets/osupdate.py",
"category": "osupdate"
}
,{
"name": "WiFiConf",
"publisher": "ACME Inc",
"short_description": "Wireless Network Configuration",
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk",
"fullname": "com.example.wificonf",
"version": "0.0.2",
"entrypoint": "assets/wificonf.py",
"category": "wificonf"
}
]
@@ -7,6 +7,7 @@
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk",
"fullname": "com.example.btcticker",
"version": "0.0.1",
"entrypoint": "assets/bitcoin_price.py"
"entrypoint": "assets/bitcoin_price.py",
"category": "money"
}
@@ -7,6 +7,7 @@
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk",
"fullname": "com.example.camtest",
"version": "0.0.2",
"entrypoint": "assets/camtest.py"
"entrypoint": "assets/camtest.py",
"category": "camera"
}
@@ -7,6 +7,7 @@
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk",
"fullname": "com.example.cputest",
"version": "0.0.1",
"entrypoint": "assets/cputest.py"
"entrypoint": "assets/cputest.py",
"category": "benchmarking"
}
@@ -7,5 +7,6 @@
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk",
"fullname": "com.example.memtest",
"version": "0.0.1",
"entrypoint": "assets/hello.py"
"entrypoint": "assets/hello.py",
"category": "development"
}
@@ -7,5 +7,6 @@
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk",
"fullname": "com.example.imutest",
"version": "0.0.1",
"entrypoint": "assets/imutest.py"
"entrypoint": "assets/imutest.py",
"category": "benchmarking"
}
@@ -7,6 +7,7 @@
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk",
"fullname": "com.example.lvgltest",
"version": "0.0.1",
"entrypoint": "assets/lvgltest.py"
"entrypoint": "assets/lvgltest.py",
"category": "benchmarking"
}
@@ -8,4 +8,5 @@
"fullname": "com.example.memtest",
"version": "0.0.1",
"entrypoint": "assets/memtest.py"
"category": "benchmarking"
}
@@ -49,20 +49,22 @@ def is_installed_by_name(app_fullname):
return is_installed_by_path(f"/apps/{app_fullname}") or is_installed_by_path(f"/builtin/apps/{app_fullname}")
def download_icon(url):
print(f"downloading icon from {url}")
response = urequests.get(url, timeout=5)
if response.status_code == 200:
image_data = response.content
print("Downloaded image, size:", len(image_data), "bytes")
image_dsc = lv.image_dsc_t({
'data_size': len(image_data),
'data': image_data
})
return image_dsc
else:
print("Failed to download image: Status code", response.status_code)
return None
print(f"Downloading icon from {url}")
try:
response = urequests.get(url, timeout=5)
if response.status_code == 200:
image_data = response.content
print("Downloaded image, size:", len(image_data), "bytes")
image_dsc = lv.image_dsc_t({
'data_size': len(image_data),
'data': image_data
})
return image_dsc
else:
print("Failed to download image: Status code", response.status_code)
except Exception as e:
print(f"Exception during download of icon: {e}")
return None
try:
import zipfile
@@ -2,7 +2,7 @@
"name": "OSUpdate",
"publisher": "ACME Inc",
"short_description": "Operating System Updater",
"long_description": ""
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk",
"fullname": "com.example.osupdate",
@@ -2,7 +2,7 @@
"name": "WiFiConf",
"publisher": "ACME Inc",
"short_description": "Wireless Network Configuration",
"long_description": ""
"long_description": "",
"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk_icon_64x64.png",
"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk",
"fullname": "com.example.wificonf",
+1 -1
View File
@@ -265,7 +265,7 @@ def parse_manifest(manifest_path):
app_info=ujson.load(f)
name = app_info.get("name")
start_script = app_info.get("entrypoint")
print(f"parse_manifest: got app_info: {app_info}")
#print(f"parse_manifest: got app_info: {app_info}")
except OSError:
access_points={}
print(f"parse_manifest: error loading manifest_path: {manifest_path}")
+17 -1
View File
@@ -1,14 +1,24 @@
output=appstore_backend/bundled_apps/
outputjson=appstore_backend/apps.json
output=$(readlink -f "$output")
outputjson=$(readlink -f "$outputjson")
mkdir -p "$output"
rm "$output"/*.mpk
rm "$outputjson"
echo "[" | tee -a "$outputjson"
for apprepo in internal_filesystem/apps internal_filesystem/builtin/apps; do
echo "Listing apps in $apprepo"
ls -1 "$apprepo" | while read appdir; do
echo "Bundling $apprepo/$appdir"
pushd "$apprepo"/"$appdir"
version=$( grep "^Version:" META-INF/MANIFEST.MF | cut -d " " -f 2)
manifest=META-INF/MANIFEST.JSON
version=$( jq -r '.version' "$manifest" )
cat "$manifest" | tee -a "$outputjson"
echo -n "," | tee -a "$outputjson"
mpkname="$output"/"$appdir"_"$version".mpk
echo "Creating $mpkname"
zip -r0 "$mpkname" .
@@ -16,3 +26,9 @@ for apprepo in internal_filesystem/apps internal_filesystem/builtin/apps; do
popd
done
done
# remove the last , to have valid json:
truncate -s -1 "$outputjson"
echo "]" | tee -a "$outputjson"