Skip to content

Commit

Permalink
fixed: package checks run unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindrem committed Apr 15, 2024
1 parent c8f43c6 commit dd7d9ca
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
22 changes: 16 additions & 6 deletions PackageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2015,7 +2015,8 @@ def UpdateVersionsAndFlags (self, doConflictChecks=False):
packagesList = replacementFile + ".package"
if not os.path.exists ( packagesList ) :
continue
if os.path.getmtime ( packagesList ) > self.lastConflictCheck:
modTime = os.path.getmtime ( packagesList )
if modTime > self.lastConflictCheck:
activeFileHasChanged = True
logConflict = True
else:
Expand Down Expand Up @@ -2085,7 +2086,7 @@ def UpdateVersionsAndFlags (self, doConflictChecks=False):
self.SetIncompatible ("patch error", details,)
compatible = False

# used to prevent repeaded errors to the log
# used to prevent repeated checks
self.lastConflictCheck = time.time ()
# end if doConflictChecks

Expand Down Expand Up @@ -2841,7 +2842,7 @@ def InstallPackage ( self, packageName=None, source=None , action='install' ):
if source == 'GUI':
DbusIf.AcknowledgeGuiEditAction ( 'ERROR' )

package.UpdateVersionsAndFlags (doConflictChecks=True)
package.UpdateVersionsAndFlags ()

DbusIf.UNLOCK ("InstallPackage - update status")
# end InstallPackage ()
Expand Down Expand Up @@ -3656,13 +3657,13 @@ def run (self):
currentDownloadMode = AUTO_DOWNLOADS_OFF
bootInstall = False
DeferredGuiEditAcknowledgement = None
lastTimeSync = 0

# states for actionNeeded
REBOOT_NEEDED = 2
GUI_RESTART_NEEDED = 1
NONE = 0


def mainLoop ():
global mainloop
global PushAction
Expand All @@ -3680,8 +3681,19 @@ def mainLoop ():
global lastDownloadMode
global currentDownloadMode
global bootInstall
global lastTimeSync

startTime = time.time()

# an unclean shutdown will not save the last known time of day
# which is used during the next boot until ntp can sync time
# so do it here every 30 seconds
# an old RTC
timeSyncCommand = '/etc/init.d/save-rtc.sh'
if startTime > lastTimeSync + 30 and os.path.exists (timeSyncCommand):
subprocess.Popen ( [ timeSyncCommand ] )
lastTimeSync = startTime

packageName = "none"

if DeferredGuiEditAcknowledgement != None:
Expand Down Expand Up @@ -3741,7 +3753,6 @@ def mainLoop ():
# restart at beginning of list and signal mode change to the GitHub version thread
if currentDownloadMode != lastDownloadMode \
and ( currentDownloadMode == ONE_DOWNLOAD or lastDownloadMode == AUTO_DOWNLOADS_OFF ):
print ("#### starting new download scan")
holdOffScan = True
WaitForGitHubVersions = True
UpdateGitHubVersion.SetPriorityGitHubVersion ('REFRESH')
Expand All @@ -3758,7 +3769,6 @@ def mainLoop ():
packageIndex = 0
# end of ONCE download - switch auto downloads off
if currentDownloadMode == ONE_DOWNLOAD:
print ("#### ONCE download finished")
DbusIf.SetAutoDownload (AUTO_DOWNLOADS_OFF)
currentDownloadMode = AUTO_DOWNLOADS_OFF
# end of boot install
Expand Down
2 changes: 1 addition & 1 deletion blindInstall/SetupHelperVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.0~21
v8.0~22
2 changes: 2 additions & 0 deletions changes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ v8.0: (beta)
fixed: "Once" download scan only scans one package, not all of them
based conflict checking mechanisms on file modificaiton times
to eliminate unnecessary work
fixed: package checks run unnecessarily until time syncs with NTP
after an unclean shutdown

v7.18:
fixed: only first service is uninstalled
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 @@
v8.0~21
v8.0~22

0 comments on commit dd7d9ca

Please sign in to comment.