ようやく「SUZ-LAB Repository !」が利用できるようになったのですが、最後に行ったリポジトリ用RPMの作成と
SRPMも含めたリポジトリの作成の方法もメモとして残しておきます。
(少し、SUZ-LABリポジトリ(yum)追加用RPMも用意してみたの記事の復習にもなります。)
○ソースの準備
/etc/yum.repos.d/にインストールするファイルを/opt/suz-lab/share/rpmbuild/SOURCES/に用意します。
# cd /opt/suz-lab/share/rpmbuild/SOURCES/
# cp /etc/yum.repos.d/suz-lab.repo ./
# cat suz-lab.repo
[suz-lab]
name=SUZ-LAB Packages for CentOS 6 - x86_64
baseurl=http://yum.suz-lab.com/yum/6/binary
enabled=1
gpgcheck=0
○SPECファイルの準備
/opt/suz-lab/share/rpmbuild/SPECS/に下記のSPECファイルを準備します。
# cd /opt/suz-lab/share/rpmbuild/SPECS/
# cat suzlab-release.spec
Name: suzlab-release
Version: 6
Release: 1
Summary: YUM configuration for SUZ-LAB Repository
Group: System Environment/Base
License: GPL
URL: http://www.suz-lab.com/
Source0: suz-lab.repo
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: redhat-release >= %{version}
%description
%prep
%setup -q -c -T
install -pm 644 %{SOURCE0} .
%build
%install
rm -rf $RPM_BUILD_ROOT
install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d
install -pm 644 %{SOURCE0} $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%config(noreplace) /etc/yum.repos.d/*
%changelog
* Wed Jan 02 2013 Hiroyasu Suzuki- 6-1
- Initial Package for CentOS 6
○rpmbuildでビルド
-baでバイナリパッケージがRPMSにソースパッケージがSRPMSに出力されます。
# rpmbuild -ba suzlab-release.spec
実行中(%prep): /bin/sh -e /var/tmp/rpm-tmp.zxq1ro
+ umask 022
+ cd /opt/suz-lab/share/rpmbuild/BUILD
+ cd /opt/suz-lab/share/rpmbuild/BUILD
+ rm -rf suzlab-release-6
+ /bin/mkdir -p suzlab-release-6
+ cd suzlab-release-6
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ install -pm 644 /opt/suz-lab/share/rpmbuild/SOURCES/suz-lab.repo .
+ exit 0
実行中(%build): /bin/sh -e /var/tmp/rpm-tmp.hV5VDa
+ umask 022
+ cd /opt/suz-lab/share/rpmbuild/BUILD
+ cd suzlab-release-6
+ exit 0
実行中(%install): /bin/sh -e /var/tmp/rpm-tmp.rNGvQW
+ umask 022
+ cd /opt/suz-lab/share/rpmbuild/BUILD
+ cd suzlab-release-6
+ rm -rf /opt/suz-lab/share/rpmbuild/BUILDROOT/suzlab-release-6-1.x86_64
+ install -dm 755 /opt/suz-lab/share/rpmbuild/BUILDROOT/suzlab-release-6-1.x86_64/etc/yum.repos.d
+ install -pm 644 /opt/suz-lab/share/rpmbuild/SOURCES/suz-lab.repo /opt/suz-lab/share/rpmbuild/BUILDROOT/suzlab-release-6-1.x86_64/etc/yum.repos.d
+ /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: suzlab-release-6-1.noarch
Provides: config(suzlab-release) = 6-1
Requires(rpmlib): rpmlib(CompressedFileNames) 伸張ファイルの検査中: /usr/lib/rpm/check-files /opt/suz-lab/share/rpmbuild/BUILDROOT/suzlab-release-6-1.x86_64
書き込み完了: /opt/suz-lab/share/rpmbuild/SRPMS/suzlab-release-6-1.src.rpm
書き込み完了: /opt/suz-lab/share/rpmbuild/RPMS/noarch/suzlab-release-6-1.noarch.rpm
実行中(%clean): /bin/sh -e /var/tmp/rpm-tmp.rgyo9h
+ umask 022
+ cd /opt/suz-lab/share/rpmbuild/BUILD
+ cd suzlab-release-6
+ rm -rf /opt/suz-lab/share/rpmbuild/BUILDROOT/suzlab-release-6-1.x86_64
+ exit 0
○バイナリパッケージ(RPMS)のリポジトリ作成
バイナリパッケージが出力されるディレクトリに入ります。
# cd /opt/suz-lab/share/rpmbuild/RPMS
リポジトリを作成します。
# createrepo -d ./
3/3 - x86_64/bash-doc-4.1.2-9.el6_2.suzlab_1.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
HTML関係も作成します。
# repoview -- --url="http://yum.suz-lab.com/yum/6/binary" ./
Examining repository...done
Opening primary database...done
Opening changelogs database...done
Copying layout...done
Examining state db...done
Collecting group information...done
Collecting letters...done
Writing package bash-doc.html
Writing group development.languages.group.html
Writing package suzlab-release.html
Writing group system_environment.base.group.html
Writing package bash.html
Writing group system_environment.shells.group.html
Writing group letter_b.group.html
Writing group letter_s.group.html
Collecting latest packages...done
Writing index.html...done
Generating rss feed...done
S3にアップロードします。
# s3cmd -P sync ./ s3://ap-northeast-1.yum.suz-lab.com/yum/6/binary/
確認します。
(SUZ-LAB Binary Packages:http://yum.suz-lab.com/yum/6/binary/repoview/)
○ソースパッケージ(RPMS)のリポジトリ作成
ソースパッケージが出力されるディレクトリに入ります。
# cd /opt/suz-lab/share/rpmbuild/SRPMS
リポジトリを作成します。
# createrepo -d ./
2/2 - bash-4.1.2-9.el6_2.suzlab_1.src.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
HTML関係も作成します。
# repoview -- --url="http://yum.suz-lab.com/yum/6/source" ./
Examining repository...done
Opening primary database...done
Opening changelogs database...done
Copying layout...done
Examining state db...done
Collecting group information...done
Collecting letters...done
Writing package suzlab-release.html
Writing group system_environment.base.group.html
Writing package bash.html
Writing group system_environment.shells.group.html
Writing group letter_b.group.html
Writing group letter_s.group.html
Collecting latest packages...done
Writing index.html...done
Generating rss feed...done
S3にアップロードします。
# s3cmd -P sync ./ s3://ap-northeast-1.yum.suz-lab.com/yum/6/source/
確認します。
(SUZ-LAB Source Packages:http://yum.suz-lab.com/yum/6/source/repoview/)
○GitHubのSPECファイル
下記に格納しておきました。
suz-lab-centos-ami:
https://github.com/suz-lab/suz-lab-centos-ami/tree/master/share/rpmbuild/SPECS