upstream: Gracefully handle archive type changes.
Previously, if the currently used archive type (e.g., "bz2") was unavailable for the new version, 'guix refresh -u' would crash instead of updating to the archive with the new type. * guix/upstream.scm (package-update/url-fetch): When URL is #f, pick the first of URLS; likewise for SIGNATURE-URL.
This commit is contained in:
		
							parent
							
								
									4496ea74aa
								
							
						
					
					
						commit
						0ea009db9d
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -362,6 +362,7 @@ SOURCE, an <upstream-source>."
 | 
				
			||||||
                      (_
 | 
					                      (_
 | 
				
			||||||
                       "gz")))
 | 
					                       "gz")))
 | 
				
			||||||
                   ((url signature-url)
 | 
					                   ((url signature-url)
 | 
				
			||||||
 | 
					                    ;; Try to find a URL that matches ARCHIVE-TYPE.
 | 
				
			||||||
                    (find2 (lambda (url sig-url)
 | 
					                    (find2 (lambda (url sig-url)
 | 
				
			||||||
                             ;; Some URIs lack a file extension, like
 | 
					                             ;; Some URIs lack a file extension, like
 | 
				
			||||||
                             ;; 'https://crates.io/???/0.1/download'.  In that
 | 
					                             ;; 'https://crates.io/???/0.1/download'.  In that
 | 
				
			||||||
| 
						 | 
					@ -370,7 +371,13 @@ SOURCE, an <upstream-source>."
 | 
				
			||||||
                                 (string-suffix? archive-type url)))
 | 
					                                 (string-suffix? archive-type url)))
 | 
				
			||||||
                           urls
 | 
					                           urls
 | 
				
			||||||
                           (or signature-urls (circular-list #f)))))
 | 
					                           (or signature-urls (circular-list #f)))))
 | 
				
			||||||
       (let ((tarball (download-tarball store url signature-url
 | 
					       ;; If none of URLS matches ARCHIVE-TYPE, then URL is #f; in that case,
 | 
				
			||||||
 | 
					       ;; pick up the first element of URLS.
 | 
				
			||||||
 | 
					       (let ((tarball (download-tarball store
 | 
				
			||||||
 | 
					                                        (or url (first urls))
 | 
				
			||||||
 | 
					                                        (and (pair? signature-urls)
 | 
				
			||||||
 | 
					                                             (or signature-url
 | 
				
			||||||
 | 
					                                                 (first signature-urls)))
 | 
				
			||||||
                                        #:key-download key-download)))
 | 
					                                        #:key-download key-download)))
 | 
				
			||||||
         (values version tarball source))))))
 | 
					         (values version tarball source))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue