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

[Documentation] Explain how to add patches #2583

Closed
ShalokShalom opened this issue Jun 13, 2017 · 11 comments
Closed

[Documentation] Explain how to add patches #2583

ShalokShalom opened this issue Jun 13, 2017 · 11 comments
Labels
Documentation Flags an issue / PR for attention by the technical documentation team Type: Chore Issues for general code and infrastructure maintenance
Milestone

Comments

@ShalokShalom
Copy link

ShalokShalom commented Jun 13, 2017

See also: #2561 (comment)

@eeyun
Copy link
Contributor

eeyun commented Jun 20, 2017

Looks like my original comment didn't get submitted appropriately. Whoops!

We should likely expose that habitat supports build time patching like other software build systems and perhaps link to the core plans that are utilizing that kind of patching behavior.

I'd heartily suggest avoiding diving too deep into this because patching software will be completely dependent upon the type of software being built and those behaviors are not specific to habitat.

@ShalokShalom
Copy link
Author

Then i am a little bit curious, since i thought that i can simply reuse the patches of specific distributions in an easy way. So, this means easy patching like in PKGBUILDs will never be the case?

Regarding to the closed issue. How that? Isnt patching something very essential in packaging?

@reset
Copy link
Collaborator

reset commented Jun 21, 2017

@ShalokShalom sure, you can re-use patches from anyone including other distributions. What @eeyun is suggesting is that applying patches to software isn't a direct concern of Habitat itself but instead of the patch tool itself.

I don't mind if this makes it into some sort of "deep continued learning section" of our docs but we shouldn't try to recreate man pages for Patch itself ;)

@ShalokShalom
Copy link
Author

I really love to see a dedicated patch function in Habitat, which got refused in the past :P

Thanks, i will close this.

@ShalokShalom
Copy link
Author

ShalokShalom commented Jun 24, 2017

Here is a proposal:

  1. Add this patch options

_patch_files=(URL)
_patch_shasums=()

  1. Now add this additional code into the specific Callbacks:

To do_download()

 do_default_download

  for i in $(seq 0 $((${#_patch_files[@]} - 1))); do
    p="${_patch_files[$i]}"
    download_file $p $(basename $p) ${_patch_shasums[$i]}
  done; unset i p

To do_verify()

do_default_verify

  for i in $(seq 0 $((${#_patch_files[@]} - 1))); do
    verify_file $(basename ${_patch_files[$i]}) ${_patch_shasums[$i]}
  done; unset i

And to do_prepare()

do_default_prepare

  for p in "${_patch_files[@]}"; do
    build_line "Applying patch $(basename $p)"
    patch -p0 -i $HAB_CACHE_SRC_PATH/$(basename $p)
  done

@robbkidd
Copy link
Contributor

I reckon the docs could demonstrate at least the two patching patterns—patching with patches versioned with the plan and patching with patches retrieved from elsewhere at build time—shown in the plans linked to by @eeyun over on #2561 (😵 hard to follow all the issues opened about this).

@ShalokShalom
Copy link
Author

The proposal here is generic and lend by the bash version.

@robbkidd
Copy link
Contributor

Indeed. That is probably roughly what would get documented for an example of retrieving and applying patches at build time.

@stale
Copy link

stale bot commented Apr 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

@stale stale bot added the Stale label Apr 3, 2020
@christophermaier christophermaier added Type: Chore Issues for general code and infrastructure maintenance and removed C-chore labels Jul 24, 2020
@stale stale bot removed the Stale label Jul 24, 2020
@christophermaier christophermaier added Documentation Flags an issue / PR for attention by the technical documentation team and removed A-documentation labels Aug 18, 2020
@rahulgoel1 rahulgoel1 removed the E-easy label Jul 23, 2021
@stale
Copy link

stale bot commented Aug 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

@ShalokShalom
Copy link
Author

So far as I know, got Habitat proper patch support, a few months after this issue was raised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Flags an issue / PR for attention by the technical documentation team Type: Chore Issues for general code and infrastructure maintenance
Projects
None yet
Development

No branches or pull requests

7 participants