소스 컴파일이 되지 않는 바이너리 혹은 스크립트 수준의 패키지를 위한 rpm build utility 입니다. 만들어 쓰던것을 공유해보고자
 http://code.google.com/p/rpmwand/
위에 둥지를 하나 틀어, rpmwand 라는 이름으로 올렸습니다.
사용방법은 간단합니다.

초기화

$ rpmwand init sample
* Created skeleton directory: 'sample-skel'
* Created file list: sample-files.txt
  Please edit sample-files.txt
* Created spec input file: sample.spec.in
  Please edit sample.spec.in
  Fix TODO values
rpmwand 는 크게 두가지 명령으로 구성되어 있습니다. 'init' 명령과 패키지 이름을 주면 두 개의 파일과 한 개의 디렉토리가 생성됩니다. rpm 빌드용 spec file과 간단한 skeleton root 디렉토리, 그리고, skeleton에 들어간 file list가 들어 있는 파일하나가 생성됩니다.

빌드

$ rpmwand build sample
 * Package name : sample
 * Version      : 1.0.0
 * Release      : 1
--------------------------------------------------------------------------
* Making tarball(sample-1.0.0.tar.gz) for rpm build...
* Tarball(sample-1.0.0.tar.gz) is assumed containing 'sample-1.0.0' directory as the first child item
* Cloning 'sample-skel' directory to 'sample-1.0.0'
* Check if there is custom packaging script (sample-setup.sh)
  skip running: bash sample-setup.sh /home/pynoos/rpmwand/sample-1.0.0
* Tarring 'sample-1.0.0.tar.gz' from 'sample-1.0.0'
--------------------------------------------------------------------------
* Now, building rpm....
Building target platforms: noarch
Building for target noarch
Executing(%prep): /bin/sh -e /home/pynoos/rpmwand/faked-root.19231/tmp/rpm-tmp.83533
+ umask 022
+ cd /home/pynoos/rpmwand/faked-root.19231/
+ true ==================================================================================
+ true 'BEG Build preprocess'
+ true 'END Build preprocess'
+ cd /home/pynoos/rpmwand/faked-root.19231
+ rm -rf sample-1.0.0
+ /bin/gzip -dc /home/pynoos/rpmwand/sample-1.0.0.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd sample-1.0.0
++ /usr/bin/id -u
+ '[' 503 = 0 ']'
++ /usr/bin/id -u
+ '[' 503 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ true ==================================================================================
+ true 'BEG Setup'
+ true 'END Setup'
+ exit 0
Executing(%build): /bin/sh -e /home/pynoos/rpmwand/faked-root.19231/tmp/rpm-tmp.83533
+ umask 022
+ cd /home/pynoos/rpmwand/faked-root.19231/
+ cd sample-1.0.0
+ true ==================================================================================
+ true 'BEG Build'
+ echo 'BUILDROOT: /home/pynoos/rpmwand/faked-root.19231'
BUILDROOT: /home/pynoos/rpmwand/faked-root.19231
+ echo 'PACKAGE-NAME: sample'
PACKAGE-NAME: sample
+ echo 'PACKAGE-VERSION: 1.0.0'
PACKAGE-VERSION: 1.0.0
+ echo 'PACKAGE-RELEASE: 1'
PACKAGE-RELEASE: 1
+ true 'END Build'
+ exit 0
Executing(%install): /bin/sh -e /home/pynoos/rpmwand/faked-root.19231/tmp/rpm-tmp.83533
+ umask 022
+ cd /home/pynoos/rpmwand/faked-root.19231/
+ cd sample-1.0.0
+ true ==================================================================================
+ true 'BEG Installation'
+ /bin/cat
+ true 'END Installation'
+ make prefix=/home/pynoos/rpmwand/faked-root.19231/usr exec_prefix=/home/pynoos/rpmwand/faked-root.19231/usr bindir=/home/pynoos/rpmwand/faked-root.19231/usr/bin sbindir=/home/pynoos/rpmwand/faked-root.19231/usr/sbin sysconfdir=/home/pynoos/rpmwand/faked-root.19231/etc datadir=/home/pynoos/rpmwand/faked-root.19231/usr/share includedir=/home/pynoos/rpmwand/faked-root.19231/usr/include libdir=/home/pynoos/rpmwand/faked-root.19231/usr/lib libexecdir=/home/pynoos/rpmwand/faked-root.19231/usr/libexec localstatedir=/home/pynoos/rpmwand/faked-root.19231/var sharedstatedir=/home/pynoos/rpmwand/faked-root.19231/usr/com mandir=/home/pynoos/rpmwand/faked-root.19231/usr/share/man infodir=/home/pynoos/rpmwand/faked-root.19231/usr/share/info install
I am FAKE Makefile install target. Do you see me?
+ true ==================================================================================
+ true 'BEG make install'
+ true BUILDROOT:/home/pynoos/rpmwand/faked-root.19231
+ /bin/rm -rf /home/pynoos/rpmwand/faked-root.19231/sample-1.0.0/Makefile
+ mv /home/pynoos/rpmwand/faked-root.19231/sample-1.0.0/etc /home/pynoos/rpmwand/faked-root.19231/sample-1.0.0/usr /home/pynoos/rpmwand/faked-root.19231
+ true 'END make install'
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
Processing files: sample-1.0.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/pynoos/rpmwand/faked-root.19231
Wrote: /home/pynoos/rpmwand/RPMS/noarch/sample-1.0.0-1.noarch.rpm
Executing(%clean): /bin/sh -e /home/pynoos/rpmwand/faked-root.19231/tmp/rpm-tmp.27064
+ umask 022
+ cd /home/pynoos/rpmwand/faked-root.19231/
+ cd sample-1.0.0
+ true ==================================================================================
+ exit 0
--------------------------------------------------------------------------
 * RPM build done...
 * Check..
/home/pynoos/rpmwand/RPMS/noarch/sample-1.0.0-1.noarch.rpm
위 명령은 'build' 인데 인자를 추가로 version, release, architecture를 갖습니다. 이 명령으로 spec.in을 spec으로 만들고, file-list를 읽어서 rpm을 만드는데 사용합니다.

이렇게 간단한 두 명령으로 일단 sample-1.0.0-1.noarch.rpm 파일이 만들어집니다.

실제 사용을 위해서는 init 명령에 의해 생성된 skeleton root에 원하는 파일을 추가하고, 설치 목록 파일(file-list.txt)을 수정하여 build 명령을 주면 됩니다. 만들어지는 spec.in 파일들을 직접 열어서 수정할 수 있고, 수정하면 전문적으로 사용할 수도 있는 구조로 되어 있으므로, 처음 배우시는 분들에게 도움이 될 것입니다.

참고로, 저희 팀 내부에서는 이 유틸리티의 전신이 되는 툴을 사용하여 php 배포용 rpm을 만들어 사용합니다.
신고
  1. jeppy 2010.04.28 14:06 신고

    download cnt 뿐만이 아니라 이 글의 comment 수도 역시나.. -_-;;
    rpmwand 쵝오~ ! fanclub 만들까요? -_-;;

+ Recent posts