Skip to content

Commit

Permalink
dropping support for firmware earlier than v3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindrem committed Jul 17, 2024
1 parent f556243 commit ce3247a
Show file tree
Hide file tree
Showing 53 changed files with 64 additions and 12,398 deletions.
70 changes: 9 additions & 61 deletions PackageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,20 +368,13 @@
import time
import re
import glob
import queue
from gi.repository import GLib
# add the path to our own packages for import
sys.path.insert(1, "/data/SetupHelper/velib_python")
from vedbus import VeDbusService
from settingsdevice import SettingsDevice

# accommodate both Python 2 (prior to v2.80) and 3
# note subprocess.run and subprocess.DEVNULL do not exist in python 2
# so subprocess.Popen and subprocess.PIPE and subprocess.communicate ()
# are used in all subprodess calls even if process output is not needed
# or if it is not necessary to wait for the command to finish

PythonVersion = sys.version_info
if PythonVersion >= (3, 0):
import queue
from gi.repository import GLib
else:
import Queue as queue
import gobject as GLib

global DownloadGitHub
global InstallPackages
Expand Down Expand Up @@ -483,42 +476,6 @@ def VersionToNumber (version):
VenusVersionNumber = VersionToNumber (VenusVersion)
file.close()

# add the path to our own packages for import
# use an established Victron service to maintain compatiblity
setupHelperVeLibPath = "/data/SetupHelper/velib_python"
veLibPath = ""
if os.path.exists ( setupHelperVeLibPath ):
for libVersion in os.listdir ( setupHelperVeLibPath ):
# use 'latest' for newest versions even if not specifically checked against this verison when created
if libVersion == "latest":
newestVersionNumber = VersionToNumber ( "v9999.9999.9999" )
else:
newestVersionNumber = VersionToNumber ( libVersion )
oldestVersionPath = os.path.join (setupHelperVeLibPath, libVersion, "oldestVersion" )
if os.path.exists ( oldestVersionPath ):
try:
fd = open (oldestVersionPath, 'r')
oldestVersionNumber = VersionToNumber ( fd.readline().strip () )
fd.close()
except:
oldestVersionNumber = 0
else:
oldestVersionNumber = 0
if VenusVersionNumber >= oldestVersionNumber and VenusVersionNumber <= newestVersionNumber:
veLibPath = os.path.join (setupHelperVeLibPath, libVersion)
break

# no SetupHelper velib - use one in systemcalc
if veLibPath == "":
veLibPath = os.path.join('/opt/victronenergy/dbus-systemcalc-py', 'ext', 'velib_python')

logging.warning ("using " + veLibPath + " for velib_python")
sys.path.insert(1, veLibPath)

from vedbus import VeDbusService
from settingsdevice import SettingsDevice


# PushAction
#
# some actions are pushed to one of three queues:
Expand Down Expand Up @@ -1241,13 +1198,7 @@ def __init__(self):
# check firmware version and delay dbus service registration for v3.40~38 and beyond
global VenusVersionNumber
global VersionToNumber
versionThreshold = VersionToNumber ("v3.40~28")
if VenusVersionNumber >= versionThreshold:
self.DbusService = VeDbusService ('com.victronenergy.packageManager', bus = dbus.SystemBus(), register=False)
delayedRegistration = True
else:
self.DbusService = VeDbusService ('com.victronenergy.packageManager', bus = dbus.SystemBus())
delayedRegistration = False
self.DbusService = VeDbusService ('com.victronenergy.packageManager', bus = dbus.SystemBus(), register=False)

self.DbusService.add_mandatory_paths (
processname = 'PackageManager', processversion = 1.0, connection = 'none',
Expand Down Expand Up @@ -1289,8 +1240,8 @@ def __init__(self):
self.DbusService.add_path ( '/PmStatus', "", writeable = True )
global Platform
self.DbusService.add_path ( '/Platform', Platform )
if delayedRegistration:
self.DbusService.register ()

self.DbusService.register ()


# RemoveDbusService
Expand Down Expand Up @@ -4055,9 +4006,6 @@ def main():

# Have a mainloop, so we can send/receive asynchronous calls to and from dbus
DBusGMainLoop(set_as_default=True)
global PythonVersion
if PythonVersion < (3, 0):
GLib.threads_init()

# get platform
global Platform
Expand Down
7 changes: 7 additions & 0 deletions ReadMe
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ The SetupHelper package provides:
Restart or initialize PackageManager
Restart the GUI

NOTE: Support for firmware prior to v3.10 has been dropped starting with SetupHelper v8.10
if you are running older versions, change the branch/tag to preV3.10support
for any packages you wish to run on that firmware

While this branch will remain active, there will be no features added to it
and only serious bug fixes will be applied.


SetupHelper v8 adds the ability for multiple packages to modify the same file
Packages must be written to "patch" a file rather than "replace" it
Expand Down
2 changes: 1 addition & 1 deletion blindInstall/SetupHelperVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.9
v8.10
4 changes: 4 additions & 0 deletions changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v8.10:
moved velib_python in SetupHelper to a single version
dropping support for firmware earlier than v3.10

v8.9:
fixed: further changes for the remote GUI issue

Expand Down
73 changes: 42 additions & 31 deletions updatePackage
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,15 @@ for package in $packageList; do
oldReplacementVersion="-"
oldReplacementIsFile=false
oldReplacementIsUseOrig=false
blockIsUnused=true
for (( i1 = start; i1 < $allFileSetsLength; i1++ )); do
IFS=':' read version versionNumber <<< "${allFileSets[$i1]}"
fileSet="$workingFiles/$version"
if [ -e "$fileSet/INCOMPATIBLE_VERSION" ] || [ -e "$fileSet/UNUSED_FILE_SET" ]; then
fileSetUnused=true
else
fileSetUnused=false
fi
replacement="$fileSet/$baseName"
stockFileSet="$stockFiles/$version"
orig="$fileSet/$baseName.orig"
Expand Down Expand Up @@ -939,6 +945,10 @@ for package in $packageList; do
break
fi

if ! $fileSetUnused ; then
blockIsUnused=false
fi

# save version of old replacement files for next loop
if $replacementIsFile ; then
if ! $oldReplacementIsFile || [ "$oldReplacementVersion" == "-" ]; then
Expand All @@ -958,24 +968,16 @@ for package in $packageList; do
# first compatible file set - move replacements here
# unused file sets are permitted for the destination file set
# but if a used file set is later found, it is preferred
if [ -e "$fileSet/INCOMPATIBLE_VERSION" ]; then
updateTo=false
elif (( to == -1 )); then
updateTo=true
elif ! [ -e "$fileSet/UNUSED_FILE_SET" ] && [ -e "$toFileSet/UNUSED_FILE_SET" ]; then
updateTo=true
else
updateTo=false
fi
if $updateTo ; then
if (( to == -1 )) && ! $fileSetUnused; then
(( to = i1 ))
toFileSet="$fileSet"
toVersion=$( basename "$toFileSet" )
fi
done # end locate block

if (( to == -1 )); then
logMessage "ERROR $package: $baseName no destination file set - can't relocate files"
if ! $blockIsUnused; then
logMessage "ERROR $package: $baseName no destination file set for block $startVersion $endVersion - can't relocate files"
fi
else
toReplacement="$toFileSet/$baseName"
oldReplacement="$workingFiles/$oldReplacementVersion/$baseName"
Expand Down Expand Up @@ -1099,29 +1101,40 @@ for package in $packageList; do
break
fi
done
# LINKS_ONLY is not used for anything but helps identify file sets
# that don't contain real files
# LINKS_ONLY is not used for anything but helps identify file sets that don't contain real files
if ! $replacementFilesExist ; then
touch "$fileSet/LINKS_ONLY"
fi

fileSetInUse=true
# remove file sets for incompatible Venus OS versions
if [ -e "$fileSet/INCOMPATIBLE_VERSION" ]; then
if [ ! -f "$fileSet/NEW_FILE_SET" ]; then
logMessage "WARNING $package: not compatible with Venus $version - file set removed"
fileSetInUse=false
if $replacementFilesExist ; then
logMessage "WARNING $package: $version not compatible with Venus $version but file set not empty"
else
if [ ! -f "$fileSet/NEW_FILE_SET" ]; then
logMessage "WARNING $package: not compatible with Venus $version - file set removed"
fi
rm -Rf "$fileSet"
fi
rm -Rf "$fileSet"
# remove empty unused file sets
elif [ -f "$fileSet/UNUSED_FILE_SET" ]; then
# log removal of a previous file set if not created with this run
# if it was created with this run, delete it silently
if [ ! -f "$fileSet/NEW_FILE_SET" ]; then
logMessage "WARNING $package: $version - removing unused file set"
fileSetInUse=false
if $replacementFilesExist ; then
logMessage "WARNING $package: $version no longer used but file set not empty"
else
# log removal of a previous file set if not created with this run
# if it was created with this run, delete it silently
if [ ! -f "$fileSet/NEW_FILE_SET" ]; then
logMessage "WARNING $package: $version - removing unused file set"
fi
rm -Rf "$fileSet"
fi
rm -Rf "$fileSet"
fi
# do final checks on versioned files only
# and for file sets that still exist
else
if [ -e "$fileSet" ] && $fileSetInUse; then
if [ -e "$fileSet/NEW_FILE_SET" ]; then
logMessage "$package: $version new file set"
fi
Expand Down Expand Up @@ -1172,7 +1185,6 @@ for package in $packageList; do
logMessage "ERROR $package $baseName: no replacement for $version"
fi


# validate sym link
symLinkReplacement=false
badLink=false
Expand All @@ -1181,19 +1193,18 @@ for package in $packageList; do
# resolive symlink then check to make sure that file is valid
linkedFile=$( realpath "$replacement" 2> /dev/null )
if [ -z "$linkedFile" ]; then
badLink=true
logMessage "ERROR $package: $baseName $version no linked file $linkedFile"
touch "$replacement.BAD_LINK"
else
linkedFileSet=$( dirname "$linkedFile" )
if [ -z "$linkedFileSet" ]; then
badLink=true
logMessage "ERROR $package: $baseName $version no linked file set"
touch "$replacement.BAD_LINK"
elif [ -f "$linkedFileSet/UNUSED_FILE_SET" ] || [ -f "$linkedFileSet/INCOMPATIBLE_VERSION" ]; then
badLink=true
logMessage "ERROR $package: $baseName $version links to unused file set $linkedFileSet"
touch "$replacement.BAD_LINK"
fi
fi
if $badLink ; then
logMessage "ERROR $package: $baseName $version bad link"
touch "$replacement.BAD_LINK"
fi
fi

# flag file set incomplete
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit ce3247a

Please sign in to comment.