diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2012-07-25 10:50:41 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2012-07-25 10:50:41 +0200 |
commit | 0c0dd0c322ad451b418922f37e202076940171bb (patch) | |
tree | 667ae5762b40e40f17905b41e18e4987849754d3 | |
parent | 74576779fce94b22bd0324d5f976741d1864038c (diff) |
geniso: allow to filter out debug files
.pdb files are Windows debug files, and are quite big compared to
the size of the drivers. This commit adds an argument to
virtio.copy_drivers to indicate whether to keep the debug files or
not.
-rw-r--r-- | tools/gen-upstream-virtio-iso.py | 2 | ||||
-rw-r--r-- | tools/virtio.py | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/tools/gen-upstream-virtio-iso.py b/tools/gen-upstream-virtio-iso.py index c4f1ddf..bf1eed1 100644 --- a/tools/gen-upstream-virtio-iso.py +++ b/tools/gen-upstream-virtio-iso.py @@ -13,6 +13,6 @@ output_iso_name = "drivers.iso" iso_name = virtio.download_iso(tempdir) iso_path = os.path.join(tempdir, iso_name) with iso.IsoMounter(iso_path, mountpoint): - virtio.copy_drivers(mountpoint, drivers_dest) + virtio.copy_drivers(mountpoint, drivers_dest, copy_debug = True) iso.geniso(drivers_dest, output_iso_name) print "done" diff --git a/tools/virtio.py b/tools/virtio.py index ca2ca86..b05b370 100644 --- a/tools/virtio.py +++ b/tools/virtio.py @@ -5,6 +5,8 @@ import shutil import sys import urllib2 +_debug_regex = re.compile(".*\.pdb$") + class Driver: def __init__(self, x86_path, amd64_path, file_regex): self.paths = { "x86": x86_path, "amd64": amd64_path } @@ -65,7 +67,7 @@ driver_sets = { copied_drivers = {} -def _copy_driver(base_src, base_dest, driver, win_name): +def _copy_driver(base_src, base_dest, driver, win_name, copy_debug = False): for arch in [ "x86", "amd64" ]: dest_path = os.path.join(base_dest, win_name, arch) try: @@ -87,6 +89,8 @@ def _copy_driver(base_src, base_dest, driver, win_name): file_regex = re.compile(driver.file_regex) for file in os.listdir(src_path): if (file_regex.match(file)): + if not copy_debug and _debug_regex.match(file): + continue try: src_file = os.path.join(src_path, file) dest_file = os.path.join(dest_path, file) @@ -100,7 +104,7 @@ def _copy_driver(base_src, base_dest, driver, win_name): copied_drivers[driver_key] = dest_path -def copy_drivers(base_src, base_dest, driver_filter = None): +def copy_drivers(base_src, base_dest, driver_filter = None, copy_debug = False): for win, driver_set in driver_sets.iteritems(): print "OS: ", win; for driver_name, driver in driver_set.iteritems(): @@ -108,7 +112,7 @@ def copy_drivers(base_src, base_dest, driver_filter = None): print "skipping ", driver_name continue print "DRIVER: ", driver_name - _copy_driver(base_src, base_dest, driver, win) + _copy_driver(base_src, base_dest, driver, win, copy_debug) def download_iso(dest): base_url = "http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/" |