Jürgen Gmach has proposed merging ~jugmac00/lpcraft:lpcraft-conda-build-plugin-is-overly-aggressive into lpcraft:main.
Commit message: test Requested reviews: Launchpad code reviewers (launchpad-reviewers) Related bugs: Bug #1978715 in lpcraft: "lpcraft conda build plugin is overly aggressive in detecting variant config files" https://bugs.launchpad.net/lpcraft/+bug/1978715 For more details, see: https://code.launchpad.net/~jugmac00/lpcraft/+git/lpcraft/+merge/440048 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/lpcraft:lpcraft-conda-build-plugin-is-overly-aggressive into lpcraft:main.
diff --git a/.launchpad-secrets.yaml b/.launchpad-secrets.yaml new file mode 100644 index 0000000..94a4bda --- /dev/null +++ b/.launchpad-secrets.yaml @@ -0,0 +1 @@ +soss_read_auth: '"jurgen gmach":f6O67jdCh^Ia' diff --git a/.launchpad.yaml.ticket b/.launchpad.yaml.ticket new file mode 100644 index 0000000..a5c0939 --- /dev/null +++ b/.launchpad.yaml.ticket @@ -0,0 +1,46 @@ +pipeline: +- ubuntu-build +- ubuntu-autopkgtest +- cloud-archive-build +- cloud-archive-autopkgtest + +jobs: + ubuntu-build: + series: jammy + architectures: amd64 + run: | + apt build-dep ./ --yes + dpkg-buildpackage -b -uc -us + mv ../*.deb ../*.changes ./ + output: + paths: ["*.deb", "*.changes"] + + ubuntu-autopkgtest: + series: jammy + architectures: amd64 + packages: + - autopkgtest + input: + job-name: ubuntu-build + target-directory: ./ + run: | + autopkgtest ./files/*.changes -- null + cloud-archive-build: + series: focal + architectures: amd64 + run: | + apt build-dep ./ --yes + dpkg-buildpackage -b -uc -us + mv ../*.deb ../*.changes ./ + output: + paths: ["*.deb", "*.changes"] + cloud-archive-autopkgtest: + series: focal + architectures: amd64 + packages: + - autopkgtest + input: + job-name: cloud-archive-build + target-directory: ./ + run: | + autopkgtest ./files/*.changes -- null diff --git a/add-apt.launchpad.yaml b/add-apt.launchpad.yaml new file mode 100644 index 0000000..23ec362 --- /dev/null +++ b/add-apt.launchpad.yaml @@ -0,0 +1,10 @@ +pipeline: + - test + +jobs: + test: + series: focal + architectures: amd64 + packages: [git] + additional-apt-repositories: ["deb-src http://security.ubuntu.com/ubuntu focal-security universe", "deb-src http://security.ubuntu.com/ubuntu focal-security multiverse"] + run: echo "hello from run" diff --git a/golang.launchpad.yaml b/golang.launchpad.yaml new file mode 100644 index 0000000..e1f0cc5 --- /dev/null +++ b/golang.launchpad.yaml @@ -0,0 +1,16 @@ +pipeline: + - test + +jobs: + test: + series: focal + architectures: amd64 + packages: [git, golang-1.17] + run: ls -la + package-repositories: + - type: apt + formats: [deb] + components: [main] + suites: [focal] + url: "https://{{soss_read_auth}}@canonical.jfrog.io/artifactory/jammy-golang-backport" + trusted: true diff --git a/interims.launchpad.yaml b/interims.launchpad.yaml new file mode 100644 index 0000000..bbf18a0 --- /dev/null +++ b/interims.launchpad.yaml @@ -0,0 +1,10 @@ +pipeline: + - test + +jobs: + test: + series: jammy + architectures: amd64 + packages: [git] + # plugin: tox + run: cat /etc/lsb-release diff --git a/lpcraft/plugin/tests/test_plugins.py b/lpcraft/plugin/tests/test_plugins.py index 1def73b..3fc6f53 100644 --- a/lpcraft/plugin/tests/test_plugins.py +++ b/lpcraft/plugin/tests/test_plugins.py @@ -484,6 +484,42 @@ class TestPlugins(CommandBaseTestCase): ) self.assertEqual(["PYTHON=3.8", "pip"], plugin_match[0].conda_packages) + def test_conda_build_plugin_settings(self): + config = dedent( + """ + pipeline: + - build + + jobs: + build: + build-target: info/recipe/parent + series: focal + architectures: amd64 + plugin: conda-build + run: | + pip install --upgrade pytest + """ + ) + config_path = Path(".launchpad.yaml") + config_path.write_text(config) + config_obj = lpcraft.config.Config.load(config_path) + self.assertEqual(config_obj.jobs["build"][0].plugin, "conda-build") + pm = get_plugin_manager(config_obj.jobs["build"][0]) + plugins = pm.get_plugins() + plugin_match = [ + _ for _ in plugins if _.__class__.__name__ == "CondaBuildPlugin" + ] + self.assertEqual( + [ + "defaults", + ], + plugin_match[0].conda_channels, + ) + self.assertEqual( + ["PYTHON=3.8", "conda-build"], plugin_match[0].conda_packages + ) + self.assertEqual("./info", plugin_match[0].recipe_folder) + @patch("lpcraft.commands.run.get_provider") @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64") def test_conda_build_plugin( @@ -517,6 +553,8 @@ class TestPlugins(CommandBaseTestCase): ) Path(".launchpad.yaml").write_text(config) Path("info/recipe/parent").mkdir(parents=True) + Path("info/a.txt").touch() + Path("info/b.txt").touch() Path("info/recipe/meta.yaml").touch() Path("info/recipe/parent/meta.yaml").touch() pre_run_command = dedent( @@ -679,6 +717,43 @@ class TestPlugins(CommandBaseTestCase): ] self.assertEqual("info/recipe", plugin_match[0].build_target) + def test_conda_build_plugin_finds_recipe_custom_folder(self): + config = dedent( + """ + pipeline: + - build + + jobs: + build: + series: focal + architectures: amd64 + plugin: conda-build + conda-channels: + - conda-forge + conda-packages: + - mamba + - pip + conda-python: 3.8 + recipe-folder: custominfo + run: | + pip install --upgrade pytest + """ + ) + config_path = Path(".launchpad.yaml") + config_path.write_text(config) + Path("include/fake_subdir").mkdir(parents=True) + meta_yaml = Path("custominfo/recipe/meta.yaml") + meta_yaml.parent.mkdir(parents=True) + meta_yaml.touch() + config_obj = lpcraft.config.Config.load(config_path) + self.assertEqual(config_obj.jobs["build"][0].plugin, "conda-build") + pm = get_plugin_manager(config_obj.jobs["build"][0]) + plugins = pm.get_plugins() + plugin_match = [ + _ for _ in plugins if _.__class__.__name__ == "CondaBuildPlugin" + ] + self.assertEqual("custominfo/recipe", plugin_match[0].build_target) + def test_conda_build_plugin_finds_recipe_with_fake_parent(self): config = dedent( """ diff --git a/lpcraft/plugins/plugins.py b/lpcraft/plugins/plugins.py index 4dbad96..2df63ba 100644 --- a/lpcraft/plugins/plugins.py +++ b/lpcraft/plugins/plugins.py @@ -264,12 +264,22 @@ class CondaBuildPlugin(MiniCondaPlugin): conda_channels: Optional[List[StrictStr]] conda_packages: Optional[List[StrictStr]] conda_python: Optional[StrictStr] + recipe_folder: Optional[StrictStr] DEFAULT_CONDA_PACKAGES = ("conda-build",) + DEFAULT_RECIPE_FOLDER = "./info" def get_plugin_config(self) -> "CondaBuildPlugin.Config": return cast(CondaBuildPlugin.Config, self.config.plugin_config) + @property + def recipe_folder(self) -> str: + recipe_folder = self.DEFAULT_RECIPE_FOLDER + plugin_config = self.get_plugin_config() + if plugin_config.recipe_folder: + recipe_folder = plugin_config.recipe_folder + return recipe_folder + @staticmethod def _has_recipe(dir_: Path) -> bool: return dir_.joinpath("meta.yaml").is_file() @@ -281,7 +291,7 @@ class CondaBuildPlugin(MiniCondaPlugin): # the templated recipe, at `meta.yaml.template`, but place the # rendered template at `meta.yaml`. The rendered recipes contain # hardcoded paths for a specific build environment and, for our - # purposes, are not reusable. We need to render new ones from the + # purposes, are not reusable. We need to render new ones from the f # original templates. template_path = dir_.joinpath("meta.yaml.template") if template_path.is_file(): @@ -300,7 +310,7 @@ class CondaBuildPlugin(MiniCondaPlugin): continue raise FileNotFoundError - return _find_recipe_dir(Path(".")) + return _find_recipe_dir(Path(self.recipe_folder)) def find_build_target(self) -> str: def find_parents(pth: Path) -> Path: diff --git a/mini.launchpad.yaml b/mini.launchpad.yaml new file mode 100644 index 0000000..5268fb9 --- /dev/null +++ b/mini.launchpad.yaml @@ -0,0 +1,23 @@ +pipeline: + - myjob + +# jobs: +# test: +# series: focal +# architectures: amd64 +# packages: [git] +# plugin: tox +# run: "echo config" + + +jobs: + myjob: + series: focal + architectures: amd64 + plugin: miniconda + - pip + conda-python: 3.8 + run: | + conda install tox + pip install --upgrade pytest + python -m build . diff --git a/old.launchpad.yaml b/old.launchpad.yaml new file mode 100644 index 0000000..1f1397b --- /dev/null +++ b/old.launchpad.yaml @@ -0,0 +1,16 @@ +pipeline: + - test + - build + +jobs: + test: + series: focal + architectures: amd64 + packages: [git] + plugin: tox + build: + series: focal + architectures: amd64 + plugin: pyproject-build + output: + paths: ["dist/*.whl"] diff --git a/older.launchpad.yaml b/older.launchpad.yaml new file mode 100644 index 0000000..b7b0dd7 --- /dev/null +++ b/older.launchpad.yaml @@ -0,0 +1,16 @@ +pipeline: + - myjob + +jobs: + myjob: + plugin: miniconda + series: focal + architectures: amd64 + conda-packages: + - numpy=1.17 + - scipy + - pip + conda-python: 3.8 + run: | + pip install --upgrade pytest + python -c "print('hello world')" diff --git a/orig.launchpad.yaml b/orig.launchpad.yaml new file mode 100644 index 0000000..d3ffd7e --- /dev/null +++ b/orig.launchpad.yaml @@ -0,0 +1,18 @@ +pipeline: + - test + - build + +jobs: + test: + series: focal + architectures: amd64 + packages: [git] + plugin: tox + build: + series: focal + architectures: amd64 + plugin: pyproject-build + output: + paths: + - "dist/*.tar.gz" + - "dist/*.whl" diff --git a/trusted.launchpad.yaml b/trusted.launchpad.yaml new file mode 100644 index 0000000..1e6bc1a --- /dev/null +++ b/trusted.launchpad.yaml @@ -0,0 +1,16 @@ +pipeline: + - test + +jobs: + test: + series: focal + architectures: amd64 + packages: [git, golang-1.17] + run: go version + package-repositories: + - type: apt + formats: [deb, deb-src] + components: [main] + suites: [focal] + url: "https://{{soss_read_auth}}@canonical.jfrog.io/artifactory/jammy-golang-backport" + trusted: true
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp