Correzione di un paio di problemi del codice.

This commit is contained in:
emiliano.vavassori 2025-02-08 17:27:18 +01:00
parent ab26e0aa32
commit 14ac61fc92
1 changed files with 5 additions and 8 deletions

View File

@ -171,7 +171,6 @@ class Build():
# was already built.
name = self.appimagefilename
url = self.storage_path.rstrip('/') + self.full_path + '/'
matching = []
try:
if len(loaih.match_xpath(url, f"//a[contains(@href,'{name}')]/@href")) > 0:
# Already built.
@ -183,8 +182,6 @@ class Build():
else:
# Repo is local
command = f"find {self.full_path} -name {self.appimagefilename}"
res = subprocess.run(shlex.split(command),
capture_output=True,
@ -473,10 +470,10 @@ class Build():
# On the contrary, we will dump a logfile, remove the download and
# redo the download.
with open(os.path.join(self.downloadpath, 'downloadfailure.log'), 'wa') as logfile:
with open(os.path.join(self.download_path, 'downloadfailure.log'), 'wa') as logfile:
logfile.write(f"{timenow.isoformat()};{resource.url};{mimetype}")
file.unlink(testedfilename)
os.unlink(testedfilename)
break_control += 1
# If it arrives here, 5 attempts to download the archive have failed.
@ -500,7 +497,7 @@ class Build():
file.write(chunk)
return filename
def __download_debug__(self, url: str, filename: str) -> (str, requests.Response):
def __download_debug__(self, url: str, filename: str) -> tuple[str, requests.Response]:
basename = filename
if '/' in filename:
basename = filename.split('/')[-1]
@ -515,7 +512,7 @@ class Build():
with open(filename, 'wb') as file:
for chunk in resource.iter_content(chunk_size=8192):
file.write(chunk)
return (filename, resource)
return filename, resource
def __select_tarballs__(self):
retval = [ self.tarballs[0] ]
@ -698,7 +695,7 @@ class Build():
), cwd=temporary, check=True)
if self.debug:
with open(os.path.abspath(os.storage_path, 'dependencies.lst'), 'w', encoding="utf-8") as deplist:
with open(os.path.abspath(os.path.join(self.storage_path, 'dependencies.lst')), 'w', encoding="utf-8") as deplist:
deplist.write("\n".join(debs))
def __finalize_build__(self):