~curtin-dev/curtin/xenial

« back to all changes in this revision

Viewing changes to tools/vmtest-sync-images

  • Committer: Scott Moser
  • Date: 2017-01-18 16:01:35 UTC
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: smoser@ubuntu.com-20170118160135-08jqgjm1rbp6zb1x
* debian/new-upstream-snapshot: change to not use bzr merge-upstream.
* New upstream snapshot.
  - revert: Test Workaround: skip XenialTestNvme for a short time.
  - Test Workaround: skip XenialTestNvme for a short time.
  - pep8: fix pep8 errors found with 'make pep8' on zesty.
  - Workaround failures caused by gpg2 daemons left running in chroot.
    (LP: #1645680)
  - Install u-boot-tools when running on a system with u-boot. (LP: #1640519)
  - block: fix partition kname for raid devices  (LP: #1641661)
  - Fix up tox errors that slipped in and new pycodestyle 2.1.0 complaints.
  - vmtests: adjust vmtest image sync metadata filenames
  - vmtests: Add centos support
  - Disable WilyTestRaid5Bcache vmtest
  - tools/xkvm: fix --netdev=<bridge>
  - bytes2human: fix for values larger than 32 bit int on 32 bit python2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
from tests.vmtests import (
13
13
    IMAGE_DIR, IMAGE_SRC_URL, sync_images)
14
14
from tests.vmtests.image_sync import ITEM_NAME_FILTERS
15
 
from tests.vmtests.helpers import find_releases
 
15
from tests.vmtests.helpers import find_releases_by_distro
16
16
from curtin.util import get_platform_arch
17
17
 
18
18
DEFAULT_ARCH = get_platform_arch()
19
19
 
20
20
 
 
21
def _fmt_list_filter(filter_name, matches):
 
22
    return '~'.join((filter_name, '|'.join(matches)))
 
23
 
 
24
 
21
25
if __name__ == '__main__':
22
26
    if len(sys.argv) > 1 and sys.argv[1] == "--clean":
23
27
        print("cleaning image dir %s" % IMAGE_DIR)
35
39
                        os.unlink(fpath)
36
40
 
37
41
    arg_releases = [r for r in sys.argv[1:] if r != "--clean"]
 
42
    arch_filters = ['arch={}'.format(DEFAULT_ARCH)]
 
43
    filter_sets = []
38
44
    if len(arg_releases):
39
 
        releases = arg_releases
 
45
        filter_sets.append([_fmt_list_filter('release', arg_releases)])
40
46
    else:
41
 
        releases = find_releases()
42
 
    release_filter = 'release~{}'.format('|'.join(releases))
43
 
    my_filters = ['arch=' + DEFAULT_ARCH, release_filter] + ITEM_NAME_FILTERS
 
47
        filter_sets.extend(
 
48
            (['os={}'.format(distro), _fmt_list_filter('release', rels)]
 
49
             for (distro, rels) in find_releases_by_distro().items()))
 
50
 
44
51
    # Sync images.
45
 
    sync_images(IMAGE_SRC_URL, IMAGE_DIR, filters=my_filters, verbosity=1)
 
52
    for filter_set in filter_sets:
 
53
        sync_images(IMAGE_SRC_URL, IMAGE_DIR, verbosity=1,
 
54
                    filters=filter_set + ITEM_NAME_FILTERS + arch_filters)