Skip to content

Commit

Permalink
fixed: PackageManager hangs if there is no setup script in package di…
Browse files Browse the repository at this point in the history
…rectory
  • Loading branch information
kwindrem committed Apr 1, 2024
1 parent 38bb64e commit cc767f1
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 21 deletions.
42 changes: 23 additions & 19 deletions PackageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ def RemovePackage (cls, packageName=None, packageIndex=None, isDuplicate=False )
#
# must be called while LOCKED !!

def UpdateVersionsAndFlags (self):
def UpdateVersionsAndFlags (self, doConflictChecks=True):
global VersionToNumber
global VenusVersion
global VenusVersionNumber
Expand Down Expand Up @@ -2032,7 +2032,8 @@ def UpdateVersionsAndFlags (self):
compatible = False

# check for package conflicts
if compatible:
# skip checks if caller disabled them
if compatible and doConflictChecks:
conflicts = []
# skip checks while operations are pending
# this clears the conflicts list until it is checked agaion
Expand Down Expand Up @@ -2125,29 +2126,32 @@ def UpdateVersionsAndFlags (self):
else:
self.Conflicts = []

if compatible:
self.SetIncompatible ( "" )
# skip checks if caller disabled them
if compatible and doConflictChecks:

# run setup script to check for errors that can't be checked here
doChecks = False
packageCheckFile = "/data/" + packageName + "/packageCheckVersion"
# no checks have been done recently so do them now
if not os.path.exists ( packageCheckFile ) and time.time() > self.lastSetupCheckTime + 30:
doChecks = True
# check file exists - check which firmware version was checked
# and if not the current version, do checks
else:
try:
with open ( packageCheckFile ) as file:
for line in file:
if not VenusVersion in line:
doChecks = True
# couldn't read the file, attempt check again
except:
if time.time() > self.lastSetupCheckTime + 30:
# no check file exists, do checks
if not os.path.exists ( packageCheckFile ):
doChecks = True
# check file exists - check which firmware version was checked
# and if not the current version, do checks
else:
try:
with open ( packageCheckFile ) as file:
for line in file:
if not VenusVersion in line:
doChecks = True
# couldn't read the file, attempt check again
except:
doChecks = True
if doChecks:
# avoid starting a new check if there is something pending
if not self.InstallPending and not self.DownloadPending:
if not self.InstallPending and not self.DownloadPending \
and os.path.exists ("/data/" + packageName + "/setup"):
PushAction ( command='check' + ':' + packageName, source='AUTO' )
self.lastSetupCheckTime = time.time ()
compatible = False
Expand Down Expand Up @@ -2785,7 +2789,7 @@ def InstallPackage ( self, packageName=None, source=None , action='install' ):
errorMessage = "no package directory " + packageName
logging.error ("InstallPackage - " + errorMessage)
package.InstallPending = False
package.UpdateVersionsAndFlags ()
package.UpdateVersionsAndFlags (doConflictChecks=False)
if source == 'GUI':
DbusIf.AcknowledgeGuiEditAction ( 'ERROR' )
DbusIf.UNLOCK ("InstallPackage error 2")
Expand All @@ -2796,7 +2800,7 @@ def InstallPackage ( self, packageName=None, source=None , action='install' ):
errorMessage = "setup file for " + packageName + " doesn't exist"
DbusIf.UpdateStatus ( message=errorMessage, where=sendStatusTo, logLevel=ERROR )
package.InstallPending = False
package.UpdateVersionsAndFlags ()
package.UpdateVersionsAndFlags (doConflictChecks=False)
if source == 'GUI':
DbusIf.AcknowledgeGuiEditAction ( 'ERROR' )
DbusIf.UNLOCK ("InstallPackage error 3")
Expand Down
2 changes: 1 addition & 1 deletion blindInstall/SetupHelperVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v7.11
v7.12
3 changes: 3 additions & 0 deletions changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v7.12:
fixed: PackageManager hangs if there is no setup script in package directory

v7.11:
fixed: conflicts not cleared when they have been resolved

Expand Down
Binary file modified venus-data-UninstallPackages.tgz
Binary file not shown.
Binary file modified venus-data.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v7.11
v7.12

0 comments on commit cc767f1

Please sign in to comment.