Check for mtime of downloaded files too so we replace when required.
This commit is contained in:
parent
a640169a7d
commit
f7816dce60
@ -667,10 +667,11 @@ def _check_repo_repo_list(self, prj, repo, arch, pkg, opts, ignore=False):
|
|||||||
binaries = ET.parse(http_GET(url)).getroot()
|
binaries = ET.parse(http_GET(url)).getroot()
|
||||||
for bin_ in binaries.findall('binary'):
|
for bin_ in binaries.findall('binary'):
|
||||||
fn = bin_.attrib['filename']
|
fn = bin_.attrib['filename']
|
||||||
|
mt = bin_.attrib['mtime']
|
||||||
result = re.match(r'(.*)-([^-]*)-([^-]*)\.([^-\.]+)\.rpm', fn)
|
result = re.match(r'(.*)-([^-]*)-([^-]*)\.([^-\.]+)\.rpm', fn)
|
||||||
if not result:
|
if not result:
|
||||||
if fn == 'rpmlint.log':
|
if fn == 'rpmlint.log':
|
||||||
files.append((fn, '', ''))
|
files.append((fn, '', '', mt))
|
||||||
continue
|
continue
|
||||||
pname = result.group(1)
|
pname = result.group(1)
|
||||||
if pname.endswith('-debuginfo') or pname.endswith('-debuginfo-32bit'):
|
if pname.endswith('-debuginfo') or pname.endswith('-debuginfo-32bit'):
|
||||||
@ -679,7 +680,7 @@ def _check_repo_repo_list(self, prj, repo, arch, pkg, opts, ignore=False):
|
|||||||
continue
|
continue
|
||||||
if result.group(4) == 'src':
|
if result.group(4) == 'src':
|
||||||
continue
|
continue
|
||||||
files.append((fn, pname, result.group(4)))
|
files.append((fn, pname, result.group(4), mt))
|
||||||
except urllib2.HTTPError, e:
|
except urllib2.HTTPError, e:
|
||||||
pass
|
pass
|
||||||
# if not ignore:
|
# if not ignore:
|
||||||
@ -687,12 +688,14 @@ def _check_repo_repo_list(self, prj, repo, arch, pkg, opts, ignore=False):
|
|||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
def _check_repo_get_binary(self, apiurl, prj, repo, arch, package, file, target):
|
def _check_repo_get_binary(self, apiurl, prj, repo, arch, package, file, target, mtime):
|
||||||
if os.path.exists(target):
|
if os.path.exists(target):
|
||||||
|
# we need to check the mtime too as the file might get updated
|
||||||
|
cur = os.path.getmtime(target)
|
||||||
|
if mtime > cur:
|
||||||
return
|
return
|
||||||
get_binary_file(apiurl, prj, repo, arch, file, package = package, target_filename = target)
|
get_binary_file(apiurl, prj, repo, arch, file, package = package, target_filename = target)
|
||||||
|
|
||||||
|
|
||||||
def _get_verifymd5(self, p, rev):
|
def _get_verifymd5(self, p, rev):
|
||||||
try:
|
try:
|
||||||
url = makeurl(self.get_api_url(), ['source', p.sproject, p.spackage, '?view=info&rev=%s' % rev])
|
url = makeurl(self.get_api_url(), ['source', p.sproject, p.spackage, '?view=info&rev=%s' % rev])
|
||||||
@ -726,21 +729,21 @@ def _check_repo_download(self, p, opts):
|
|||||||
# we can assume x86_64 is there
|
# we can assume x86_64 is there
|
||||||
todownload = []
|
todownload = []
|
||||||
for fn in self._check_repo_repo_list(p.sproject, repo, 'x86_64', p.spackage, opts):
|
for fn in self._check_repo_repo_list(p.sproject, repo, 'x86_64', p.spackage, opts):
|
||||||
todownload.append(('x86_64', fn[0]))
|
todownload.append(('x86_64', fn[0], fn[3]))
|
||||||
|
|
||||||
# now fetch -32bit packs
|
# now fetch -32bit packs
|
||||||
for fn in self._check_repo_repo_list(p.sproject, repo, 'i586', p.spackage, opts):
|
for fn in self._check_repo_repo_list(p.sproject, repo, 'i586', p.spackage, opts):
|
||||||
if fn[2] == 'x86_64':
|
if fn[2] == 'x86_64':
|
||||||
todownload.append(('i586', fn[0]))
|
todownload.append(('i586', fn[0], fn[3]))
|
||||||
|
|
||||||
p.downloads[repo] = []
|
p.downloads[repo] = []
|
||||||
for arch, fn in todownload:
|
for arch, fn, mt in todownload:
|
||||||
repodir = os.path.join(opts.downloads, p.spackage, repo)
|
repodir = os.path.join(opts.downloads, p.spackage, repo)
|
||||||
if not os.path.exists(repodir):
|
if not os.path.exists(repodir):
|
||||||
os.makedirs(repodir)
|
os.makedirs(repodir)
|
||||||
t = os.path.join(repodir, fn)
|
t = os.path.join(repodir, fn)
|
||||||
self._check_repo_get_binary(opts.apiurl, p.sproject, repo,
|
self._check_repo_get_binary(opts.apiurl, p.sproject, repo,
|
||||||
arch, p.spackage, fn, t)
|
arch, p.spackage, fn, t, mt)
|
||||||
p.downloads[repo].append(t)
|
p.downloads[repo].append(t)
|
||||||
if fn.endswith('.rpm'):
|
if fn.endswith('.rpm'):
|
||||||
pid = subprocess.Popen(['rpm', '--nosignature', '--queryformat', '%{DISTURL}', '-qp', t],
|
pid = subprocess.Popen(['rpm', '--nosignature', '--queryformat', '%{DISTURL}', '-qp', t],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user