diff --git a/fresh.yml b/fresh.yml index 146e19e..1f8735a 100644 --- a/fresh.yml +++ b/fresh.yml @@ -1,9 +1,7 @@ --- data: - repo: /srv/http/appimage.sys42.eu + storage: /srv/http/appimage.sys42.eu download: /var/tmp/downloads - force: no - sign: no builds: - query: fresh diff --git a/loaih/__init__.py b/loaih/__init__.py index ea0728a..3eb19c5 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -48,23 +48,8 @@ class Build(object): self.relative_path = [] self.full_path = '' - def calculate(self): - """Calculate exclusions and other variables.""" - # Incompatibilities - if portable and updatable are asked together, - # only portable will be built. - if self.portable and self.updatable: - print("Upgradable and portable options were required together. Building only portable.") - self.updatable = False - - if self.updatable and not self.queried_name: - # If the queried version was a numbered version, doesn't make sense - # to build an updatable version. - self.updatable = False - - # Mandate to the private function to calculate the full_path available - # for the storage and the checks. - self.__calculate_full_path__() - + def version_strings(self): + """Build version strings based on the information received.""" # Building expected AppImageName self.languagepart = "." if ',' in self.language: @@ -83,8 +68,25 @@ class Build(object): self.genappimagefilename[arch] = self.appname + '-' + self.genappversion + f'-{arch}.AppImage' - def check(self): + def check(self, storage_path): """Checking if the requested AppImage has been already built.""" + # Mandate to the private function to calculate the full_path available + # for the storage and the checks. + self.__calculate_full_path__() + + # Incompatibilities - if portable and updatable are asked together, + # only portable will be built. + if self.portable and self.updatable: + print("Upgradable and portable options were required together. Building only portable.") + self.updatable = False + + if self.updatable and not self.queried_name: + # If the queried version was a numbered version, doesn't make sense + # to build an updatable version. + self.updatable = False + + # Call the build for queries + self.version_strings() for arch in self.arch: # For generalized builds, we need to check if there are .ver file @@ -136,8 +138,12 @@ class Build(object): fullpath_arr.extend(self.relative_path) self.full_path = re.sub(r"/+", '/', str.join('/', fullpath_arr)) - def download(self): + def download(self, download_path): """Downloads the contents of the URL as it was a folder.""" + # Let's start with defining which files are to be downloaded. + # Let's explore the remote folder. + self.download_path = download_path + for arch in self.arch: # Checking if a valid path has been provided if self.url[arch] == '-': diff --git a/scripts/loaih-build b/scripts/loaih-build index 7a1ead4..76de886 100644 --- a/scripts/loaih-build +++ b/scripts/loaih-build @@ -37,23 +37,21 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path # Loop a run for each build. obj = loaih.Build(build['query'], arches) - # Configuration phase obj.language = build['language'] obj.offline_help = build['offline_help'] obj.portable = build['portable'] obj.updatable = True - obj.storage_path = config['data']['repo'] if 'repo' in config['data'] and config['data']['repo'] else '/srv/http/appimage.sys42.eu' - obj.download_path = config['data']['download'] if 'download' in config['data'] and config['data']['download'] else '/var/tmp/downloads' if 'sign' in config['data'] and config['data']['sign']: obj.sign = True - # Build phase - obj.calculate() - if not 'force' in config['data'] or not config['data']['force']: - obj.check() + if 'force' in config['data'] and config['data']['force']: + obj.storage_path = config['data']['repo'] + obj.version_strings() + else: + obj.check(config['data']['repo']) - obj.download() + obj.download(config['data']['download']) obj.build() obj.checksums() obj.publish() @@ -62,24 +60,21 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path else: obj = loaih.Build(query, arches) - # Configuration phase obj.language = language obj.offline_help = offline obj.portable = portable obj.updatable = updatable - obj.storage_path = repo_path - obj.download_path = download_path if sign: obj.sign = True - # Running phase - obj.calculate() - if check: - obj.check() + obj.check(repo_path) + else: + obj.storage_path = repo_path + obj.version_strings() - obj.download() + obj.download(download_path) obj.build() obj.checksums() obj.publish() diff --git a/still.yml b/still.yml index bfe19b7..3d86642 100644 --- a/still.yml +++ b/still.yml @@ -1,9 +1,7 @@ --- data: - repo: /srv/http/appimage.sys42.eu + storage: /srv/http/appimage.sys42.eu download: /var/tmp/downloads - force: no - sign: no builds: - query: still