Revert "Add semver import for sorting ls-lR list (#1735)"

This reverts commit e61343f213.
This commit is contained in:
Daniel Marjamäki 2019-03-12 06:25:11 +01:00
parent e61343f213
commit 35bbe5617a
2 changed files with 2 additions and 29 deletions

View File

@ -13,8 +13,6 @@ import glob
import os
import time
import semver
DEBIAN = ('ftp://ftp.se.debian.org/debian/',
'ftp://ftp.debian.org/debian/')
@ -33,14 +31,6 @@ def wget(filepath):
return False
def latestvername(names):
if len(names) == 1:
return names[0]
names.sort(cmp=semver.cmp, key=lambda x: x[x.index(
'_')+1:x.index('.orig.tar')-x.index('_')+1])
return names[-1]
def getpackages():
if not wget('ls-lR.gz'):
return []
@ -53,20 +43,17 @@ def getpackages():
path = None
archives = []
filename = None
filenames = []
for line in lines:
line = line.strip()
if len(line) < 4:
if filename:
archives.append(path + '/' + latestvername(filenames))
archives.append(path + '/' + filename)
path = None
filename = None
filenames = []
elif line[:12] == './pool/main/':
path = line[2:-1]
elif path and '.orig.tar.' in line:
filename = line[1 + line.rfind(' '):]
filenames.append(filename)
for a in archives:
print(a)

View File

@ -16,8 +16,6 @@ import os
import datetime
import time
import semver
DEBIAN = ('ftp://ftp.se.debian.org/debian/',
'ftp://ftp.debian.org/debian/')
@ -35,14 +33,6 @@ def wget(filepath):
return False
def latestvername(names):
if len(names) == 1:
return names[0]
names.sort(cmp=semver.cmp, key=lambda x: x[x.index(
'_')+1:x.index('.orig.tar')-x.index('_')+1])
return names[-1]
def getpackages():
if not wget('ls-lR.gz'):
return []
@ -89,21 +79,17 @@ def getpackages():
path = None
archives = []
filename = None
filenames = []
for line in lines:
line = line.strip()
if len(line) < 4:
if filename:
archives.append(DEBIAN[0] + path + '/' +
latestvername(filenames))
archives.append(DEBIAN[0] + path + '/' + filename)
path = None
filename = None
filenames = []
elif line.startswith('./pool/main/'):
path = line[2:-1]
elif path and line.endswith(('.orig.tar.gz', '.orig.tar.bz2')):
filename = line[1 + line.rfind(' '):]
filenames.append(filename)
return archives