diff options
author | shprdchris <shprd.chris@gmail.com> | 2022-02-01 12:38:10 +0000 |
---|---|---|
committer | shprdchris <shprd.chris@gmail.com> | 2022-02-02 11:54:33 +0000 |
commit | 73778599055582a974fad5f8747b98ee5de45da6 (patch) | |
tree | 766bf8a445adf836334c51d4f99a5ef2c5fda0d7 /lorry | |
parent | 696022f762d4e51920ea4a937386d93e971aca4f (diff) | |
download | lorry-73778599055582a974fad5f8747b98ee5de45da6.tar.gz |
(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
Diffstat (limited to 'lorry')
-rwxr-xr-x | lorry | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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'] |