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

[enh] add xz decompression for sources #1785

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

grosmanal
Copy link

The problem

Forgejo application is a single executable file. It is released compressed in xz format (https://codeberg.org/forgejo/forgejo/releases)
Yunohost does not allow to extract such archives with ynh_setup_source helper. The extraction has to be done in install script.
Since Yunohost supports tar.xz format (and many others), it should supports xz format as well.

Solution

Update ynh_setup_source helper to introduce the xz format.

PR Status

Ready to test

How to test

  • get forgejo package source (https://github.com/YunoHost-Apps/forgejo_ynh)
  • remove format and extract configuration from [resources.sources.main]
  • set rename configuration to «forgejo» in [resources.sources.main]
  • remove extraction line in scripts/install (xz -d "$install_dir/forgejo.xz")
  • install the app

@zamentur
Copy link
Member

zamentur commented Feb 28, 2024

tar.xz is already supported but not xz alone, should we add gzip and bzip2 (without tar) too ?

@zamentur
Copy link
Member

Documentation should be change too:
https://github.com/YunoHost/yunohost/blob/dev/src/utils/resources.py#L318

@grosmanal
Copy link
Author

grosmanal commented Feb 28, 2024

tar.xz is already supported but not xz alone, should we add gzip and bzip2 (without tar) too ?

I can add it too. It seems a good idea for Yunohost to supports theses formats.

@grosmanal grosmanal marked this pull request as draft February 28, 2024 18:09
@grosmanal
Copy link
Author

I'll make a PR for documentation soon (I hope 😄 )

@grosmanal grosmanal marked this pull request as ready for review March 13, 2024 12:01
@grosmanal
Copy link
Author

Alongside xz / gz / bz2 extraction, I propose in this PR to rename the extracted file automaticaly (if rename is not set) to :

  • the app name if it's the main source
  • the source name otherwise

What do you think about this ?

@alexAubin
Copy link
Member

@grosmanal : it's pretty much already what it does (except that "main" is kept to "main"), because unless you use the rename option of the resource, the assumption is that you don't care what the name is because it's gonna be extracted automagically anyway in 99% of cases

Comment on lines +338 to +339
if [[ "$source_id" == "main" ]]; then
local src_rename=$app
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused by this because this will lead to inconsistent behavior between this case and other case (where the main source is just kept as "main" and not "$app") x_X ... What's the rationale for this ?

Copy link
Author

Choose a reason for hiding this comment

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

The goal is to allow the omission of rename in resource definition. (I just remember, writing this line, I've mentioned to set rename in the «how to test» section of this PR 🥴)

In the the forgejo app case, I thought it was logical to extract the archive to the same name as the application one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants