%define ruby     /usr/bin/ruby
%define rbindir  %(%{ruby} -r rbconfig -e 'print Config::CONFIG["bindir"]')
%define rlibdir  %(%{ruby} -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
%define rarchdir %(%{ruby} -r rbconfig -e 'print Config::CONFIG["archdir"]')
%define etcdir   /etc/tiny-buildfarm
%define statedir /var/lib/tiny-buildfarm

Name: tiny-buildfarm
Version: 0.0.2.2
Release: 0vl3
Copyright: distributable
Group: Development/Tools
Source: http://arika.org/archive/%{name}-%{version}.tar.gz
Prefix: /usr
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: ruby, ruby-devel >= 1.6.4-0vl3
PreReq: ruby, ruby-optparse, ruby-rpmspec
Requires: ruby, ruby-optparse, ruby-rpmspec, rpm, apt >= 0.3.19.cnc.52
Summary: Tiny Buildfarm
Summary(ja): Tiny Buildfarm

%description

%description -l ja

%prep

%setup -q

%build
ruby install.rb config \
  --bin-dir=%{rbindir} \
  --rb-dir=%{rlibdir} \
  --so-dir=%{rarchdir}
ruby install.rb setup

%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{rbindir}
mkdir -p ${RPM_BUILD_ROOT}%{rlibdir}
mkdir -p ${RPM_BUILD_ROOT}%{rarchdir}
mkdir -p ${RPM_BUILD_ROOT}%{etcdir}
mkdir -p ${RPM_BUILD_ROOT}%{statedir}

# installing binaries ...
ruby install.rb install --prefix=${RPM_BUILD_ROOT}
install -m644 \
  examples/sources.list.vine215 \
  examples/sources.list.vineseed \
  ${RPM_BUILD_ROOT}%{etcdir}/
ln -sf sources.list.vine215 \
  ${RPM_BUILD_ROOT}%{etcdir}/sources.list.vinelinux

%clean
rm -rf ${RPM_BUILD_ROOT}

%post
/usr/bin/chrootdo-init

%preun
if [ "$0" = 0 ] && [ -d %{statedir} ]
then
  cd %{statedir} && rm -rf *
fi

%files
%defattr(-, root, root)
%{rbindir}
%{rlibdir}
%{statedir}
%config %{etcdir}/sources.list.*

%changelog
* Mon Feb 04 2002 akira yamada <akira@vinelinux.org> 0.0.2.2-0vl3
- added ruby, ruby-optparse, ruby-rpmspec to PreReq.

* Mon Feb 04 2002 akira yamada <akira@vinelinux.org> 0.0.2.2-0vl2
- requires ruby-rpmspec

* Mon Feb 04 2002 akira yamada <akira@vinelinux.org> 0.0.2.2-0vl1
- new upstream version.

* Mon Oct 22 2001 akira yamada <akira@vinelinux.org> 0.0.1.1-0vl1
- new upstream version.

* Mon Oct 22 2001 akira yamada <akira@vinelinux.org> 0.0.1-0vl2
- new upstream version.

* Sat Oct 20 2001 akira yamada <akira@vinelinux.org> 0.0.0.6.1-0vl1
- new upstream version.

* Sat Oct 20 2001 akira yamada <akira@vinelinux.org> 0.0.0.6-0vl1
- new upstream version.

* Mon Sep 10 2001 akira yamada <akira@vinelinux.org> 0.0.0.5.1-0vl1
- new upstream version.

* Sun Sep 09 2001 akira yamada <akira@vinelinux.org> 0.0.0.5-0vl1
- new upstream version.

* Sun Sep 09 2001 akira yamada <akira@vinelinux.org> 0.0.0.4-0vl1
- new upstream version.

* Sun Sep 09 2001 akira yamada <akira@vinelinux.org> 0.0.0.3-0vl1
- new upstream version.

* Thu Sep 07 2001 akira yamada <akira@vinelinux.org> 0.0.0.2-0vl1
- new upstream version.

* Thu Sep 07 2001 akira yamada <akira@vinelinux.org> 0.0.0.1-0vl1
- new upstream version.

* Thu Sep 06 2001 akira yamada <akira@vinelinux.org> 0.0.0.0.1-0vl1
- new upstream version.

* Thu Sep 06 2001 akira yamada <akira@vinelinux.org> 0.0.0.0-0vl1
- Initial packaging.
