Skip to content

json-generation: handle .tar.xz image archives#283

Merged
igorpecovnik merged 2 commits intoarmbian:mainfrom
OpenSource-YYT:fix/tar-xz-image-extensions
Apr 14, 2026
Merged

json-generation: handle .tar.xz image archives#283
igorpecovnik merged 2 commits intoarmbian:mainfrom
OpenSource-YYT:fix/tar-xz-image-extensions

Conversation

@SuperKali
Copy link
Copy Markdown
Member

Fixes part of #277 (generator-side).

Problem

Images shipped as .tar.xz (currently the Arduino UNO Q community builds — gnome_desktop, kde-neon_desktop, minimal) are mishandled in two places of scripts/generate-armbian-images-json.sh:

  1. extract_file_extension() has no branch for .tar.*, so it falls through to the generic ${n##*.} fallback and returns just "xz". Downstream consumers (notably armbian-router's loadMapJSON) only insert map entries whose extension ends with img.xz or a registered specialExtension, so these images are silently dropped from the redirect map and every redi_url pointing to them 404s via the mirror.
  2. strip_img_ext() only strips .img(.xz|.zst|.gz), so kernel-suffix parsing for tar-based filenames doesn't correctly strip the extension.

Fix (2 commits)

  • strip_img_ext: extend the regex to also match .tar.(xz|zst|gz).
  • extract_file_extension: add explicit branches returning tar.xz / tar.gz / tar.zst before the fallback.

With these, tar-based artifacts now produce sensible file_extension values and downstream tools can treat them as first-class images.

Companion PR

The router-side counterpart is in armbian/armbian-router#39 and must land together for the Arduino UNO Q redi_url entries to resolve correctly.

Related

/cc @igorpecovnik @efectn

Extend strip_img_ext so kernel-suffix parsing handles filenames using tar
archive extensions (e.g. Arduino UNO Q images shipped as .tar.xz),
matching the existing .img.(xz|zst|gz) behaviour.

Refs: armbian#277
Currently the function falls through to the generic "${n##*.}" fallback
for tar-based image archives, returning just "xz" (or "gz"/"zst") as the
file_extension. Downstream consumers — notably armbian-router's map
loader — only add entries whose extension ends with img.xz or a
registered specialExtension, so all 3 Arduino UNO Q community images
distributed as .tar.xz silently disappear from the redirect map and
return 404.

Add explicit cases for .tar.xz / .tar.gz / .tar.zst so the generator
emits the full compound extension.

Refs: armbian#277
Refs: armbian/armbian-router#39
@github-actions github-actions bot added size/small PR with less then 50 lines 05 Milestone: Second quarter release Needs review Seeking for review labels Apr 14, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 249c3223-6087-4777-b028-74f3ef02346c

📥 Commits

Reviewing files that changed from the base of the PR and between 4c14439 and 5e84cf1.

📒 Files selected for processing (1)
  • scripts/generate-armbian-images-json.sh

Walkthrough

This change updates the scripts/generate-armbian-images-json.sh script to enhance file extension handling. The strip_img_ext() function is modified to remove .tar.xz, .tar.gz, and .tar.zst suffixes in addition to existing .img-related compressed formats. The extract_file_extension() function is extended with explicit detection for tar archives, returning the proper extension (tar.xz, tar.gz, or tar.zst) before falling back to the original behavior. These modifications enable the script to correctly recognize and process different tar archive compression formats.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: handling .tar.xz image archives in the JSON generation script.
Description check ✅ Passed The description is detailed and well-related to the changeset, explaining the problems, fixes, and related issues comprehensively.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@igorpecovnik igorpecovnik merged commit 360356c into armbian:main Apr 14, 2026
5 checks passed
@SuperKali SuperKali deleted the fix/tar-xz-image-extensions branch April 14, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release Needs review Seeking for review size/small PR with less then 50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants