diff -Nru simplestreams-0.1.0-491-g2920b06/debian/changelog simplestreams-0.1.0-492-g4403b3d/debian/changelog --- simplestreams-0.1.0-491-g2920b06/debian/changelog 2020-04-06 21:47:23.000000000 +0000 +++ simplestreams-0.1.0-492-g4403b3d/debian/changelog 2020-04-08 19:19:50.000000000 +0000 @@ -1,6 +1,6 @@ -simplestreams (0.1.0-491-g2920b06-0ubuntu1~ubuntu19.04.1) disco; urgency=low +simplestreams (0.1.0-492-g4403b3d-0ubuntu1~ubuntu19.04.1) disco; urgency=low * Auto build. - -- Launchpad Package Builder Mon, 06 Apr 2020 21:47:23 +0000 + -- Launchpad Package Builder Wed, 08 Apr 2020 19:19:50 +0000 diff -Nru simplestreams-0.1.0-491-g2920b06/debian/git-build-recipe.manifest simplestreams-0.1.0-492-g4403b3d/debian/git-build-recipe.manifest --- simplestreams-0.1.0-491-g2920b06/debian/git-build-recipe.manifest 2020-04-06 21:47:23.000000000 +0000 +++ simplestreams-0.1.0-492-g4403b3d/debian/git-build-recipe.manifest 2020-04-08 19:19:50.000000000 +0000 @@ -1,2 +1,2 @@ -# git-build-recipe format 0.4 deb-version 0.1.0-491-g2920b06-0ubuntu1 -lp:simplestreams git-commit:2920b068f32becc833d197aa5fb7b65cb0b5b178 +# git-build-recipe format 0.4 deb-version 0.1.0-492-g4403b3d-0ubuntu1 +lp:simplestreams git-commit:4403b3df81ad3e00908579c33ef4dacc3942ae41 diff -Nru simplestreams-0.1.0-491-g2920b06/doc/README simplestreams-0.1.0-492-g4403b3d/doc/README --- simplestreams-0.1.0-491-g2920b06/doc/README 2020-04-06 21:47:23.000000000 +0000 +++ simplestreams-0.1.0-492-g4403b3d/doc/README 2020-04-08 19:19:50.000000000 +0000 @@ -114,6 +114,15 @@ 'path' entries for a given item must be immutable. That is, for a given 'path' under a mirror, the content must never change. + An 'item' dictionary may contain a 'mirrors' element. + + 'mirrors' entries it used for supply a list of mirrors prefix where + retrieve the item. When 'mirrors' is present client must create + the URL of the resource to fetch with the 'path' entry: + + item_url = item_mirrors[0] . item_path + + == Index == This is a index of products files that are available. It has a top level 'index' dictionary. Each entry in that dictionary is a diff -Nru simplestreams-0.1.0-491-g2920b06/simplestreams/generate_simplestreams.py simplestreams-0.1.0-492-g4403b3d/simplestreams/generate_simplestreams.py --- simplestreams-0.1.0-491-g2920b06/simplestreams/generate_simplestreams.py 2020-04-06 21:47:23.000000000 +0000 +++ simplestreams-0.1.0-492-g4403b3d/simplestreams/generate_simplestreams.py 2020-04-08 19:19:50.000000000 +0000 @@ -91,7 +91,10 @@ for content_id in trees: if condense: util.products_condense(trees[content_id], - sticky=['path', 'sha256', 'md5', 'size']) + sticky=[ + 'path', 'sha256', 'md5', + 'size', 'mirrors' + ]) content = trees[content_id] to_write.append((index['index'][content_id]['path'], content,)) out_filenames = [] diff -Nru simplestreams-0.1.0-491-g2920b06/tests/unittests/test_generate_simplestreams.py simplestreams-0.1.0-492-g4403b3d/tests/unittests/test_generate_simplestreams.py --- simplestreams-0.1.0-491-g2920b06/tests/unittests/test_generate_simplestreams.py 2020-04-06 21:47:23.000000000 +0000 +++ simplestreams-0.1.0-492-g4403b3d/tests/unittests/test_generate_simplestreams.py 2020-04-08 19:19:50.000000000 +0000 @@ -264,3 +264,19 @@ 'item-1': {'arch': 'amd64'}, 'item-2': {'arch': 'amd64'}, }}}}}} self.assertEqual(bar, expected) + + def test_mirrors(self): + trees = { + 'bar': {'products': {'prodbar': {'versions': {'1': {'items': { + 'item-1': {'arch': 'amd64', 'mirrors': ['url1', 'url2']}, + 'item-2': {'arch': 'amd64'}}}}}}}} + with temp_dir() as out_dir, patch('sys.stderr', StringIO()): + write_streams(out_dir, trees, self.updated, FakeNamer, + condense=False) + with open(os.path.join(out_dir, 'bar.json')) as bar_file: + bar = json.load(bar_file) + expected = { + 'products': {'prodbar': {'versions': {'1': {'items': { + 'item-1': {'arch': 'amd64', 'mirrors': ['url1', 'url2']}, + 'item-2': {'arch': 'amd64'}, }}}}}} + self.assertEqual(bar, expected) diff -Nru simplestreams-0.1.0-491-g2920b06/tools/make-test-data simplestreams-0.1.0-492-g4403b3d/tools/make-test-data --- simplestreams-0.1.0-491-g2920b06/tools/make-test-data 2020-04-06 21:47:23.000000000 +0000 +++ simplestreams-0.1.0-492-g4403b3d/tools/make-test-data 2020-04-08 19:19:50.000000000 +0000 @@ -53,7 +53,13 @@ FAKE_DATA = { 'root.tar.gz': {'size': 10240}, - 'root.tar.xz': {'size': 10241}, + 'root.tar.xz': { + 'size': 10241, + 'mirrors': [ + 'https://us.images.linuxcontainers.org/', + 'https://uk.images.linuxcontainers.org/' + ] + }, 'root.manifest': {'size': 10242}, 'lxd.tar.xz': {'size': 10245}, 'tar.gz': {'size': 11264}, @@ -311,6 +317,8 @@ rootitem = item.copy() rootitem['ftype'] = extension.lstrip('-.') rootitem['path'] = rootpath + if 'mirrors' in FAKE_DATA[ftype]: + rootitem['mirrors'] = FAKE_DATA[ftype]['mirrors'] create_fake_file(prefix, rootitem) # and sha256 hash the combined file