Skip to content

Conversation

@martacarbone
Copy link
Contributor

Motivation

Currently the examples (and other static data) are stored inside the arduino home folder.
Current location: ~/.local/share/arduino-app-cli

This is needed because at some point the arduino-flasher-cli will support keeping user data, by preserving the user partition (where the arduino home folder is mounted). And we cannot keep some static data in the preserved paths, otherwise that data would not match the software version that gets installed in the root partition (which is not preserved).

Change description

/home/arduino/.local/share/arduino-app-cli/assets -> /var/lib/arduino-app-cli/assets
/home/arduino/.local/share/arduino-app-cli/examples -> /var/lib/arduino-app-cli/examples
/home/arduino/.local/share/arduino-app-cli/bootloader_burned.flag -> /var/lib/arduino-app-cli/bootloader_burned.flag
/home/arduino/.local/share/arduino-app-cli/properties.msgpack -> /var/lib/arduino-app-cli/properties.msgpack

Additional Notes

The installation scripts try to gracefully stop any runner application and delete the .cache directory, allowing the packaging system to clean the installed files.

Test

Case test #1 fresh install

# Test from a clean system, expected no package installed, empty local dir
dpkg -l |grep arduino-app-cli;
ls -la /home/arduino/.local;
# going to install
sudo dpkg --install arduino-app-cli_0.9.0-1_arm64.deb ;
# expect no .local, expected examples and assets in new dir
ls -la /home/arduino/.local/share/arduino-app-cli;
ls -la /var/lib/arduino-app-cli/;

Case test #2 purge after a fresh install

# check 0.9.0 installed
dpkg -l |grep arduino-app-cli
# Create caches
# Start blink
arduino-app-cli app start /var/lib/arduino-app-cli/examples/blink
# check cache
ls -la /var/lib/arduino-app-cli/examples/blink
# purge
sudo dpkg --purge arduino-app-cli
# check not installed
dpkg -l |grep arduino-app-cli
# check not exists
ls -la /var/lib/arduino-app-cli/
# this does not exists before too
ls -la /home/arduino/.local/share/arduino-app-cli

Case test #3 upgrade from 0.8.0 to 0.9.0

# old version should be installed
dpkg -l |grep arduino-app-cli
dpkg --install arduino-app-cli_0.8.0-1_arm64.deb
# expected
ls -la /home/arduino/.local/share/arduino-app-cli/examples/blink
# not expected
ls -la /var/lib/arduino-app-cli/examples/blink
# trigger cache creation, start app
arduino-app-cli app start  /home/arduino/.local/share/arduino-app-cli/examples/blink
# expected to see .cache
ls -la /home/arduino/.local/share/arduino-app-cli/examples/blink
# here no .cache
ls -la /home/arduino/.local/share/arduino-app-cli/examples/code-detector/
# run upgrade
sudo apt install ./arduino-app-cli_0.9.0-1_arm64.deb
# test upgrade results
# check new package is installed
dpkg -l |grep arduino-app-cli
# check for .cache removal
ls -la /home/arduino/.local/share/arduino-app-cli/examples/blink
# here all should be fine
find /home/arduino/.local/share/arduino-app-cli/
# check new file installation
# expected assets and examples
ls -la /var/lib/arduino-app-cli
# run blink
arduino-app-cli app start  /var/lib/arduino-app-cli/examples/blink
# verify .cache is created in the new dir (the old one not exists, the new one has .cache)
ls -la /home/arduino/.local/share/arduino-app-cli/examples/blink
ls -la /var/lib/arduino-app-cli/examples/blink

Reviewer checklist

  • PR addresses a single concern.
  • PR title and description are properly filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant