Skip to content

Move builders into builtin repo#50452

Merged
tgamblin merged 47 commits intodevelopfrom
hs/fix/builders-in-repo
May 19, 2025
Merged

Move builders into builtin repo#50452
tgamblin merged 47 commits intodevelopfrom
hs/fix/builders-in-repo

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented May 13, 2025

Builders and package classes refer to packages from the builtin package repo and are often modified together with packages. That means that these classes should move into spack_repo.builtin.

  • move spack.build_systems -> spack_repo.builtin.build_systems
  • Remove the following re-exports from the spack.package module: AspellDictPackage, AutotoolsPackage, BundlePackage, CachedCMakePackage, cmake_cache_filepath, cmake_cache_option, cmake_cache_path, cmake_cache_string, CargoPackage, CMakePackage, generator, CompilerPackage, CudaPackage, Package, GNUMirrorPackage, GoPackage, IntelPackage, IntelOneApiLibraryPackageWithSdk, IntelOneApiLibraryPackage, IntelOneApiStaticLibraryList, IntelOneApiPackage, INTEL_MATH_LIBRARIES, LuaPackage, MakefilePackage, MavenPackage, MesonPackage, MSBuildPackage, NMakePackage, OctavePackage, PerlPackage, PythonExtension, PythonPackage, QMakePackage, RacketPackage, RPackage, ROCmPackage, RubyPackage, SConsPackage, SIPPackage, SourceforgePackage, SourcewarePackage, WafPackage, XorgPackage.
  • update mock packages to repo v2.0 and add copies of packages/build systems they use from builtin
  • add missing imports to build systems in package.py from builtin and test repos
  • update various tests

This PR is breaking because of removal of various names from spack.package, but breakage should be minimal thanks to #50496, which ensures the above names are always imported in repo v1 packages.

Specifically this PR breaks imports like the following in package.py files:

from spack.package import Package

but if your repo is v1.0 (see spack repo list) and has the following much more common pattern

from spack.package import *

nothing should break.

@spackbot-app spackbot-app bot added build-environment build-systems conflicts core PR affects Spack core functionality dependencies extends headers libraries new-variant stand-alone-tests Stand-alone (or smoke) tests for installed packages tests General test capability(ies) labels May 13, 2025
@haampie haampie force-pushed the hs/fix/builders-in-repo branch 14 times, most recently from ccf7922 to 72ba5ad Compare May 16, 2025 17:53
@spackbot-app spackbot-app bot added commands documentation Improvements or additions to documentation environments intel update-package labels May 16, 2025
@haampie haampie force-pushed the hs/fix/builders-in-repo branch from 4ffd39f to 8f7f837 Compare May 17, 2025 08:04
@haampie haampie added the pipelines:urgent Skip "deferred pipelines" check. Only use if rebasing on a tested develop commit is unfeasible label May 17, 2025
tgamblin
tgamblin previously approved these changes May 17, 2025
Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this commit by commit on the CLI. The changes are mostly mechanical (via spack repo migrate with additions to fix coupling between core and packages, mostly to handle name changes in tests.

Follow-ons:

  • Should remove the now-unused spack.paths.build_systems_path

  • (for me) Should add some proper fix for the windows grep issue (see #50520)

  • Not clear to me why we use relative imports in builtin and absolute in builtin_mock

  • This one might be more significant:

    It's not clear to me that v1 packages that import other packages are handled by spack repo migrate -- are they? This type of stuff looks like it was a manual change needed after migration to v2:

    -from ..cmake_client import CmakeClient
    +from ..cmake_client.package import CmakeClient

In a follow-on we should modify spack repo migrate to do this.

Otherwise looks good to me.

@tgamblin tgamblin enabled auto-merge (squash) May 17, 2025 09:43
@haampie
Copy link
Copy Markdown
Member Author

haampie commented May 17, 2025

* Not clear to me why we use relative imports in `builtin` and absolute in `builtin_mock`

Because some test repos have symlinks to packages from from builtin_mock, which makes ...build_systems.foo incorrect.

Edit: they are all absolute now.

* This one might be more significant:
  It's not clear to me that v1 packages that import other packages are handled by `spack repo migrate` -- are they? This type of stuff looks like it was a manual change needed after migration to v2:
  ```python
  -from ..cmake_client import CmakeClient
  +from ..cmake_client.package import CmakeClient
  ```

Correct, that isn't handled.

tgamblin
tgamblin previously approved these changes May 17, 2025
@haampie haampie dismissed tgamblin’s stale review May 17, 2025 10:43

use absolute imports for build_systems to make copy/paste of recipes easier.

@haampie haampie disabled auto-merge May 17, 2025 10:44
@haampie
Copy link
Copy Markdown
Member Author

haampie commented May 18, 2025

@spackbot run pipeline

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented May 18, 2025

I've started that pipeline for you!

@tgamblin tgamblin enabled auto-merge (squash) May 19, 2025 03:06
@tgamblin tgamblin disabled auto-merge May 19, 2025 03:30
@tgamblin tgamblin merged commit 2929ea0 into develop May 19, 2025
45 of 48 checks passed
@tgamblin tgamblin deleted the hs/fix/builders-in-repo branch May 19, 2025 03:31
@tgamblin
Copy link
Copy Markdown
Member

Merged because pipeline failures onml-aarch64-cpu are unrelated to this PR.

jezwilkinson pushed a commit to jezwilkinson/spack that referenced this pull request May 20, 2025
Builders and package classes refer to packages from the builtin package
repo and are often modified together with packages. That means that
these classes should move into `spack_repo.builtin`.

* move `spack.build_systems` -> `spack_repo.builtin.build_systems`

* Remove the following re-exports from the `spack.package` module:
  - `AspellDictPackage`                 - `LuaPackage`
  - `AutotoolsPackage`                  - `MakefilePackage`
  - `BundlePackage`                     - `MavenPackage`
  - `CachedCMakePackage`                - `MesonPackage`
  - `cmake_cache_filepath`              - `MSBuildPackage`
  - `cmake_cache_option`                - `NMakePackage`
  - `cmake_cache_path`                  - `OctavePackage`
  - `cmake_cache_string`                - `PerlPackage`
  - `CargoPackage`                      - `PythonExtension`
  - `CMakePackage`                      - `PythonPackage`
  - `generator`                         - `QMakePackage`
  - `CompilerPackage`                   - `RacketPackage`
  - `CudaPackage`                       - `RPackage`
  - `Package`                           - `ROCmPackage`
  - `GNUMirrorPackage`                  - `RubyPackage`
  - `GoPackage`                         - `SConsPackage`
  - `IntelPackage`                      - `SIPPackage`
  - `IntelOneApiLibraryPackageWithSdk`  - `SourceforgePackage`
  - `IntelOneApiLibraryPackage`         - `SourcewarePackage`
  - `IntelOneApiStaticLibraryList`      - `WafPackage`
  - `IntelOneApiPackage`                - `XorgPackage`
  - `INTEL_MATH_LIBRARIES`

* update mock packages to repo v2.0 and add copies of packages/build
  systems they use from builtin

* add missing imports to build systems in `package.py` from builtin
  and test repos

* update various tests

This PR is breaking because of removal of various names from
 `spack.package`, but breakage should be minimal thanks to spack#50496, which
 ensures the above names are always imported in repo v1 packages.

Specifically this PR breaks imports like the following in `package.py` files:

```python
from spack.package import Package
```

but if your repo is v1.0 (see `spack repo list`) and has the following
much more common pattern:

```python
from spack.package import *
```

nothing should break.
tgamblin added a commit that referenced this pull request May 21, 2025
Since #50452, build systems are no longer in core and need their own imports.

Specifically, in addition to:

```python
from spack.package import *
```

you now also need, e.g.:

```python
from spack_repo.builtin.build_systems.python import PythonPackage
```

Or similar for other build systems, or things will break.

- [x] Fix `py-deprecat` package
- [x] Fix `cryoef` package

Signed-off-by: Todd Gamblin <[email protected]>
tgamblin added a commit that referenced this pull request May 21, 2025
Since #50452, build systems are no longer in core and need their own imports.

Specifically, in addition to:

```python
from spack.package import *
```

you now also need, e.g.:

```python
from spack_repo.builtin.build_systems.python import PythonPackage
```

Or similar for other build systems, or things will break.

- [x] Fix `py-deprecat` package
- [x] Fix `cryoef` package

Signed-off-by: Todd Gamblin <[email protected]>
tgamblin added a commit that referenced this pull request May 21, 2025
Since #50452, build systems are no longer in core and need their own imports.

Specifically, in addition to:

```python
from spack.package import *
```

you now also need, e.g.:

```python
from spack_repo.builtin.build_systems.python import PythonPackage
```

Or similar for other build systems, or things will break.

- [x] Fix `py-deprecat` package
- [x] Fix `cryoef` package

Signed-off-by: Todd Gamblin <[email protected]>
kshea21 pushed a commit to kshea21/spack that referenced this pull request May 21, 2025
Since spack#50452, build systems are no longer in core and need their own imports.

Specifically, in addition to:

```python
from spack.package import *
```

you now also need, e.g.:

```python
from spack_repo.builtin.build_systems.python import PythonPackage
```

Or similar for other build systems, or things will break.

- [x] Fix `py-deprecat` package
- [x] Fix `cryoef` package

Signed-off-by: Todd Gamblin <[email protected]>
abhishek1297 pushed a commit to abhishek1297/spack-melissa that referenced this pull request May 22, 2025
Builders and package classes refer to packages from the builtin package
repo and are often modified together with packages. That means that
these classes should move into `spack_repo.builtin`.

* move `spack.build_systems` -> `spack_repo.builtin.build_systems`

* Remove the following re-exports from the `spack.package` module:
  - `AspellDictPackage`                 - `LuaPackage`
  - `AutotoolsPackage`                  - `MakefilePackage`
  - `BundlePackage`                     - `MavenPackage`
  - `CachedCMakePackage`                - `MesonPackage`
  - `cmake_cache_filepath`              - `MSBuildPackage`
  - `cmake_cache_option`                - `NMakePackage`
  - `cmake_cache_path`                  - `OctavePackage`
  - `cmake_cache_string`                - `PerlPackage`
  - `CargoPackage`                      - `PythonExtension`
  - `CMakePackage`                      - `PythonPackage`
  - `generator`                         - `QMakePackage`
  - `CompilerPackage`                   - `RacketPackage`
  - `CudaPackage`                       - `RPackage`
  - `Package`                           - `ROCmPackage`
  - `GNUMirrorPackage`                  - `RubyPackage`
  - `GoPackage`                         - `SConsPackage`
  - `IntelPackage`                      - `SIPPackage`
  - `IntelOneApiLibraryPackageWithSdk`  - `SourceforgePackage`
  - `IntelOneApiLibraryPackage`         - `SourcewarePackage`
  - `IntelOneApiStaticLibraryList`      - `WafPackage`
  - `IntelOneApiPackage`                - `XorgPackage`
  - `INTEL_MATH_LIBRARIES`

* update mock packages to repo v2.0 and add copies of packages/build
  systems they use from builtin

* add missing imports to build systems in `package.py` from builtin
  and test repos

* update various tests

This PR is breaking because of removal of various names from
 `spack.package`, but breakage should be minimal thanks to spack#50496, which
 ensures the above names are always imported in repo v1 packages.

Specifically this PR breaks imports like the following in `package.py` files:

```python
from spack.package import Package
```

but if your repo is v1.0 (see `spack repo list`) and has the following
much more common pattern:

```python
from spack.package import *
```

nothing should break.
abhishek1297 pushed a commit to abhishek1297/spack-melissa that referenced this pull request May 22, 2025
Since spack#50452, build systems are no longer in core and need their own imports.

Specifically, in addition to:

```python
from spack.package import *
```

you now also need, e.g.:

```python
from spack_repo.builtin.build_systems.python import PythonPackage
```

Or similar for other build systems, or things will break.

- [x] Fix `py-deprecat` package
- [x] Fix `cryoef` package

Signed-off-by: Todd Gamblin <[email protected]>
kshea21 pushed a commit to kshea21/spack that referenced this pull request May 22, 2025
Builders and package classes refer to packages from the builtin package
repo and are often modified together with packages. That means that
these classes should move into `spack_repo.builtin`.

* move `spack.build_systems` -> `spack_repo.builtin.build_systems`

* Remove the following re-exports from the `spack.package` module:
  - `AspellDictPackage`                 - `LuaPackage`
  - `AutotoolsPackage`                  - `MakefilePackage`
  - `BundlePackage`                     - `MavenPackage`
  - `CachedCMakePackage`                - `MesonPackage`
  - `cmake_cache_filepath`              - `MSBuildPackage`
  - `cmake_cache_option`                - `NMakePackage`
  - `cmake_cache_path`                  - `OctavePackage`
  - `cmake_cache_string`                - `PerlPackage`
  - `CargoPackage`                      - `PythonExtension`
  - `CMakePackage`                      - `PythonPackage`
  - `generator`                         - `QMakePackage`
  - `CompilerPackage`                   - `RacketPackage`
  - `CudaPackage`                       - `RPackage`
  - `Package`                           - `ROCmPackage`
  - `GNUMirrorPackage`                  - `RubyPackage`
  - `GoPackage`                         - `SConsPackage`
  - `IntelPackage`                      - `SIPPackage`
  - `IntelOneApiLibraryPackageWithSdk`  - `SourceforgePackage`
  - `IntelOneApiLibraryPackage`         - `SourcewarePackage`
  - `IntelOneApiStaticLibraryList`      - `WafPackage`
  - `IntelOneApiPackage`                - `XorgPackage`
  - `INTEL_MATH_LIBRARIES`

* update mock packages to repo v2.0 and add copies of packages/build
  systems they use from builtin

* add missing imports to build systems in `package.py` from builtin
  and test repos

* update various tests

This PR is breaking because of removal of various names from
 `spack.package`, but breakage should be minimal thanks to spack#50496, which
 ensures the above names are always imported in repo v1 packages.

Specifically this PR breaks imports like the following in `package.py` files:

```python
from spack.package import Package
```

but if your repo is v1.0 (see `spack repo list`) and has the following
much more common pattern:

```python
from spack.package import *
```

nothing should break.
kshea21 pushed a commit to kshea21/spack that referenced this pull request May 22, 2025
Since spack#50452, build systems are no longer in core and need their own imports.

Specifically, in addition to:

```python
from spack.package import *
```

you now also need, e.g.:

```python
from spack_repo.builtin.build_systems.python import PythonPackage
```

Or similar for other build systems, or things will break.

- [x] Fix `py-deprecat` package
- [x] Fix `cryoef` package

Signed-off-by: Todd Gamblin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change build-environment build-systems commands conflicts core PR affects Spack core functionality dependencies documentation Improvements or additions to documentation environments extends headers intel libraries new-variant pipelines:urgent Skip "deferred pipelines" check. Only use if rebasing on a tested develop commit is unfeasible stand-alone-tests Stand-alone (or smoke) tests for installed packages tests General test capability(ies) update-package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants