ksaitoの日記

日々試したことの覚え書き

RPMにパッチを当てる

移転しました。

自動的にリダイレクトします。

RPMパッケージにパッチを当てる手順です。
mod_auth_mysqlredmineのsalt対応パッチを適用しました。

ソースリポジトリを登録

パッチを当てるには、SRPMパッケージが必要です。
yumリポジトリにソースリポジトリを追加します。

$ pwd
/etc/yum.repos.d
$ cat srpm.repo
[rhel-src]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
$

リポジトリが追加できたらダウンロードします。

$ yumdownloader --source mod_auth_mysql

SRPMパッケージのインストール

SRPMパッケージをrpmコマンドでインストールします。

$ sudo rpm -ivh mod_auth_mysql-3.0.0-3.2.el5_3.src.rpm
   1:mod_auth_mysql         警告: ユーザ mockbuild は存在しません - root を使用します
警告: グループ mockbuild は存在しません - root を使用します
警告: ユーザ mockbuild は存在しません - root を使用します
警告: グループ mockbuild は存在しません - root を使用します
警告: ユーザ mockbuild は存在しません - root を使用します
警告: グループ mockbuild は存在しません - root を使用します
警告: ユーザ mockbuild は存在しません - root を使用します
警告: グループ mockbuild は存在しません - root を使用します
警告: ユーザ mockbuild は存在しません - root を使用します
警告: グループ mockbuild は存在しません - root を使用します
警告: ユーザ mockbuild は存在しません - root を使用します
警告: グループ mockbuild は存在しません - root を使用します
########################################### [100%]
$

インストールする場所は、決まっているようです。

$ pwd
/usr/src/redhat
$ tree
.
|-- BUILD
|-- RPMS
|   |-- athlon
|   |-- geode
|   |-- i386
|   |-- i486
|   |-- i586
|   |-- i686
|   `-- noarch
|-- SOURCES
|   |-- auth_mysql.conf
|   |-- mod_auth_mysql-3.0.0-CVE-2008-2384.patch
|   |-- mod_auth_mysql-3.0.0-apr1x.patch
|   |-- mod_auth_mysql-3.0.0-disable.patch
|   `-- mod_auth_mysql-3.0.0.tar.gz
|-- SPECS
|   `-- mod_auth_mysql.spec
`-- SRPMS
 
12 directories, 6 files
$

パッチのダウンロード

適用するパッチをダウンロードします。

$ pwd
/usr/src/redhat/SOURCES
$ wget http://www.redmine.org/attachments/download/6443/mod_auth_mysql-3.0.0-redmine.patch

specファイルの編集

specファイルを編集します。
修正は、以下の通りです。
必要に応じてchangelogを追加します。

$ diff -u mod_auth_mysql.spec.org mod_auth_mysql.spec
@@ -1,7 +1,7 @@
 Summary: Basic authentication for the Apache web server using a MySQL database.
 Name: mod_auth_mysql
 Version: 3.0.0
-Release: 3.2%{?dist}
+Release: 3.2.1%{?dist}
 Epoch: 1
 Group: System Environment/Daemons
 URL: http://modauthmysql.sourceforge.net/
@@ -10,6 +10,7 @@
 Patch0: mod_auth_mysql-3.0.0-apr1x.patch
 Patch1: mod_auth_mysql-3.0.0-disable.patch
 Patch2: mod_auth_mysql-3.0.0-CVE-2008-2384.patch
+Patch3: mod_auth_mysql-3.0.0-redmine.patch
 License: Apache Software License
 BuildRoot: %{_tmppath}/%{name}-root
 BuildPrereq: httpd-devel, mysql-devel
@@ -24,6 +25,7 @@
 %patch0 -p1 -b .apr1x
 %patch1 -p1 -b .disable
 %patch2 -p1 -b .cve2384
+%patch3 -p1 -b .redmine
 
 %build
 %{_sbindir}/apxs -I%{_includedir}/mysql -Wc,-Wall -Wc,-Werror \
@@ -49,6 +51,9 @@
 %config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
 
 %changelog
 * Tue Feb  3 2009 Joe Orton <jorton@redhat.com> 1:3.0.0-3.2
 - add security fix for CVE-2008-2384 (#480613)
 $

ビルド

rpmbuildコマンドでビルドします。

$ sudo rpmbuild -ba mod_auth_mysql.spec

インストール

/usr/src/redhat/RPMSに作成されたパッケージをインストールします。

$ sudo /etc/init.d/httpd stop
$ sudo rpm &#8211;ivh /usr/src/redhat/RPMS/i386/mod_auth_mysql-3.0.0-3.2.1.i386.rpm
$ cd /etc/httpd
$ sudo cp subversion.conf.redmine.1.4 conf.d/subversion.conf
$ sudo /etc/init.d/httpd start

これで、redmine 1.2以上のsaltに対応した認証が使えるようになります。