mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 14:30:30 +03:00 
			
		
		
		
	mirror: make .asc downloading opt-in with --pgp-signatures
Lots of third party repos do not use .asc PGP signatures at all, so having this optional prevents tons of 404 Not Found errors.
This commit is contained in:
		
							parent
							
								
									82a4817e8a
								
							
						
					
					
						commit
						5c82956561
					
				
					 2 changed files with 13 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -253,7 +253,7 @@ __complete_btlog() {
 | 
			
		|||
 | 
			
		||||
__complete_mirror() {
 | 
			
		||||
	opts="-v"
 | 
			
		||||
	lopts="--archive --output-dir"
 | 
			
		||||
	lopts="--all --archive --build-logs --pgp-signatures --src-tarballs --output-dir"
 | 
			
		||||
	__complete_options
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,16 +46,26 @@ def main():
 | 
			
		|||
    parser.add_argument("url", nargs='?',
 | 
			
		||||
                        help=_('Base URL to mirror, can include the index signing key '
 | 
			
		||||
                               + 'using the query string: ?fingerprint='))
 | 
			
		||||
    parser.add_argument("--all", action='store_true', default=False,
 | 
			
		||||
                        help=_("Mirror the full repo and archive, all file types."))
 | 
			
		||||
    parser.add_argument("--archive", action='store_true', default=False,
 | 
			
		||||
                        help=_("Also mirror the full archive section"))
 | 
			
		||||
    parser.add_argument("--build-logs", action='store_true', default=False,
 | 
			
		||||
                        help=_("Include the build logs in the mirror"))
 | 
			
		||||
    parser.add_argument("--pgp-signatures", action='store_true', default=False,
 | 
			
		||||
                        help=_("Include the PGP signature .asc files in the mirror"))
 | 
			
		||||
    parser.add_argument("--src-tarballs", action='store_true', default=False,
 | 
			
		||||
                        help=_("Include the source tarballs in the mirror"))
 | 
			
		||||
    parser.add_argument("--output-dir", default=None,
 | 
			
		||||
                        help=_("The directory to write the mirror to"))
 | 
			
		||||
    options = parser.parse_args()
 | 
			
		||||
 | 
			
		||||
    if options.all:
 | 
			
		||||
        options.archive = True
 | 
			
		||||
        options.build_logs = True
 | 
			
		||||
        options.pgp_signatures = True
 | 
			
		||||
        options.src_tarballs = True
 | 
			
		||||
 | 
			
		||||
    if options.url is None:
 | 
			
		||||
        logging.error(_('A URL is required as an argument!') + '\n')
 | 
			
		||||
        parser.print_help()
 | 
			
		||||
| 
						 | 
				
			
			@ -152,6 +162,7 @@ def main():
 | 
			
		|||
                    if not os.path.exists(f) \
 | 
			
		||||
                       or (f.endswith('.apk') and os.path.getsize(f) != package['size']):
 | 
			
		||||
                        urls.append(_append_to_url_path(section, f))
 | 
			
		||||
                        if options.pgp_signatures:
 | 
			
		||||
                            urls.append(_append_to_url_path(section, f + '.asc'))
 | 
			
		||||
                        if options.build_logs and f.endswith('.apk'):
 | 
			
		||||
                            urls.append(_append_to_url_path(section, f[:-4] + '.log.gz'))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue