Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)5.4k · #14966

azldev-overlays

Skill này làm gì

Skill này giải thích cách thay đổi đặc tả upstream của một gói bằng overlay được áp dụng khi render. Nó dành cho lập trình viên tùy chỉnh gói trong một bản phân phối azldev và cần xử lý sự cố.

Khi nào nên dùng

  • ✓Khi bạn cần thay đổi một dòng hoặc một phần của đặc tả upstream.
  • ✓Khi một overlay thất bại hoặc đặc tả đã render trông không đúng.
  • ✓Khi bạn muốn thêm một bản vá cục bộ mà không sao chép toàn bộ đặc tả.

Liên kết skill

https://github.com/microsoft/azurelinux/blob/4.0/.agents/skills/azldev-overlays/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/microsoft/azurelinux/blob/4.0/.agents/skills/azldev-overlays/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi cần thay đổi một cài đặt trong đặc tả upstream cho gói của mình mà không fork nó. Bạn có thể giúp tôi viết một overlay không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent thêm overlay vào cấu hình thành phần, render đặc tả và kiểm tra kết quả. Nó dùng đầu ra diff để tìm lỗi overlay và sửa chúng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Working with overlays

Overlays are semantic patches applied to a component's RPM spec and loose source files at render time. They let you make targeted changes to an upstream spec without forking it. Prefer an overlay over hand-editing a rendered spec: overlays are re-applied on every render, so a manual edit to a rendered spec is overwritten.

The inner loop

Overlays live in the component's TOML config — inline [[components.<name>.overlays]] entries, or per-file overlay documents referenced by the component's overlay-files glob. They apply in order and are non-atomic: if one fails part-way, the overlays before it stay applied.

  1. Add or edit the overlay in the component config.

  2. Re-render and inspect the result:

    azldev comp render -p <name>
    

    Read the rendered spec (under specs/) to confirm the change landed where you intended, and iterate until it is correct.

  3. Finalize the lock and changelog with the normal end-of-work refresh (see the azldev-update-component skill): update the lock, commit, then re-render and amend.

Config errors reference the offending overlay by its description, so give every overlay a short, specific description.

Diagnose common failures

Start with azldev comp diff-sources -p <name> to see the exact overlay effect. Use separate pre/post prep-sources directories only when you need persistent trees for deeper inspection.

Symptom Likely cause and fix
spec-add-tag: tag already exists Upstream already has the tag. Use spec-set-tag, or spec-update-tag when its prior existence is an invariant.
spec-search-replace: no match Inspect the current upstream line, check TOML regex quoting, and narrow the expression to the actual section/package.
Section or file not found Inspect the upstream spec/source names; upstream may have renamed or removed the target.
Overlay applies but output/build is wrong Inspect diff-sources for an over-broad match, malformed replacement, or a dependency/file change the overlay omitted.

Choosing an overlay type

Match the change to the narrowest overlay type. Required fields are enforced when the config loads, so a missing field fails fast rather than at apply time.

Spec overlays (structured .spec edits)

Type Use for Required
spec-add-tag add a tag; fails if it already exists tag, value
spec-insert-tag add a tag next to its family (e.g. after the last Source*) tag, value
spec-set-tag set a tag, replacing it if present or adding it if not tag, value
spec-update-tag change an existing tag; fails if it is missing tag, value
spec-remove-tag delete tag instances; without value, deletes every instance tag
spec-prepend-lines insert lines at the top of a section (or the whole file) lines
spec-append-lines insert lines at the end of a section (or the whole file) lines
spec-search-replace regex replace within a section (or the whole spec) regex
spec-remove-section delete a whole section section
spec-remove-subpackage delete every section of a sub-package package
patch-add add a .patch file and register it in the spec source
patch-remove remove a patch and its spec references file

File overlays (loose non-spec files; never .spec)

Type Use for Required
file-prepend-lines prepend lines to a file file, lines
file-search-replace regex replace in a file file, regex
file-add copy in a new file; fails if it already exists file, source
file-remove delete a file file
file-rename rename a file in place file, replacement

Rules that trip people up

  • spec-remove-tag without value removes every instance of the named tag. To remove one dependency, set both tag and the exact value to match:

    [[components.mypackage.overlays]]
    description = "Remove an unavailable build dependency"
    type = "spec-remove-tag"
    tag = "BuildRequires"
    value = "unwanted-package"
    
  • section is optional only for spec-prepend-lines, spec-append-lines, and spec-search-replace (omit it to target the whole spec). It is required for spec-remove-section.

  • package needs section on the whole-file-capable overlays — a sub-package is a sub-qualifi

Câu hỏi thường gặp

Vì sao không sửa đặc tả đã render?

Skill ghi rằng overlay được áp dụng lại mỗi lần render, nên chỉnh sửa thủ công đặc tả đã render sẽ bị ghi đè.

Overlay có được áp dụng theo thứ tự không?

Có. Skill ghi rằng chúng được áp dụng theo thứ tự, và nếu lỗi xảy ra giữa chừng thì các overlay trước đó vẫn được áp dụng.

Vì sao mỗi overlay cần mô tả?

Lỗi cấu hình tham chiếu overlay theo mô tả của nó, nên một mô tả ngắn và cụ thể giúp tìm ra vấn đề.

Chi tiết

Mô tả gốc của tác giả

Read this before adding, changing, or diagnosing any overlay; never edit a spec or rendered file from memory. Explains how to modify a component's RPM spec or loose source files with azldev overlays (semantic patches applied at render time) instead of forking the spec, covering overlay types, the render-and-inspect loop, common failures, pitfalls, and metadata. Triggers include overlay, overlay failed, no match, spec-add-tag, spec-remove-tag, patch-add, fix spec, backport, disable test, prune subpackage, edit spec.

repo: microsoft/azurelinux

Độ phổ biến

Sao GitHub
5.4k
Vị trí xếp hạng
#14966
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự