mirror of
				https://git.launchpad.net/ubuntu-dev-tools
				synced 2025-11-04 07:54:03 +00:00 
			
		
		
		
	ubuntutools/archive.py: fix crash in SourcePackage()._source_urls()
Fix operation of SourcePackage._source_urls() (as used, for example, in SourcePackage.pull() called by backportpackage) to also work when the class is instantiated with a URL as .dsc. This is a regression caused by 1b12d8b4e3315de3bf417b40a3c66279f309d72c (first in v0.184) that moved from os.path.join() to Pathlib, but os.path.join() was also used to join URLs. Thanks: Unit 193 for the initial patch. Signed-off-by: Mattia Rizzolo <mattia@debian.org>
This commit is contained in:
		
							parent
							
								
									0a9e18ed91
								
							
						
					
					
						commit
						dabe475067
					
				
							
								
								
									
										14
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@ -1,7 +1,7 @@
 | 
			
		||||
ubuntu-dev-tools (0.191) UNRELEASED; urgency=medium
 | 
			
		||||
 | 
			
		||||
  [ Mattia Rizzolo ]
 | 
			
		||||
  * WIP.
 | 
			
		||||
 | 
			
		||||
  [ Dan Streetman ]
 | 
			
		||||
  * lpapicache:
 | 
			
		||||
    + Make sure that login() actually logins and doesn't use cached credentials.
 | 
			
		||||
@ -10,8 +10,16 @@ ubuntu-dev-tools (0.191) UNRELEASED; urgency=medium
 | 
			
		||||
      operation mode from authenticated to anonymous.  LP: #1984113
 | 
			
		||||
 | 
			
		||||
  [ Stefano Rivera ]
 | 
			
		||||
  * backportpackage: Add support for lsb-release-minimal, which doesn't have a
 | 
			
		||||
    Python module, thanks Gioele Barabucci. (Closes: 1020901)
 | 
			
		||||
  * backportpackage:
 | 
			
		||||
    + Add support for lsb-release-minimal, which doesn't have a Python module.
 | 
			
		||||
      Thanks to Gioele Barabucci for the patch.  Closes: #1020901
 | 
			
		||||
 | 
			
		||||
  [ Mattia Rizzolo ]
 | 
			
		||||
  * ubuntutools/archive.py:
 | 
			
		||||
    + Fix operation of SourcePackage._source_urls() (as used, for example, in
 | 
			
		||||
      SourcePackage.pull() called by backportpackage) to also work when the
 | 
			
		||||
      class is instantiated with a URL as .dsc.  Fixes regression from v0.184.
 | 
			
		||||
      Thanks to Unit 193 for the initial patch.
 | 
			
		||||
 | 
			
		||||
 -- Mattia Rizzolo <mattia@debian.org>  Mon, 22 Aug 2022 17:55:53 +0200
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,7 @@ Approach:
 | 
			
		||||
3. Verify checksums.
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from urllib.request import urlopen
 | 
			
		||||
from urllib.request import urlopen, urlparse, urljoin
 | 
			
		||||
import codecs
 | 
			
		||||
import functools
 | 
			
		||||
import json
 | 
			
		||||
@ -168,7 +168,9 @@ class SourcePackage(ABC):
 | 
			
		||||
        self._series = series
 | 
			
		||||
        self._pocket = pocket
 | 
			
		||||
        self._status = status
 | 
			
		||||
        self._dsc_source = Path(dscfile) if dscfile else None
 | 
			
		||||
        # dscfile can be either a path or an URL.  misc.py's download() will
 | 
			
		||||
        # later fiture it out
 | 
			
		||||
        self._dsc_source = dscfile
 | 
			
		||||
        self._verify_signature = verify_signature
 | 
			
		||||
 | 
			
		||||
        # Cached values:
 | 
			
		||||
@ -323,7 +325,12 @@ class SourcePackage(ABC):
 | 
			
		||||
    def _source_urls(self, name):
 | 
			
		||||
        "Generator of sources for name"
 | 
			
		||||
        if self._dsc_source:
 | 
			
		||||
            yield str(self._dsc_source.parent / name)
 | 
			
		||||
            # we only take "" as file, as regardless if for some reason this
 | 
			
		||||
            # is a file:// url we still need to handle it with urljoin
 | 
			
		||||
            if urlparse(str(self._dsc_source)).scheme == "":
 | 
			
		||||
                yield str(Path(self._dsc_source).parent / name)
 | 
			
		||||
            else:
 | 
			
		||||
                yield urljoin(self._dsc_source, name)
 | 
			
		||||
        for server in self._archive_servers():
 | 
			
		||||
            yield self._mirror_url(server, self.component, name)
 | 
			
		||||
        if self.lp_spph.sourceFileUrl(name):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user