Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use build profile in build hash #1425

Merged
merged 6 commits into from
Aug 21, 2023
Merged

Conversation

mosteo
Copy link
Member

@mosteo mosteo commented Aug 6, 2023

This would be the first realistic albeit incomplete step towards the shared builds. This adds the actual computation of the hash, but for the moment relying only on the build profile, so we can discuss any changes before adding the remaining factors.

To have some traceability, the inputs to the hash function are stored in cache/builds/<crate>/alire/build_hash_inputs and so it also can be used in tests to verify the hash computation.

Rooted in that default build profiles were used first and later the actual
profiles caused different folders to be used, in turn causing errors with the
conflicting CRATE_ALIRE_PREFIX variables.
@mosteo mosteo marked this pull request as ready for review August 6, 2023 12:42
Trace.Debug (" build hashing: " & Rel.Milestone.TTY_Image);

-- Build profile
Add ("profile",
Copy link
Member

Choose a reason for hiding this comment

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

In the end we my not have "build_profile" in the hash since there is a separate object dir depending on the profile, at least in Alire generated gpr files.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, I'm going to merge it as is for now, as it is trivial to remove later on.

@mosteo mosteo merged commit 7b9b4ca into alire-project:master Aug 21, 2023
12 checks passed
@mosteo mosteo deleted the feat/hash-profile branch August 21, 2023 14:12
mosteo added a commit to mosteo/alire that referenced this pull request Aug 21, 2023
* Debug when folder deletion fails

* Trivial safeguard in `Force_Delete` (alire-project#1422)

* Refactor Alire.Shared into Alire.Toolchains (alire-project#1423)

* Use build profile in build hash (alire-project#1425)

* Compute hash using build profile

* Fix problem with multiple hashes in one run

Rooted in that default build profiles were used first and later the actual
profiles caused different folders to be used, in turn causing errors with the
conflicting CRATE_ALIRE_PREFIX variables.

* Write hash inputs to build dirs

* Testsuite additions and fixes

* Self-review

* Update pins and dependencies

* MacOS; export PATH variables for includes and libraries. (alire-project#1420)

* MacOS; export PATH variables for includes and libraries.

Homebrew and MacPorts install include files and libraries in places
where GCC won't look by default.

GCC will use these environment variables if set:

   C_INCLUDE_PATH     for C includes
   CPLUS_INCLUDE_PATH for C++ includes
   LIBRARY_PATH       for libraries

Both of the distribution managers place (symbolic links to) include
files in ${top_level}/include and libraries in ${top_level}/lib.

   For Homebrew on Intel silicon, top_level is normally /usr/local.
   For Homebrew on Apple silicon, top_level is normally /opt/homebrew.
   For MacPorts,                  top_level is normally /opt/local

  * src/alire/alire-platforms-current.ads (Load_Environment): add note
      on macOS use.
  * src/alire/os_macos/alire-platforms-current__macos.adb
    (context): added Alire.Environment (was limited), Ada.Directories.
    (Brew_Access): new.
    (Homebrew_Present): if Brew_Access is not null.
    (Detected_Distribution): made into an expression function.
    (Containing_Containing_Dir): new, used in Distribution_Root.
    (Distribution_Root): reworked.
    (Load_Environment): if either distribution is present, arrange to
      export the environment variables to suit.

* Update testsuite to match new macOS distribution detection.

  * testsuite/drivers/helpers.py (distribution): if on macOS, check whether
      the distribution management tool is on the PATH. We used to check for
      the environment variable HOMEBREW_PREFIX, but users don't have to
      arrange for this to be set in order to run Homebrew.

      First, if 'brew' is found, the distribution is Homebrew.
      If not and 'port' is found, the distribution is MacPorts.
      Otherwise, the distribution is unknown.

* In the macOS CI workflow, run the test script once only.

  * .github/workflows/ci-macos.yml (Run test script): remove the second
      call, which set up HOMEBREW_PREFIX (now no longer used by alr),
      and remove the note '(without Homebrew)' in the first.

* Add Windows alternatives

* More comprehensive Windows switches

* Don't raise on deletion failure

---------

Co-authored-by: Simon Wright <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants