-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Adding self-extracting file as an optional feature #31
base: main
Are you sure you want to change the base?
Conversation
One of the biggest use-cases for us for pixi-pack is the ability to build up archives on Linux for foreign targets, like Windows and to extract it there. Having a self-extracting archive there would be probably the most useful scenario. Your prepended shell script will only work for Unix systems, right? Also after taking a (brief) look it appears that the extraction script is expecting a existing conda or micromamba executable on PATH. I think in these scenarios it's already an attractive option to manually extract the archive and create the environment using the included lockfiles. I think it would be very useful, if we could prepend a standalone extraction tool, that does not require any system tools to be available on the system. |
@0xbe7a Also, in regards to the extraction tool used in the script, fair enough. |
The part that involves extracting and linking the packages is highly non-trivial and probably not really feasible with a bash script. Instead, we should try using Additionally, upon reviewing your pull request again, please note that |
Sounds good. Also, in regards to the |
Apologies for the delay. Got busy with school work. |
I think it would be better for reproducibility if we always unpack the same way, i.e. always use |
Could you fix the merge conflicts as well? |
Done. |
Added the tests from |
Fixed the merge conflict. |
As I mentioned above, the issue here is with the lockfile conflicts and incorrect dependencies between |
@pavelzw I have added a |
@pavelzw Any update on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This already looks very good @prsabahrami! Keep up the good work :)
Some minor comments
@@ -17,6 +17,7 @@ repos: | |||
types: [text] | |||
- id: end-of-file-fixer | |||
name: end-of-file-fixer | |||
exclude: src/header.(sh|ps1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could add shellcheck as an additional pre-commit hook 🤔
-q, --quiet Decrease logging verbosity | ||
" | ||
# Parse command-line options | ||
while getopts ":hfvo:s:q" opt; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getopts is not available everywhere. for example: docker run --rm -it ubuntu which getopts
has exit code 1
wondering whether there is a nice alternative for this or whether we would need to implement this ourselves
;; | ||
esac | ||
done | ||
shift $((OPTIND -1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this do? (ideally also write a comment 😅)
|
||
Unpacks an environment packed using pixi-pack | ||
|
||
-f, --force No error if environment already exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comments in header.sh
|
||
# Step 1: Extract the archive and pixi-pack executable, and decode them | ||
$scriptContent = Get-Content -Raw -Path $MyInvocation.MyCommand.Path | ||
$lines = $scriptContent -split "`r?`n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this \r\n
? 😅
} | ||
|
||
if (-not $headerLine -or -not $archiveLine) { | ||
Write-Error "Markers __END_HEADER__ or __END_ARCHIVE__ not found." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think we have a similar test in header.sh
. do you think we can add it there as well?
$archivePath = "$TEMPDIR\archive.tar" | ||
[System.IO.File]::WriteAllBytes($archivePath, $decodedArchive) | ||
} catch { | ||
Write-Error "Failed to decode Base64 archive content: $_" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does $_
do?
# Finally, add the path to the archive | ||
$arguments += $archivePath | ||
|
||
& $pixiPackPath @arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is &
the powershell equivalent of exec
?
Co-authored-by: Pavel Zwerschke <[email protected]>
Co-authored-by: Pavel Zwerschke <[email protected]>
Co-authored-by: Pavel Zwerschke <[email protected]>
Co-authored-by: Pavel Zwerschke <[email protected]>
Co-authored-by: Pavel Zwerschke <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we added tests for reproducible pixi-packs in #43
pixi-pack/tests/integration_test.rs
Line 284 in c84abb8
async fn test_reproducible_shasum(options: Options) { |
could you extend that test with create_executable
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely.
I'll try to respond to all of the previous messages this weekend as well.
I have been extremely busy this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! No worries, take your time 😄
Motivation
Closes #4
Changes
Similar to
conda-constructor
, I have added a header.sh file. After the environment has been packed and archived, that archive is appended onto header.sh which later extracts it when it runs.Packing an environment
Unpacking an environment
either directly run the .sh file created
You can use below flags
or you can directly use
I will try to add better tests and error handling in the upcoming days. Meanwhile, let me know if you have any recommendations.