Skip to content

patchpkg: start moving glibc-patch.bash to Go #2237

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

Merged
merged 1 commit into from
Aug 29, 2024
Merged

Conversation

gcurtis
Copy link
Collaborator

@gcurtis gcurtis commented Aug 29, 2024

Start porting the glibc patching script (which has expanded to patching other libraries too) over to Go.

To make this change more incremental, this commit only ports copying the original package's files to the patched package (basically the cp command). Devbox still runs the embedded bash script until the rest of it is ported.

The general patching steps are:

  • When generating the glibc-patch.nix flake, Devbox gets the absolute path to itself and adds it as a flake input. This makes devbox available in the flake's build.
  • Instead of running glibc-patch.bash as the flake's builder, run devbox patch <pkg>.

Start porting the glibc patching script (which has expanded to patching
other libraries too) over to Go.

To make this change more incremental, this commit only ports copying the
original package's files to the patched package (basically the `cp`
command). Devbox still runs the embedded bash script until the rest of
it is ported.

The general patching steps are:

- When generating the glibc-patch.nix flake, Devbox gets the absolute
  path to itself and adds it as a flake input. This makes devbox
  available in the flake's build.
- Instead of running `glibc-patch.bash` as the flake's builder, run
  `devbox patch <pkg>`.
@gcurtis gcurtis requested review from mikeland73 and savil August 29, 2024 15:36
Copy link
Collaborator

@savil savil left a comment

Choose a reason for hiding this comment

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

This is neat

@@ -0,0 +1,156 @@
// patchpkg patches packages to fix common linker errors.
Copy link
Collaborator

Choose a reason for hiding this comment

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

ooh new tongue twister spotted:

how many packages would a patchpkg patch if a patchpkg could patch packages? a patchpkg would patch as many packages as a patchpkg would if a patchpkg could patch packages

return func(yield func(string, fs.DirEntry) bool) {
_ = fs.WalkDir(fsys, root, func(path string, d fs.DirEntry, err error) error {
if err == nil {
if !yield(path, d) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this yield business doing here! Don't besmirch my Small Is Beautiful language

j/k

@gcurtis gcurtis merged commit 8c30551 into main Aug 29, 2024
24 checks passed
@gcurtis gcurtis deleted the gcurtis/patchpkg branch August 29, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants