コード例 #1
0
 def __appendArch(self, arch, location):
     """Appends an architecture to a location"""
     if arch == '32bit':
         return lib.joinUrl(location, 'binary-i386/Packages.gz')
     elif arch == '64bit':
         return lib.joinUrl(location, 'binary-amd64/Packages.gz')
     return location
コード例 #2
0
ファイル: Debian.py プロジェクト: rizaumami/keryx
 def __urlsFromDebs(self, deblist, arch):
     urls = []
     for item in deblist:
         data = item.split()
         try:
             dtype = data[0]
             url = data[1]
             dist = data[2]
             if len(data) == 3: pass
             for section in data[3:]:
                 if section.find('#') != -1: break
                 main = lib.joinUrl(lib.joinUrl(lib.joinUrl(url, 'dists'), dist), section)
                 main = self.__appendArch(arch, main)
                 urls.append(main)
         except: pass
     return urls
コード例 #3
0
    def __readPackages(self, infile, installed, packages, mainUrl=''):
        # up-to-date, name, installed ver, latest ver, descrip, depends,
        # filename, size(int)
        current = ['', '', '', '', '', '', '', '', '', '', {}]

        for line in infile:
            if line.startswith("Package:"): current[1] = line[9:-1]
            if line.startswith("Version:"): current[3] = line[9:-1]
            if line.startswith("Description:"):
                current[4] = lib.utf(line[13:-1])
            if line.startswith("Depends:"): current[5] = line[9:-1]
            if line.startswith("Filename:"):
                current[6] = lib.joinUrl(mainUrl, line[10:-1])
            if line.startswith("Size:"): current[7] = int(line[6:-1])
            if line.startswith("Recommends:"): current[8] = line[12:-1]
            if line.startswith("Pre-Depends:"): current[9] = line[13:-1]
            if line.startswith("MD5sum:"):
                current[10].update({'MD5sum': line[8:-1]})
            if line.startswith("SHA1:"):
                current[10].update({'SHA1': line[6:-1]})
            if line.startswith("SHA256:"):
                current[10].update({'SHA256': line[8:-1]})

            if line.startswith("\n") and current[
                    1] != '':  # Finished reading this package, append it
                self.__updatePackage(
                    current, installed,
                    packages)  # Set the packages installed version
                current = ['', '', '', '', '', '', '', '', '', '', {}]

        return packages
コード例 #4
0
ファイル: Debian.py プロジェクト: simula67/keryx_url
 def __tempFilesFromDebs(self, deblist, arch, dir=''): # Generates a list of files from deb entries
     local = []
     for item in deblist:
         data = item.split()
         try:
             dtype = data[0]
             url = data[1]
             dist = data[2]
             if len(data) == 3: pass #FIXME: Special case, append only the sections to the end
             for section in data[3:]:
                 if section.find('#') != -1: break # If a comment is encountered skip the line
                 main = lib.joinUrl(lib.joinUrl(lib.joinUrl(url, 'dists'), dist), section)
                 main = self.__appendArch(arch, main)
                 main = main[7:].replace('/','_')
                 local.append(os.path.join(dir, main)) # Strips unnecessary characters and appends to list
         except: pass # Unable to parse deb entry
     return local
コード例 #5
0
 def __urlsFromDebs(self, deblist, arch):
     urls = []
     for item in deblist:
         data = item.split()
         try:
             dtype = data[0]
             url = data[1]
             dist = data[2]
             if len(data) == 3: pass
             for section in data[3:]:
                 if section.find('#') != -1: break
                 main = lib.joinUrl(
                     lib.joinUrl(lib.joinUrl(url, 'dists'), dist), section)
                 main = self.__appendArch(arch, main)
                 urls.append(main)
         except:
             pass
     return urls
コード例 #6
0
 def __tempFilesFromDebs(self, deblist, arch, dir=''):
     """Generates a list of files from deb entries"""
     local = []
     for item in deblist:
         data = item.split()
         try:
             dtype = data[0]
             url = data[1]
             dist = data[2]
             if len(data) == 3:
                 pass  #FIXME: Special case, append only the sections to the end
             for section in data[3:]:
                 if section.find('#') != -1:
                     break  # If a comment is encountered skip the line
                 main = lib.joinUrl(
                     lib.joinUrl(lib.joinUrl(url, 'dists'), dist), section)
                 main = self.__appendArch(arch, main)
                 main = main[7:].replace('/', '_')
                 local.append(
                     os.path.join(dir, main)
                 )  # Strips unnecessary characters and appends to list
         except:
             pass  # Unable to parse deb entry
     return local
コード例 #7
0
ファイル: Debian.py プロジェクト: simula67/keryx_url
    def __readPackages(self, infile, installed, packages, mainUrl=''):
        # up-to-date, name, installed ver, latest ver, descrip, depends, filename, size(int)
        current = ['','','','','','','','','','']

        for line in infile:
            if line.startswith("Package:"):     current[1] = line[9:-1]
            if line.startswith("Version:"):     current[3] = line[9:-1]
            if line.startswith("Description:"): current[4] = lib.utf(line[13:-1])
            if line.startswith("Depends:"):     current[5] = line[9:-1]
            if line.startswith("Filename:"):    current[6] = lib.joinUrl(mainUrl, line[10:-1])
            if line.startswith("Size:"):        current[7] = int(line[6:-1])
            if line.startswith("Recommends:"):  current[8] = line[13:-1]
            if line.startswith("Pre-Depends:"): current[9] = line[13:-1]

            if line.startswith("\n") and current[1] != '': # Finished reading this package, append it
                self.__updatePackage(current, installed, packages) # Set the packages installed version
                current = ['','','','','','','','','','']
                
        return packages
コード例 #8
0
ファイル: Debian.py プロジェクト: rizaumami/keryx
 def __appendArch(self, arch, location): 
     """Appends an architecture to a location"""
     if arch == '32bit': return lib.joinUrl(location, 'binary-i386/Packages.gz')
     elif arch == '64bit': return lib.joinUrl(location, 'binary-amd64/Packages.gz')
     return location