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

Add option to brew unbottled to track bottles removed #16016

Closed
1 task done
fxcoudert opened this issue Sep 20, 2023 · 6 comments · Fixed by #16115
Closed
1 task done

Add option to brew unbottled to track bottles removed #16016

fxcoudert opened this issue Sep 20, 2023 · 6 comments · Fixed by #16115
Assignees
Labels
features New features in progress Maintainers are working on this outdated PR was locked due to age

Comments

@fxcoudert
Copy link
Member

Verification

Provide a detailed description of the proposed feature

When we bottle for a new macOS version, before we turn it on for CI, we regularly loose bottles: a PR is merged for a new version, and the new macOS bottles are not included. We have to dispatch a new set of bottles.

brew unbottled --lost --tag 14-arm64 would give the list of bottles that were at some point present for that specific tag, but have been removed since. I have a script for doing that right now, and it is very convenient (but not perfect).

What is the motivation for the feature?

When we bottle for a new macOS version, before we turn it on for CI, we regularly loose bottles: a PR is merged for a new version, and the new macOS bottles are not included. We have to dispatch a new set of bottles.

How will the feature be relevant to at least 90% of Homebrew users?

It would help maintainers in the process of bottling for a new macOS version, which happens every year and benefits everyone :)

What alternatives to the feature have been considered?

My old script, but it's not perfect and others could benefit from a solution implemented in brew.

@fxcoudert fxcoudert added the features New features label Sep 20, 2023
@fxcoudert
Copy link
Member Author

fxcoudert commented Sep 20, 2023

Script that I have currently does the following:

  • go back in time through the git history
  • for each commit, identify the files that have been modified
  • check for each file, whether the Sonoma bottle was removed by the commit
  • if it was removed, check if it is present in the latest version
    • if so, output “formula: bottle restored”
    • if not, output (in red): “formula: bottle lost”
  • then continue to the parent commit

My script:

#!/bin/bash

RED="\033[0;31m"
NC="\033[0m"

c="@"
while true ; do
  if ( git show -m "$c" | grep -q '^- *sha256.*sonoma' ) ; then
    for file in `git show -m "$c" | grep '^diff ' | sed -e 's/.*\/Formula\///'` ; do
      form=`echo $file | sed -e 's/\.rb//' -e 's/.*\///'`

      if ( git show -m "$c" -- $file | grep -q '^- *sha256.*sonoma' ) ; then
	if ( grep -q 'sha256.*sonoma' $file ) ; then
	  echo "$form: bottle restored (removed in commit $c)"
	else
	  echo -e "$form: ${RED}bottle lost${NC}"
	fi
      fi
    done
  fi

  c=`git show "$c" | head -n 1 | sed -e 's/^commit //'`
  c="${c}^"
done

This implementation in shell and git commands is not perfect: because of our use of merge commits, it displays several times the same lost bottle. It is a minor annoyance.

@MikeMcQuaid MikeMcQuaid added the help wanted We want help addressing this label Sep 21, 2023
@MikeMcQuaid
Copy link
Member

Thanks @fxcoudert makes sense and would be good to add.

@apainintheneck
Copy link
Contributor

It seems like we could probably just use something like git log -p -G'sha256.*sonoma' to get the diffs for each commit that changes those bottles and then parse the output to see which bottles just got lost. The only thing is that this approach doesn't scale beyond maybe a few months because at that point the git log query gets really slow for core.

Would it be acceptable for this to only check back a month or two in time?

@MikeMcQuaid
Copy link
Member

It seems like we could probably just use something like git log -p -G'sha256.*sonoma' to get the diffs for each commit that changes those bottles and then parse the output to see which bottles just got lost. The only thing is that this approach doesn't scale beyond maybe a few months because at that point the git log query gets really slow for core.

Would it be acceptable for this to only check back a month or two in time?

Yup, I think that seems very reasonable!

@Bo98
Copy link
Member

Bo98 commented Oct 15, 2023

Would it be acceptable for this to only check back a month or two in time?

Honestly probably only a few days really. If it's any more than say a week then that probably means we've had to pause bottling for some reason and might as well go with the regular brew unbottled view when resuming at that point.

@apainintheneck apainintheneck added in progress Maintainers are working on this and removed help wanted We want help addressing this labels Oct 15, 2023
@apainintheneck apainintheneck self-assigned this Oct 15, 2023
@apainintheneck
Copy link
Contributor

Would it be acceptable for this to only check back a month or two in time?

Honestly probably only a few days really. If it's any more than say a week then that probably means we've had to pause bottling for some reason and might as well go with the regular brew unbottled view when resuming at that point.

Okay, I'll only have it look at the last week's worth of commits.

@github-actions github-actions bot added the outdated PR was locked due to age label Nov 18, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
features New features in progress Maintainers are working on this outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants