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

Post-link scripts in a noarch package are not properly included #5115

Open
kenodegard opened this issue Dec 14, 2023 · 6 comments
Open

Post-link scripts in a noarch package are not properly included #5115

kenodegard opened this issue Dec 14, 2023 · 6 comments
Labels
backlog issue has been triaged but has not been earmarked for any upcoming release severity::3 major; broken functionality with a workaround source::anaconda created by members of Anaconda, Inc. stale::recovered [bot] recovered after being marked as stale type::bug describes erroneous operation, use severity::* to classify the type

Comments

@kenodegard
Copy link
Contributor

kenodegard commented Dec 14, 2023

What happened?

When packaging a noarch package with post-link scripts only the post-link script cooresponding to the host machine is included in the output package and so in other words it isn't properly noarch.

The issue comes from how post-link (and pre-link and pre-unlink) scripts are detected:

def create_post_scripts(m: MetaData):
"""
Create scripts to run after build step
"""
ext = ".bat" if utils.on_win else ".sh"
for tp in "pre-link", "post-link", "pre-unlink":
# To have per-output link scripts they must be prefixed by the output name or be explicitly
# specified in the build section
is_output = "package:" not in m.get_recipe_text()
scriptname = tp
if is_output:
scriptname = m.get_value(f"build/{tp}", f"{m.name()}-{tp}")
scriptname += ext
dst_name = f".{m.name()}-{tp}{ext}"
src = join(m.path, scriptname)
if isfile(src):
dst_dir = join(
m.config.host_prefix,
"Scripts" if m.config.host_subdir.startswith("win-") else "bin",
)
if not isdir(dst_dir):
os.makedirs(dst_dir, 0o775)
dst = join(dst_dir, dst_name)
utils.copy_into(src, dst, m.config.timeout, locking=m.config.locking)
os.chmod(dst, 0o775)

Xref conda/conda#13389

@kenodegard kenodegard added type::bug describes erroneous operation, use severity::* to classify the type backlog issue has been triaged but has not been earmarked for any upcoming release source::anaconda created by members of Anaconda, Inc. severity::3 major; broken functionality with a workaround labels Dec 14, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning Dec 14, 2023
@kenodegard
Copy link
Contributor Author

pre-link, post-link, and pre-unlink are viewed as dangerous and legacy/deprecated, so we should look into removing it entirely

@kenodegard
Copy link
Contributor Author

conda-forge forbids post-links for noarch: https://conda-forge.org/docs/maintainer/knowledge_base.html#noarch-python

to work around this, packages will have a multi-output recipe where the package itself would be noarch but the post-links are an arch specific package: https://github.com/conda-forge/bladerf-feedstock/blob/7deba2ef18fd1a9ba69239c61f018f67c24eba97/recipe/meta.yaml#L93

@mfansler
Copy link

mfansler commented Jan 8, 2024

Oh wow. Having an extra output seems like overkill if I just want to emit a message to users (i.e., echo into $PREFIX/.messages.txt). Is there any alternative means of doing this then going forward?

xref: conda-forge/r-tinytex-feedstock#53

Right now, thinking I'm just going to drop it.

@mfansler
Copy link

mfansler commented Jan 8, 2024

Hmm...but checking the info/files manifest does show bin/.r-tinytex-post-link.sh and the file is there. Still, seeing crashes on something as simple as echo "my message" >> .messages.txt.

Copy link

github-actions bot commented Jan 8, 2025

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    - What OS and version you reproduced the issue on
    - What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!

@github-actions github-actions bot added the stale [bot] marked as stale due to inactivity label Jan 8, 2025
@beckermr
Copy link
Contributor

beckermr commented Jan 8, 2025

We cannot remove these kinds of scripts and so this issue should be kept open only if there is still a bug. Otherwise it should be closed.

@github-actions github-actions bot added stale::recovered [bot] recovered after being marked as stale and removed stale [bot] marked as stale due to inactivity labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog issue has been triaged but has not been earmarked for any upcoming release severity::3 major; broken functionality with a workaround source::anaconda created by members of Anaconda, Inc. stale::recovered [bot] recovered after being marked as stale type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants