Skip to content

Commit

Permalink
fixed: package download failure not always reported on the GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindrem committed Feb 14, 2024
1 parent 1c23c6c commit 701a077
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 30 deletions.
52 changes: 24 additions & 28 deletions PackageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,7 @@ def VersionToNumber (version):
# all directories at the current level are checked
# to see if they contain a file named 'version'
# indicating a package directory has been found
#
# further, the version file must begin with 'v'
#
# if so, that path is returned
# if so, that path is returned
#
# if a directory NOT containing 'version' is found
# this method is called again to look inside that directory
Expand All @@ -641,13 +638,7 @@ def LocatePackagePath (origPath):
# found version file, make sure it is "valid"
versionFile = newPath + "/version"
if os.path.isfile( versionFile ):
fd = open ( versionFile, 'r' )
version = fd.readline().strip()
fd.close()
if version[0] == 'v':
return newPath
else:
logging.error ("version file not a valid version " + versionFile + " = " + version )
return newPath
else:
packageDir = locatePackagePath (newPath)
# found a package directory
Expand Down Expand Up @@ -2261,7 +2252,7 @@ def GitHubDownload (self, packageName= None, source=None):
where=where, logLevel=ERROR )
if source == 'GUI':
DbusIf.SetGuiEditAction ( 'ERROR' )
return False
return
else:
proc.wait()
stdout, stderr = proc.communicate ()
Expand All @@ -2278,7 +2269,7 @@ def GitHubDownload (self, packageName= None, source=None):
DbusIf.SetGuiEditAction ( 'ERROR' )
PackageClass.UpdateDownloadPending (packageName, False)
shutil.rmtree (tempDirectory)
return False
return
try:
proc = subprocess.Popen ( ['tar', '-xzf', tempArchiveFile, '-C', tempDirectory ],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Expand All @@ -2289,7 +2280,7 @@ def GitHubDownload (self, packageName= None, source=None):
DbusIf.SetGuiEditAction ( 'ERROR' )
PackageClass.UpdateDownloadPending (packageName, False)
shutil.rmtree (tempDirectory)
return False
return

proc.wait()
stdout, stderr = proc.communicate ()
Expand All @@ -2306,39 +2297,44 @@ def GitHubDownload (self, packageName= None, source=None):
DbusIf.SetGuiEditAction ( 'ERROR' )
PackageClass.UpdateDownloadPending (packageName, False)
shutil.rmtree (tempDirectory)
return False
return

# attempt to locate a directory that contains a version file
# the first directory in the tree starting with tempDicrectory
# is returned
# the first directory in the tree starting with tempDirectory is returned
unpackedPath = LocatePackagePath (tempDirectory)
if unpackedPath == None:
PackageClass.UpdateDownloadPending (packageName, False)
shutil.rmtree (tempDirectory)
logging.error ( "GitHubDownload: no archive path for " + packageName )
return False
return

# move unpacked archive to package location
# LOCK this critical section of code to prevent others
# LOCK this section of code to prevent others
# from accessing the directory while it's being updated
packagePath = "/data/" + packageName
tempPackagePath = packagePath + "-temp"
message = ""
DbusIf.LOCK ()
if os.path.exists (packagePath):
os.rename (packagePath, tempPackagePath)
try:
shutil.move (unpackedPath, packagePath)
if os.path.exists (packagePath):
if os.path.exists (tempPackagePath):
shutil.rmtree (tempPackagePath, ignore_errors=True) # like rm -rf
os.rename (packagePath, tempPackagePath)
shutil.move (unpackedPath, packagePath)
except:
logging.error ( "GitHubDownload: couldn't relocate " + packageName )
if os.path.exists (tempPackagePath):
shutil.rmtree (tempPackagePath, ignore_errors=True) # like rm -rf
message = "GitHubDownload: couldn't update " + packageName
logging.error ( message )
DbusIf.UNLOCK ()
PackageClass.UpdateDownloadPending (packageName, False)
DbusIf.UpdateStatus ( message="", where=where )
DbusIf.UpdateStatus ( message=message, where=where )
if source == 'GUI':
DbusIf.SetGuiEditAction ( '' )
if message == "":
DbusIf.SetGuiEditAction ( '' )
else:
DbusIf.SetGuiEditAction ( 'ERROR' )
if os.path.exists (tempPackagePath):
shutil.rmtree (tempPackagePath, ignore_errors=True) # like rm -rf
shutil.rmtree (tempDirectory)
return True
# end GitHubDownload


Expand Down
2 changes: 1 addition & 1 deletion blindInstall/SetupHelperVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v6.4
v6.5
3 changes: 3 additions & 0 deletions changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v6.5:
fixed: package download failure not always reported on the GUI

v6.4:
fixed: setup scripts fail if no fileList file
updatePacakge: fixed problems related to incompatible versions
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 @@
v6.4
v6.5

0 comments on commit 701a077

Please sign in to comment.