From 73778599055582a974fad5f8747b98ee5de45da6 Mon Sep 17 00:00:00 2001 From: shprdchris Date: Tue, 1 Feb 2022 12:38:10 +0000 Subject: (v2) Make raw importer honour multiple files Resolves issue where raw importer was only honouring last entry for several files with same upstream path. These files were being passed as comma-separated URLs under the 'urls' tag in the .lorry file. The yaml importer could only store one entry per 'urls', updating a dictionary entry after each comma. The changes in this commit allow for multiple files to be added, but the URLs must now be added in the form: ``` urls: - destination: libosinfo url: https://releases.pagure.org/libosinfo/osinfo-db-20211216.tar.xz - destination: libosinfo url: https://releases.pagure.org/libosinfo/libosinfo-1.2.0.tar.gz ``` A previous branch was created to resolve this issue, but the solution required URLs to be separted by whitespace. It was decided that the format implemented here is preferable. Resolves: #29 --- lorry | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lorry') diff --git a/lorry b/lorry index bc97350..b52b563 100755 --- a/lorry +++ b/lorry @@ -805,15 +805,15 @@ class Lorry(cliapp.Application): raw_file_refspecs = 'refs/heads/{branch}:refs/heads/{branch}'.format(branch=raw_file_branch) self.ensure_gitdir(gitdir) # Fetch the files - new_files = {} + new_files = [] for src in spec['urls']: - url = spec['urls'][src] + url = src['url'] url_path = urllib.parse.urlparse(url)[2] basename = os.path.basename(url_path) file_dest = os.path.join(dirname, basename) self.progress('.. checking if we need to fetch %s' % basename) if file_missing_or_empty(file_dest): - new_files[src] = file_dest + new_files.append((src['destination'], file_dest)) self.progress('.. attempting to fetch %s' % basename) try: with open(file_dest, 'wb') as raw_file, \ @@ -850,8 +850,8 @@ class Lorry(cliapp.Application): # Ensure the repo supports git LFS self.run_program(['git', 'lfs', 'install', '--local'], cwd=gitdir) - for src in new_files: - self.run_program(["%s.raw-file-importer" % lorry_path, new_files[src], src], cwd=gitdir) + for subpath, raw_file in new_files: + self.run_program(["%s.raw-file-importer" % lorry_path, raw_file, subpath], cwd=gitdir) def gitify_archive(self, archive_type, project_name, dirname, gitdir, spec): assert archive_type in ['zip', 'gzip', 'tar'] -- cgit v1.2.1