Community코딩 & 개발github.com

edit-spec-file

Bottlerocket RPM 스펙 파일을 프로젝트 스타일 규칙에 맞게 편집합니다.

edit-spec-file란 무엇인가요?

이 스킬은 Bottlerocket RPM 스펙 파일을 프로젝트 스타일 가이드라인에 따라 일관되게 편집할 수 있도록 도와줍니다. 사용자는 스타일 가이드를 먼저 읽고, 기존 패키지를 참조 패턴으로 활용한 후, 정해진 섹션 순서와 소스 파일 번호 규칙을 따라야 합니다. 또한 FIPS 변형 서브패키지 생성, 올바른 크로스 컴파일 매크로 사용, 파일 권한 설정 등 Bottlerocket 패키징의 세부 규칙을 숙지해야 합니다. 변경 사항은 검증 체크리스트를 통해 확인한 후 커밋합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cbgbt/bottlerocket-forest/tree/main/skills/edit-spec-file

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Skill: 스펙 파일 편집

목적

Bottlerocket RPM 스펙 파일을 프로젝트 스타일 규칙을 엄격히 준수하여 수정합니다. 이 스킬은 모든 킷 패키지에서 일관되고 유지보수 가능한 스펙 파일을 보장합니다.

사용 시기

  • 패키지에 새 소스 파일, 패치 또는 템플릿 추가하는 경우
  • systemd 서비스 또는 설정 파일 추가하는 경우
  • 새 서브패키지(FIPS 변형 포함) 생성하는 경우
  • 빌드 또는 설치 섹션 수정하는 경우
  • kits/*/packages/에 있는 .spec 파일 변경하는 경우

전제 조건

  • 변경하기 전에 ./STYLE-GUIDE.md를 완전히 읽습니다.
  • 참조 패턴으로 사용할 기존 유사 패키지를 식별합니다.

절차

1. 스타일 가이드 읽기

필수: 변경하기 전에 ./STYLE-GUIDE.md를 읽으세요.

스타일 가이드에는 다음이 포함됩니다.

  • [MUST] 필수 규칙
  • [MUST NOT] 금지 규칙
  • [SHOULD] 강력히 권장되는 규칙

2. 참조 패키지 찾기

패턴으로 사용할 하나 이상의 유사한 기존 패키지를 식별합니다.

# Go 패키지
ls kits/bottlerocket-core-kit/packages/*/nvidia-k8s-device-plugin.spec

# systemd 서비스가 있는 C 패키지
ls kits/bottlerocket-core-kit/packages/chrony/chrony.spec

# FIPS 변형이 있는 패키지
ls kits/bottlerocket-core-kit/packages/amazon-ssm-agent/amazon-ssm-agent.spec

3. 섹션 순서에 따라 변경 적용

스펙 파일은 엄격한 섹션 순서를 따릅니다.

  1. %global 정의
  2. 패키지 메타데이터 (Name, Version, Release, Summary, License, URL)
  3. 소스 파일 (범위별 번호: <100 기타, 1xx systemd, 2xx tmpfiles, 3xx udev, 4xx 라이선스)
  4. 패치 (1000+ 번호)
  5. BuildRequires / Requires
  6. %description
  7. 서브패키지 정의 (%package, %description)
  8. %prep
  9. %build
  10. %install
  11. %files 섹션

4. 소스 파일 번호 지정

필요한 경우 설정된 범위를 따릅니다. 구체적인 지침은 위의 예제 패키지를 참조하세요.

  • Source0-Source99: 주요 소스 및 기타 파일
  • Source100-Source199: Systemd 유닛 파일
  • Source200-Source299: Tmpfiles 설정
  • Source300-Source399: Udev 규칙
  • Source400-Source499: 라이선스 파일

중요: 소스를 제거할 때는 빈 번호를 남겨두고, 동일한 백 단위 섹션 내에 있지 않는 한 기존 소스 번호를 다시 매기지 마세요.

5. 소스 순서대로 파일 설치

%install의 파일은 Source 선언 순서와 동일한 순서로 설치해야 합니다.

# Source 선언:
Source1: nvidia-k8s-device-plugin.service
Source2: nvidia-k8s-device-plugin-conf
Source3: nvidia-k8s-device-plugin-exec-start-conf

# 동일한 순서로 설치:
install -p -m 0644 %{S:1} %{buildroot}%{_cross_unitdir}
install -D -m 0644 %{S:2} %{buildroot}%{_cross_templatedir}/nvidia-k8s-device-plugin-conf
install -D -m 0644 %{S:3} %{buildroot}%{_cross_templatedir}/nvidia-k8s-device-plugin-exec-start-conf

6. 올바른 매크로 사용

항상 크로스 컴파일 매크로를 사용하세요.

  • /usr/bin 대신 %{_cross_bindir}
  • systemd 유닛에는 %{_cross_unitdir}
  • 템플릿에는 %{_cross_templatedir}
  • 팩토리 기본값에는 %{_cross_factorydir}%{_cross_sysconfdir}/...
  • FIPS 바이너리에는 %{_cross_fips_bindir}

7. FIPS 서브패키지 패턴

FIPS 변형이 필요한 바이너리를 추가할 때:

%package bin
Summary: 패키지 바이너리
Provides: %{name}(binaries)
Requires: (%{_cross_os}image-feature(no-fips) and %{name})
Conflicts: (%{_cross_os}image-feature(fips) or %{name}-fips-bin)

%description bin
%{summary}.

%package fips-bin
Summary: 패키지 바이너리, FIPS 에디션
Provides: %{name}(binaries)
Requires: (%{_cross_os}image-feature(fips) and %{name})
Conflicts: (%{_cross_os}image-feature(no-fips) or %{name}-bin)

%description fips-bin
%{summary}.

8. 파일 권한

일관된 권한을 사용하세요.

  • 실행 파일: 0755
  • 설정 파일, 템플릿, 서비스 파일: 0644
  • 타임스탬프 유지를 위해 install -p 사용
  • 상위 디렉터리 생성이 필요할 때 install -D 사용

검증 체크리스트

커밋하기 전에 하위 에이전트를 생성하여 독립적으로 검증하고, 이 문서와 '검증 체크리스트'를 참조하세요.

  • 소스 파일이 올바른 범위로 번호 지정됨
  • 설치 순서가 Source 선언 순서와 일치함
  • 모든 경로가 %{_cross_*} 매크로를 사용함
  • /etc 또는 /var에 설치된 파일 없음 (팩토리 기본값 패턴 사용)
  • 메인 %files 섹션에 %{_cross_attribution_file} 있음
  • 라이선스 파일에 %license 지시문 사용
  • 패키지가 소유한 디렉터리에 %dir 지시문 사용
  • 디버깅 명령어 없음 (ls -la 등)
  • 불필요한 주석 없음
  • 일관된 서식 (끝 공백 없음, 일관된 들여쓰기)
  • Release: 1%{?dist} 형식 (% 앞에 점 없음)

변경 사항 커밋

스펙 파일 변경 사항을 커밋할 때는 커밋 메시지에 줄바꿈을 유지하기 위해 -F와 파일을 사용하세요.

# 메시지를 파일에 작성한 후 -F로 커밋
msg = """package-name: 변경 사항 요약

무엇이 변경되었고 왜 변경되었는지 자세한 설명.

Signed-off-by: 이름 <이메일>"""
write("create", "/tmp/commit-msg.txt", file_text=msg)
bash("git -c commit.gpgsign=false commit -F /tmp/commit-msg.txt")

주의: git commit -m을 repr() 또는 이스케이프 문자열과 함께 사용하지 마세요. 이는 실제 줄바꿈 대신 리터럴 \n을 작성합니다.

일반적인 안티 패턴

하지 말 것:

  • Release: 1.%{?dist} 사용 (점이 있으면 잘못됨)
  • 파일 경로에 ./ 접두사 포함
  • 명백한 작업을 다시 설명하는 주석 추가
  • 적절한 빌드 설정 대신 %exclude 사용
  • 항목 제거 시 소스 번호 다시 매기기
  • 소스 순서와 다르게 파일 설치
  • 매크로 대신 하드코딩된 경로 사용
  • 크로스 패키지 심볼릭 링크 생성

빠른 참조

Systemd 서비스 추가

  1. 100번대 소스 추가: Source101: myservice.service
  2. unitdir에 설치: install -p -m 0644 %{S:101} %{buildroot}%{_cross_unitdir}
  3. %files에 추가: %{_cross_unitdir}/myservice.service

템플릿 추가

  1. 소스 추가: Source5: mytemplate-conf
  2. 설치: install -D -m 0644 %{S:5} %{buildroot}%{_cross_templatedir}/mytemplate-conf
  3. %files에 추가: %{_cross_templatedir}/mytemplate-conf

드롭인 디렉터리 추가

  1. 디렉터리 생성: install -d %{buildroot}%{_cross_unitdir}/myservice.service.d
  2. %files에 추가: %dir %{_cross_unitdir}/myservice.service.d

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

ad-hoc-implementation-plan

Transform a rough plan into implement-commit ready artifacts. Allows rigorous review while implementing.

build-kit-locally

Build a kit and publish it to a locally hosted registry for development testing

build-variant-from-local-kits

Build a variant using locally published kits for development validation

deep-research

Create educational documents that build understanding progressively with citations

fact-find

Quick lookup of specific facts about Bottlerocket with citations

idea-honing

Clarify feature ideas through iterative Q&A, recording insights to guide concept development

implement-commit

Implement commits from an implementation plan using a TDD pipeline

local-registry

Start and manage a local OCI registry for Bottlerocket kit development

prepare-core-kit-release

Prepare bottlerocket-core-kit for release by bumping version and updating changelog

propose-feature-concept

Create a new feature concept document to pitch the idea and explain the problem/solution

propose-feature-design

Create or update feature technical design document with architecture and implementation guidance

propose-feature-requirements

Create or update feature requirements specification using EARS notation with examples and appendices

propose-feature-test-plan

Create a test plan mapping EARS requirements and Critical Constraints to specific tests

propose-implementation-plan

Create an implementation plan with atomic commits that build toward a complete feature

review-code

Deep code review generating PR comments via principled question-driven analysis

review-scope

Verify code changes match intended scope and requirements without exceeding boundaries

review-style

Verify code follows project style guides without providing improvement suggestions

test-local-twoliter

Build and test local changes to twoliter before releasing

update-twoliter

Update all Bottlerocket repositories to a new Twoliter version

관련 스킬