OpenRoberta / robertalab-ev3dev

roberta lab connector for ev3dev
Apache License 2.0
17 stars 14 forks source link

handle updates automatically #19

Closed ensonic closed 4 years ago

ensonic commented 8 years ago

The robots sends its client library version along with the connection to the server. If the server is newer (server=1.4.X, client=1.3.X) it assumes that the client-libraries should be updated. The UI will suggest the user to update the libs and if the user chooses so, the server sends an update request to the robot.

This does not work for ev3dev:

Maybe we can do something along the lines of:

mkdir -p /tmp/sources.list.d/
# echo "deb http://ev3dev.org/debian jessie main" > /tmp/sources.list.d/ev3dev.list
grep  "ev3dev.org" /etc/apt/sources.list > /tmp/sources.list.d/ev3dev.list
sudo chrt -b 0 apt-get update -o APT::List-Cleanup=0 \
  -o Dir::Etc::sourcelist="/dev/null" \
  -o Dir::Etc::sourceparts="/tmp/sources.list.d/"
sudo apt-get install -o APT::List-Cleanup=0 \
  -o Dir::Etc::sourcelist="/dev/null" \
  -o Dir::Etc::sourceparts="/tmp/sources.list.d/"  \
  --only-upgrade openrobertalab

We can also use this to check what would be upgraded (as suggested on http://unix.stackexchange.com/questions/19470/list-available-updates-but-do-not-install-them):

sudo chrt -b 0 apt-get --just-print upgrade \
  -o APT::List-Cleanup=0 \
  -o Dir::Etc::sourcelist="/dev/null" \
  -o Dir::Etc::sourceparts="/tmp/sources.list.d/" \
 | LANG=C perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print "PROGRAM: $1 INSTALLED: $2 AVAILABLE: $3\n"}'
PROGRAM: libavahi-common-data INSTALLED: 0.6.31-5 AVAILABLE: 0.6.32-1ev3dev1
PROGRAM: libavahi-common3 INSTALLED: 0.6.31-5 AVAILABLE: 0.6.32-1ev3dev1
PROGRAM: libavahi-client3 INSTALLED: 0.6.31-5 AVAILABLE: 0.6.32-1ev3dev1
PROGRAM: libavahi-core7 INSTALLED: 0.6.31-5 AVAILABLE: 0.6.32-1ev3dev1
PROGRAM: avahi-daemon INSTALLED: 0.6.31-5 AVAILABLE: 0.6.32-1ev3dev1
PROGRAM: connman INSTALLED: 1.31-0ev3dev1 AVAILABLE: 1.32-0ev3dev1
PROGRAM: flash-kernel INSTALLED: 3.35ev3dev5 AVAILABLE: 3.35ev3dev8
PROGRAM: zram-init INSTALLED: 3.5ev3dev1 AVAILABLE: 3.5ev3dev2
ensonic commented 6 years ago

One alternative solution would be to automatically download the latest ev3.py as needed (with the download mechanism in the push protocol) and install this in /home/robot/.local/python/roberta/ev3.py. The lab.py would patch the python import path to consider this directory (sys.path.append()). This would shadow the version installed with the system. Once we've downloaded a new version, we'd need to restart the connector and also reconnect the robot.

One thing that is nice here, is that we always have a working version in the system.

ensonic commented 4 years ago

This is now implemented as https://github.com/OpenRoberta/openroberta-lab/#730