Commit bd2ffef6 authored by Seth Vidal's avatar Seth Vidal

check in patch from Mark McLoughlin to fix handling of local repos in

reposync, repotrack and yumdownloader.
parent 3a96cac5
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
import os import os
import sys import sys
import shutil
from optparse import OptionParser from optparse import OptionParser
from urlparse import urljoin from urlparse import urljoin
...@@ -186,9 +187,10 @@ def main(): ...@@ -186,9 +187,10 @@ def main():
if not opts.quiet: if not opts.quiet:
my.logger.info( 'Downloading %s' % os.path.basename(remote)) my.logger.info( 'Downloading %s' % os.path.basename(remote))
pkg.localpath = local # Hack: to set the localpath we want. pkg.localpath = local # Hack: to set the localpath we want.
repo.getPackage(pkg) path = repo.getPackage(pkg)
if not os.path.exists(local) or not os.path.samefile(path, local):
shutil.copy2(path, local)
if __name__ == "__main__": if __name__ == "__main__":
main() main()
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
import os import os
import sys import sys
import shutil
from optparse import OptionParser from optparse import OptionParser
from urlparse import urljoin from urlparse import urljoin
import logging import logging
...@@ -235,8 +236,10 @@ def main(): ...@@ -235,8 +236,10 @@ def main():
if not opts.quiet: if not opts.quiet:
my.logger.info('Downloading %s' % os.path.basename(remote)) my.logger.info('Downloading %s' % os.path.basename(remote))
pkg.localpath = local # Hack: to set the localpath to what we want. pkg.localpath = local # Hack: to set the localpath to what we want.
repo.getPackage(pkg) path = repo.getPackage(pkg)
if not os.path.exists(local) or not os.path.samefile(path, local):
shutil.copy2(path, local)
if __name__ == "__main__": if __name__ == "__main__":
main() main()
......
...@@ -21,6 +21,7 @@ sys.path.insert(0, '/usr/share/yum-cli') ...@@ -21,6 +21,7 @@ sys.path.insert(0, '/usr/share/yum-cli')
import yum import yum
import yum.Errors import yum.Errors
import os import os
import shutil
import output import output
import rpmUtils.arch import rpmUtils.arch
from urlgrabber.progress import TextMeter from urlgrabber.progress import TextMeter
...@@ -174,7 +175,14 @@ def main(): ...@@ -174,7 +175,14 @@ def main():
# Disable cache otherwise things won't download # Disable cache otherwise things won't download
repo.cache = 0 repo.cache = 0
download.localpath = local # Hack: to set the localpath we want. download.localpath = local # Hack: to set the localpath we want.
repo.getPackage(download) path = repo.getPackage(download)
if not os.path.exists(local) or not os.path.samefile(path, local):
progress = TextMeter()
progress.start(basename=os.path.basename(local),
size=os.stat(path).st_size)
shutil.copy2(path, local)
progress.end(progress.size)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment