-
Notifications
You must be signed in to change notification settings - Fork 10
fix: add BSD tar fallback support for macOS #102
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,21 +103,35 @@ tasks: | |
| mkdir -p "{{.OUTPUT_DIR}}" | ||
| # Unlike for `tar --create`, in `--extract` both the exclude and include patterns can be | ||
| # quoted since they're both evaluated by `tar`. | ||
| - >- | ||
| {{.ARCHIVER}} | ||
| --extract | ||
| --strip-components="{{.NUM_COMPONENTS_TO_STRIP}}" | ||
| --directory "{{.OUTPUT_DIR}}" | ||
| --file "{{.TAR_FILE}}" | ||
| --no-anchored | ||
| --wildcards | ||
| - |- | ||
| ARCHIVER="{{.ARCHIVER}}" | ||
| # Fall back to 'tar' if the specified archiver doesn't exist (e.g., gtar on macOS) | ||
| USE_GNU_FLAGS=true | ||
| if ! command -v "$ARCHIVER" &> /dev/null; then | ||
| ARCHIVER="tar" | ||
| USE_GNU_FLAGS=false | ||
| fi | ||
|
|
||
| # Build tar command with conditional GNU-specific flags | ||
| TAR_CMD=("$ARCHIVER" --extract --strip-components="{{.NUM_COMPONENTS_TO_STRIP}}" --directory "{{.OUTPUT_DIR}}" --file "{{.TAR_FILE}}") | ||
|
|
||
| # Add GNU-specific flags only if using gtar | ||
| if [ "$USE_GNU_FLAGS" = true ]; then | ||
| TAR_CMD+=(--no-anchored --wildcards) | ||
| fi | ||
|
|
||
| # Add exclude patterns | ||
| {{- range .EXCLUDE_PATTERNS}} | ||
| --exclude="{{.}}" | ||
| TAR_CMD+=(--exclude="{{.}}") | ||
| {{- end}} | ||
|
|
||
| # Add include patterns | ||
| {{- range .INCLUDE_PATTERNS}} | ||
| "{{.}}" | ||
| TAR_CMD+=("{{.}}") | ||
| {{- end}} | ||
| 2> /dev/null | ||
|
|
||
| # Execute tar command | ||
| "${TAR_CMD[@]}" 2> /dev/null | ||
|
Comment on lines
+139
to
+140
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider whether suppressing all stderr is desirable. Redirecting 🤖 Prompt for AI Agents |
||
| # This command must be last | ||
| - task: "checksum:compute" | ||
| vars: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.