Skip to content

Commit

Permalink
updatePackage updates
Browse files Browse the repository at this point in the history
updatePackage: added patch options including MANUAL to prevent automatic patch updates
updatePackage: rewrite main file set loop for speed improvement
  • Loading branch information
kwindrem committed Apr 25, 2024
1 parent 288f82a commit d9ac5a7
Show file tree
Hide file tree
Showing 8 changed files with 467 additions and 527 deletions.
2 changes: 1 addition & 1 deletion HelperResources/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.0~23
v8.0~24
44 changes: 27 additions & 17 deletions PackageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,14 +944,18 @@ def UpdatePackageCount (self):
self.DbusSettings['packageCount'] = count
def GetPackageCount (self):
return self.DbusSettings['packageCount']
def SetAutoDownload (self, value):
def SetAutoDownloadMode (self, value):
self.DbusSettings['autoDownload'] = value
def GetAutoDownloadMode (self):
return self.DbusSettings['autoDownload']
def GetAutoInstall (self):
return self.DbusSettings['autoInstall']
return self.DbusSettings['autoInstall'] == 1
def SetAutoInstall (self, value):
self.DbusSettings['autoInstall'] = value
if value == True:
dbusValue = 1
else:
dbusValue = 0
self.DbusSettings['autoInstall'] = dbusValue
def SetPmStatus (self, value):
self.DbusService['/PmStatus'] = value
def SetMediaStatus (self, value):
Expand Down Expand Up @@ -1493,7 +1497,7 @@ def __init__( self, section, packageName = None ):

self.ActionNeeded = ''

self.lastConflictCheck = 0
self.lastScriptPrecheck = 0

self.lastGitHubRefresh = 0

Expand Down Expand Up @@ -1797,7 +1801,7 @@ def RemovePackage (cls, packageName=None, packageIndex=None, isDuplicate=False )
toPackage.DependencyErrors = fromPackage.DependencyErrors
toPackage.FileConflicts = fromPackage.FileConflicts
toPackage.PatchCheckErrors = fromPackage.PatchCheckErrors
toPackage.lastConflictCheck = fromPackage.lastConflictCheck
toPackage.lastScriptPrecheck = fromPackage.lastScriptPrecheck
toPackage.lastGitHubRefresh = fromPackage.lastGitHubRefresh
toPackage.ActionNeeded = fromPackage.ActionNeeded

Expand Down Expand Up @@ -1857,7 +1861,7 @@ def RemovePackage (cls, packageName=None, packageIndex=None, isDuplicate=False )
#
# must be called while LOCKED !!

def UpdateVersionsAndFlags (self, doConflictChecks=False, doScriptChecks=False):
def UpdateVersionsAndFlags (self, doConflictChecks=False, doScriptPreChecks=False):
global VersionToNumber
global VenusVersion
global VenusVersionNumber
Expand Down Expand Up @@ -2020,8 +2024,8 @@ def UpdateVersionsAndFlags (self, doConflictChecks=False, doScriptChecks=False):
continue
# if a package list for an active file changes,
# run script checks again to uncover new or resolved conflicts
if os.path.getmtime (packagesList) > self.lastConflictCheck:
doScriptChecks = True
if os.path.getmtime (packagesList) > self.lastScriptPrecheck:
doScriptPreChecks = True
try:
with open (packagesList, 'r') as plFile:
for entry2 in plFile:
Expand Down Expand Up @@ -2092,9 +2096,9 @@ def UpdateVersionsAndFlags (self, doConflictChecks=False, doScriptChecks=False):

# make sure script checks are run once at boot
# (eg patched errors, but there are others)
if self.lastConflictCheck == 0:
doScriptChecks = True
self.lastConflictCheck = time.time ()
if self.lastScriptPrecheck == 0:
doScriptPreChecks = True
self.lastScriptPrecheck = time.time ()
# end if doConflictChecks

# if no incompatibilities found, clear incompatible dbus parameters
Expand All @@ -2103,7 +2107,7 @@ def UpdateVersionsAndFlags (self, doConflictChecks=False, doScriptChecks=False):
self.SetIncompatible ("")

# run setup script to check for file conflicts (can't be checked here)
if doScriptChecks and os.path.exists ("/data/" + packageName + "/setup"):
if doScriptPreChecks and os.path.exists ("/data/" + packageName + "/setup"):
PushAction ( command='check' + ':' + packageName, source='AUTO' )
# end UpdateVersionsAndFlags
# end Package
Expand Down Expand Up @@ -2529,7 +2533,7 @@ def GitHubDownload (self, packageName= None, source=None):
PushAction ( command='install' + ':' + packageName, source=source )
# no install after, do full version/flag update
else:
package.UpdateVersionsAndFlags (doConflictChecks=True, doScriptChecks=True)
package.UpdateVersionsAndFlags (doConflictChecks=True, doScriptPreChecks=True)
DbusIf.UNLOCK ("GitHubDownload - update status")

# report errors / success
Expand Down Expand Up @@ -2850,6 +2854,10 @@ def InstallPackage ( self, packageName=None, source=None , action='install' ):
if source == 'GUI':
DbusIf.AcknowledgeGuiEditAction ( 'ERROR' )

# installs do script conflict checks
# update last check time here so checks aren't run right away
package.lastScriptPrecheck = time.time ()

package.UpdateVersionsAndFlags ()

DbusIf.UNLOCK ("InstallPackage - update status")
Expand Down Expand Up @@ -3749,7 +3757,6 @@ def mainLoop ():
holdOffScan = True
# not doing boot install - use dbus values
else:
holdOffScan = False
autoInstall = DbusIf.GetAutoInstall ()
# save mode before chaning so changes can be detected below
lastDownloadMode = currentDownloadMode
Expand All @@ -3760,6 +3767,8 @@ def mainLoop ():
and ( currentDownloadMode == ONE_DOWNLOAD or lastDownloadMode == AUTO_DOWNLOADS_OFF ):
holdOffScan = True
UpdateGitHubVersion.SetPriorityGitHubVersion ('REFRESH')
else:
holdOffScan = False

# make sure a new scan starts at beginning of list
if holdOffScan:
Expand All @@ -3773,7 +3782,7 @@ def mainLoop ():
packageIndex = 0
# end of ONCE download - switch auto downloads off
if currentDownloadMode == ONE_DOWNLOAD:
DbusIf.SetAutoDownload (AUTO_DOWNLOADS_OFF)
DbusIf.SetAutoDownloadMode (AUTO_DOWNLOADS_OFF)
currentDownloadMode = AUTO_DOWNLOADS_OFF
# end of boot install
if bootInstall:
Expand All @@ -3786,7 +3795,8 @@ def mainLoop ():
packageName = package.PackageName
packageIndex += 1

package.UpdateVersionsAndFlags (doConflictChecks=True)
# skip conflict checks if boot-time checks are bening made
package.UpdateVersionsAndFlags (doConflictChecks = not bootInstall)

# disallow operations on this package if anything is pending
packageOperationOk = not package.DownloadPending and not package.InstallPending
Expand Down Expand Up @@ -4194,7 +4204,7 @@ def main():
elif SystemReboot:
DbusIf.UpdateStatus ( message="REBOOTING SYSTEM ...", where='PmStatus')
DbusIf.UpdateStatus ( message="REBOOTING SYSTEM ...", where='Editor' )
logging.warning (">>>> REBOOTING SYSTEM: to complete package installation")
logging.warning (">>>> REBOOTING SYSTEM")

# remaining tasks are handled in packageManagerEnd.sh because
# SetupHelper uninstall needs to be done after PackageManager.py exists
Expand Down
2 changes: 1 addition & 1 deletion blindInstall/SetupHelperVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.0~23
v8.0~24
4 changes: 3 additions & 1 deletion changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
v8.0: (beta)
allow multiple packages to modify the same file
multiple patch files for each active file are permitted
allow multiple patch files for each active file
fixed: PackageManager hangs if there is no setup script in package directory
fixed: package conflict message disappears
fixed: "Once" download scan doesn't check all packages
Expand All @@ -11,6 +11,8 @@ v8.0: (beta)
to separate script
add TailscaleGX to default package list
updatePackage: changed HelperResources version checking to minimize prompts
updatePackage: added patch options including MANUAL to prevent automatic patch updates
updatePackage: rewrite main file set loop for speed improvement

v7.18:
fixed: only first service is uninstalled
Expand Down
Loading

0 comments on commit d9ac5a7

Please sign in to comment.