From 10af6668b1d2577443385524ae2dfda1d40b1240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 16 May 2018 13:12:45 +0200 Subject: [PATCH] Use python function to copy ostree installer output --- ...ee-phase-and-pipelines-for-running-p.patch | 2 +- ...evert-Other-repo-for-OstreeInstaller.patch | 2 +- 0003-Revert-Ostree-can-use-pkgset-repos.patch | 2 +- 0004-Update-tests-for-libmodulemd-1.4.0.patch | 2 +- ...e-installer-Copy-files-without-owner.patch | 2 +- ...gned-ostree-repeat-the-fedmsg-in-cas.patch | 2 +- ...ring-comps-environments-all-the-time.patch | 2 +- ...nstaller-Use-Python-function-to-copy.patch | 246 ++++++++++++++++++ pungi.spec | 6 +- 9 files changed, 258 insertions(+), 8 deletions(-) create mode 100644 0008-ostree-installer-Use-Python-function-to-copy.patch diff --git a/0001-Revert-Move-ostree-phase-and-pipelines-for-running-p.patch b/0001-Revert-Move-ostree-phase-and-pipelines-for-running-p.patch index a231e369..dbdc939a 100644 --- a/0001-Revert-Move-ostree-phase-and-pipelines-for-running-p.patch +++ b/0001-Revert-Move-ostree-phase-and-pipelines-for-running-p.patch @@ -1,7 +1,7 @@ From fa0ed11ee0c733e9c3e4785f6526ef889109111c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 11 Apr 2018 09:18:59 +0200 -Subject: [PATCH 1/7] Revert "Move ostree phase and pipelines for running +Subject: [PATCH 1/8] Revert "Move ostree phase and pipelines for running phases" This reverts commit 660c04368ba1abed310f121d01f0fa029eea5f11. diff --git a/0002-Revert-Other-repo-for-OstreeInstaller.patch b/0002-Revert-Other-repo-for-OstreeInstaller.patch index 194d6b22..d8746d37 100644 --- a/0002-Revert-Other-repo-for-OstreeInstaller.patch +++ b/0002-Revert-Other-repo-for-OstreeInstaller.patch @@ -1,7 +1,7 @@ From c62eb8dd27bc17406649e3560223f20b690de63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 11 Apr 2018 09:19:53 +0200 -Subject: [PATCH 2/7] Revert "Other repo for OstreeInstaller" +Subject: [PATCH 2/8] Revert "Other repo for OstreeInstaller" This reverts commit 5c081cb545715c2a912ff50fa57554e89d905868. --- diff --git a/0003-Revert-Ostree-can-use-pkgset-repos.patch b/0003-Revert-Ostree-can-use-pkgset-repos.patch index 47824785..d3dc060f 100644 --- a/0003-Revert-Ostree-can-use-pkgset-repos.patch +++ b/0003-Revert-Ostree-can-use-pkgset-repos.patch @@ -1,7 +1,7 @@ From f51543a24a35145ecbc60e86951accf5369df364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 11 Apr 2018 09:20:51 +0200 -Subject: [PATCH 3/7] Revert "Ostree can use pkgset repos" +Subject: [PATCH 3/8] Revert "Ostree can use pkgset repos" This reverts commit c7cc200246300c6a3946b2e3a9f5f7693896a7d6. --- diff --git a/0004-Update-tests-for-libmodulemd-1.4.0.patch b/0004-Update-tests-for-libmodulemd-1.4.0.patch index 487194c9..9ac7324f 100644 --- a/0004-Update-tests-for-libmodulemd-1.4.0.patch +++ b/0004-Update-tests-for-libmodulemd-1.4.0.patch @@ -1,7 +1,7 @@ From c2fb790652ab9b6f1b03ebd61e70838c0695d1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 2 May 2018 15:36:52 +0200 -Subject: [PATCH 4/7] Update tests for libmodulemd 1.4.0 +Subject: [PATCH 4/8] Update tests for libmodulemd 1.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0005-ostree-installer-Copy-files-without-owner.patch b/0005-ostree-installer-Copy-files-without-owner.patch index 78899316..2a7598ac 100644 --- a/0005-ostree-installer-Copy-files-without-owner.patch +++ b/0005-ostree-installer-Copy-files-without-owner.patch @@ -1,7 +1,7 @@ From 52a3c87c71522db59191f1f7e4e66cee72e67bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Fri, 4 May 2018 08:58:34 +0200 -Subject: [PATCH 5/7] ostree-installer: Copy files without owner +Subject: [PATCH 5/8] ostree-installer: Copy files without owner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0006-Make-wait-for-signed-ostree-repeat-the-fedmsg-in-cas.patch b/0006-Make-wait-for-signed-ostree-repeat-the-fedmsg-in-cas.patch index 0d4f7818..7fb9211e 100644 --- a/0006-Make-wait-for-signed-ostree-repeat-the-fedmsg-in-cas.patch +++ b/0006-Make-wait-for-signed-ostree-repeat-the-fedmsg-in-cas.patch @@ -1,7 +1,7 @@ From 155e60563a6f1a2d593525e563a8e45a4fc4f38c Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Wed, 9 May 2018 23:17:59 +0200 -Subject: [PATCH 6/7] Make wait-for-signed-ostree repeat the fedmsg in case the +Subject: [PATCH 6/8] Make wait-for-signed-ostree repeat the fedmsg in case the signer crashed Signed-off-by: Patrick Uiterwijk diff --git a/0007-init-Stop-filtering-comps-environments-all-the-time.patch b/0007-init-Stop-filtering-comps-environments-all-the-time.patch index 0920b5fb..d42a11d9 100644 --- a/0007-init-Stop-filtering-comps-environments-all-the-time.patch +++ b/0007-init-Stop-filtering-comps-environments-all-the-time.patch @@ -1,7 +1,7 @@ From 5d0e7911e080d4244a071b9af441bcff88b8c6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 10 May 2018 08:58:33 +0200 -Subject: [PATCH 7/7] init: Stop filtering comps environments all the time +Subject: [PATCH 7/8] init: Stop filtering comps environments all the time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0008-ostree-installer-Use-Python-function-to-copy.patch b/0008-ostree-installer-Use-Python-function-to-copy.patch new file mode 100644 index 00000000..5d6277a3 --- /dev/null +++ b/0008-ostree-installer-Use-Python-function-to-copy.patch @@ -0,0 +1,246 @@ +From 038dc1ff00cb566034b1a264a1af1b7d15cd37e0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= +Date: Tue, 15 May 2018 09:26:54 +0200 +Subject: [PATCH 8/8] ostree-installer: Use Python function to copy +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This should give us better error reporting. The `copy_all` function +should preserve permissions on all files. + +Relates: https://pagure.io/pungi/issue/932 +Signed-off-by: Lubomír Sedlář +--- + pungi/phases/ostree_installer.py | 3 +- + tests/test_ostree_installer_phase.py | 57 ++++++++++++++++++------------------ + 2 files changed, 30 insertions(+), 30 deletions(-) + +diff --git a/pungi/phases/ostree_installer.py b/pungi/phases/ostree_installer.py +index 58eede96..0384a600 100644 +--- a/pungi/phases/ostree_installer.py ++++ b/pungi/phases/ostree_installer.py +@@ -98,8 +98,7 @@ class OstreeInstallerThread(WorkerThread): + os_path = compose.paths.compose.os_tree(arch, variant) + boot_iso = os.path.join(output_dir, 'images', 'boot.iso') + +- shortcuts.run('cp -rv %s/* %s/' % +- (shlex_quote(output_dir), shlex_quote(os_path))) ++ util.copy_all(output_dir, os_path) + try: + os.link(boot_iso, iso_path) + except OSError: +diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py +index 62598315..51fac7d5 100644 +--- a/tests/test_ostree_installer_phase.py ++++ b/tests/test_ostree_installer_phase.py +@@ -117,15 +117,16 @@ class OstreeThreadTest(helpers.PungiTestCase): + self.assertEqual(get_file_size.call_args_list, [mock.call(final_iso_path)]) + self.assertEqual(get_mtime.call_args_list, [mock.call(final_iso_path)]) + +- def assertAllCopied(self, run): ++ def assertAllCopied(self, copy_all): + self.assertEqual(self.compose.get_image_name.call_args_list, + [mock.call('x86_64', self.compose.variants['Everything'], disc_type='ostree')]) + self.assertTrue(os.path.isdir(self.topdir + '/work/x86_64/Everything/')) + self.assertFalse(os.path.isdir(self.topdir + '/work/x86_64/Everything/ostree_installer')) +- self.assertEqual(run.call_args_list, +- [mock.call('cp -rv {0}/work/x86_64/Everything/ostree_installer/* {0}/compose/Everything/x86_64/os/'.format(self.topdir))]) ++ self.assertEqual(copy_all.call_args_list, ++ [mock.call('{0}/work/x86_64/Everything/ostree_installer'.format(self.topdir), ++ '{0}/compose/Everything/x86_64/os'.format(self.topdir))]) + +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -133,7 +134,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_run(self, KojiWrapper, link, iso, +- get_file_size, get_mtime, ImageCls, run): ++ get_file_size, get_mtime, ImageCls, copy_all): + self.compose.supported = False + pool = mock.Mock() + cfg = { +@@ -160,9 +161,9 @@ class OstreeThreadTest(helpers.PungiTestCase): + extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) + self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path) + self.assertImageAdded(self.compose, ImageCls, iso) +- self.assertAllCopied(run) ++ self.assertAllCopied(copy_all) + +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -170,7 +171,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_run_external_source(self, KojiWrapper, link, iso, +- get_file_size, get_mtime, ImageCls, run): ++ get_file_size, get_mtime, ImageCls, copy_all): + pool = mock.Mock() + cfg = { + 'repo': 'http://example.com/repo/$arch/', +@@ -194,9 +195,9 @@ class OstreeThreadTest(helpers.PungiTestCase): + extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) + self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path) + self.assertImageAdded(self.compose, ImageCls, iso) +- self.assertAllCopied(run) ++ self.assertAllCopied(copy_all) + +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -204,7 +205,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_run_with_repo_key(self, KojiWrapper, link, iso, +- get_file_size, get_mtime, ImageCls, run): ++ get_file_size, get_mtime, ImageCls, copy_all): + pool = mock.Mock() + cfg = { + 'release': '20160321.n.0', +@@ -234,7 +235,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True, + extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) + +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -242,7 +243,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_run_with_multiple_variant_repos(self, KojiWrapper, link, iso, +- get_file_size, get_mtime, ImageCls, run): ++ get_file_size, get_mtime, ImageCls, copy_all): + pool = mock.Mock() + cfg = { + 'release': '20160321.n.0', +@@ -274,7 +275,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True, + extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) + +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -283,7 +284,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_fail_with_relative_template_path_but_no_repo(self, KojiWrapper, link, + iso, get_file_size, +- get_mtime, ImageCls, run): ++ get_mtime, ImageCls, copy_all): + pool = mock.Mock() + cfg = { + 'repo': 'Everything', +@@ -307,7 +308,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + self.assertIn('template_repo', str(ctx.exception)) + + @mock.patch('pungi.wrappers.scm.get_dir_from_scm') +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -315,7 +316,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_run_clone_templates(self, KojiWrapper, link, iso, +- get_file_size, get_mtime, ImageCls, run, ++ get_file_size, get_mtime, ImageCls, copy_all, + get_dir_from_scm): + pool = mock.Mock() + cfg = { +@@ -354,9 +355,9 @@ class OstreeThreadTest(helpers.PungiTestCase): + '--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) + self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path) + self.assertImageAdded(self.compose, ImageCls, iso) +- self.assertAllCopied(run) ++ self.assertAllCopied(copy_all) + +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -364,7 +365,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_run_with_explicitly_generated_release(self, KojiWrapper, link, iso, +- get_file_size, get_mtime, ImageCls, run): ++ get_file_size, get_mtime, ImageCls, copy_all): + pool = mock.Mock() + cfg = { + 'repo': 'Everything', +@@ -415,9 +416,9 @@ class OstreeThreadTest(helpers.PungiTestCase): + ) + self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path) + self.assertImageAdded(self.compose, ImageCls, iso) +- self.assertAllCopied(run) ++ self.assertAllCopied(copy_all) + +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -425,7 +426,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_run_with_implicit_release(self, KojiWrapper, link, iso, +- get_file_size, get_mtime, ImageCls, run): ++ get_file_size, get_mtime, ImageCls, copy_all): + pool = mock.Mock() + cfg = { + 'repo': 'Everything', +@@ -476,9 +477,9 @@ class OstreeThreadTest(helpers.PungiTestCase): + ) + self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path) + self.assertImageAdded(self.compose, ImageCls, iso) +- self.assertAllCopied(run) ++ self.assertAllCopied(copy_all) + +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -486,7 +487,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_fail_crash(self, KojiWrapper, link, iso, get_file_size, +- get_mtime, ImageCls, run): ++ get_mtime, ImageCls, copy_all): + pool = mock.Mock() + cfg = { + 'repo': 'Everything', +@@ -504,7 +505,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + mock.call('BOOM') + ]) + +- @mock.patch('kobo.shortcuts.run') ++ @mock.patch('pungi.util.copy_all') + @mock.patch('productmd.images.Image') + @mock.patch('pungi.util.get_mtime') + @mock.patch('pungi.util.get_file_size') +@@ -512,7 +513,7 @@ class OstreeThreadTest(helpers.PungiTestCase): + @mock.patch('os.link') + @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') + def test_fail_runroot_fail(self, KojiWrapper, link, iso, +- get_file_size, get_mtime, ImageCls, run): ++ get_file_size, get_mtime, ImageCls, copy_all): + pool = mock.Mock() + cfg = { + 'repo': 'Everything', +-- +2.14.3 + diff --git a/pungi.spec b/pungi.spec index 2658dd3f..4f7f05d9 100644 --- a/pungi.spec +++ b/pungi.spec @@ -1,6 +1,6 @@ Name: pungi Version: 4.1.24 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Distribution compose tool Group: Development/Tools @@ -14,6 +14,7 @@ Patch3: 0004-Update-tests-for-libmodulemd-1.4.0.patch Patch4: 0005-ostree-installer-Copy-files-without-owner.patch Patch5: 0006-Make-wait-for-signed-ostree-repeat-the-fedmsg-in-cas.patch Patch6: 0007-init-Stop-filtering-comps-environments-all-the-time.patch +Patch7: 0008-ostree-installer-Use-Python-function-to-copy.patch BuildRequires: python3-nose BuildRequires: python3-mock @@ -180,6 +181,9 @@ nosetests-3 --exe %{_bindir}/%{name}-wait-for-signed-ostree-handler %changelog +* Wed May 16 2018 Lubomír Sedlář - 4.1.24-4 +- Use python function to copy ostree installer output + * Thu May 10 2018 Lubomír Sedlář - 4.1.24-3 - Make wait-for-signed-ostree repeat the fedmsg in case the signer crashed - Stop filtering comps environments all the time