OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src Date: 03-Nov-2006 20:42:39
Branch: HEAD Handle: 2006110319423900
Added files:
openpkg-src/bittorrent bittorrent.patch
Modified files:
openpkg-src/bittorrent bittorrent.spec rc.bittorrent
Log:
upgrading package: bittorrent 4.26.0 -> 5.0.0
Summary:
Revision Changes Path
1.1 +28 -0 openpkg-src/bittorrent/bittorrent.patch
1.51 +41 -8 openpkg-src/bittorrent/bittorrent.spec
1.6 +19 -10 openpkg-src/bittorrent/rc.bittorrent
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/bittorrent/bittorrent.patch
============================================================================
$ cvs diff -u -r0 -r1.1 bittorrent.patch
--- /dev/null 2006-11-03 20:42:29 +0100
+++ bittorrent.patch 2006-11-03 20:42:39 +0100
@@ -0,0 +1,28 @@
+Index: BitTorrent/platform.py
+--- BitTorrent/platform.py.orig 2006-10-26 23:42:46 +0200
++++ BitTorrent/platform.py 2006-11-03 20:23:49 +0100
+@@ -282,9 +282,9 @@
+
+ def calc_unix_dirs():
+ appdir = '%s-%s' % (app_name, version)
+- ip = os.path.join(efs2(u'share'), efs2(u'pixmaps'), appdir)
+- dp = os.path.join(efs2(u'share'), efs2(u'doc'), appdir)
+- lp = os.path.join(efs2(u'share'), efs2(u'locale'))
++ ip = os.path.join(efs2(u'share/bittorrent'), efs2(u'pixmaps'), appdir)
++ dp = os.path.join(efs2(u'share/bittorrent'), efs2(u'doc'), appdir)
++ lp = os.path.join(efs2(u'share/bittorrent'), efs2(u'locale'))
+ return ip, dp, lp
+
+ def no_really_makedirs(path):
+Index: setup.py
+--- setup.py.orig 2006-11-03 20:22:27 +0100
++++ setup.py 2006-11-03 20:24:11 +0100
+@@ -106,7 +106,7 @@
+ 'url' : "http://bittorrent.com/",
+ 'license' : "BitTorrent Open Source License",
+ 'scripts' : use_scripts,
+- 'packages' : ["BTL", "BitTorrent", "khashmir", "BitTorrent.GUI_wx",],
++ 'packages' : ["BTL", "BitTorrent", "khashmir",],
+ 'package_dir' : {"BTL": "BTL"},
+ 'package_data' : {"BTL": ["*.dat"]},
+ 'py_modules' : ["Zeroconf",],
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/bittorrent/bittorrent.spec
============================================================================
$ cvs diff -u -r1.50 -r1.51 bittorrent.spec
--- openpkg-src/bittorrent/bittorrent.spec 13 Oct 2006 17:27:03 -0000
1.50
+++ openpkg-src/bittorrent/bittorrent.spec 3 Nov 2006 19:42:39 -0000
1.51
@@ -32,19 +32,22 @@
Class: EVAL
Group: P2P
License: MIT-style
-Version: 4.26.0
-Release: 20061013
+Version: 5.0.0
+Release: 20061103
# list of sources
Source0: http://download.bittorrent.com/dl/BitTorrent-%{version}.tar.gz
Source1: rc.bittorrent
Source2: apache.conf
+Patch0: bittorrent.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
-BuildPreReq: OpenPKG, openpkg >= 20060823, python
-PreReq: OpenPKG, openpkg >= 20060823, python
+BuildPreReq: OpenPKG, openpkg >= 20060823
+PreReq: OpenPKG, openpkg >= 20060823
+BuildPreReq: python, python-net, python-crypto
+PreReq: python, python-net, python-crypto
AutoReq: no
AutoReqProv: no
@@ -60,18 +63,28 @@
%prep
%setup -q -n BitTorrent-%{version}
-
-%build
+ %patch -p0
%{l_shtool} subst \
-e 's;#!/usr/bin/env python;#!%{l_prefix}/bin/python;g' \
*.py
+%build
+
%install
+ # install programs
rm -rf $RPM_BUILD_ROOT
HOME=`pwd` %{l_prefix}/bin/python \
setup.py install \
--root=$RPM_BUILD_ROOT \
--prefix=%{l_prefix}
+
+ # remove GUI part
+ rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/bittorrent
+ rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/bittorrent/pixmaps
+ rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/bittorrent/locale
+ rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/bittorrent/doc
+
+ # wrap executables
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/libexec/bittorrent
( cd $RPM_BUILD_ROOT%{l_prefix}/bin
@@ -84,18 +97,24 @@
chmod a+x $RPM_BUILD_ROOT%{l_prefix}/bin/$bin
done
) || exit $?
+
+ # install default configuration
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/bittorrent
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE apache.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/bittorrent/
+
+ # install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.bittorrent} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+ # create run-time directory
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/bittorrent
- rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
- rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/locale
+
+ # determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bittorrent' \
@@ -106,3 +125,17 @@
%clean
rm -rf $RPM_BUILD_ROOT
+%post
+ # after upgrade, restart service
+ [ $1 -eq 2 ] || exit 0
+ eval `%{l_rc} bittorrent status 2>/dev/null`
+ [ ".$bittorrent_active" = .yes ] && %{l_rc} bittorrent restart
+ exit 0
+
+%preun
+ # before erase, stop service and remove run-time files
+ [ $1 -eq 0 ] || exit 0
+ %{l_rc} bittorrent stop 2>/dev/null
+ rm -f $RPM_INSTALL_PREFIX/var/bittorrent/* >/dev/null 2>&1 || true
+ exit 0
+
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/bittorrent/rc.bittorrent
============================================================================
$ cvs diff -u -r1.5 -r1.6 rc.bittorrent
--- openpkg-src/bittorrent/rc.bittorrent 25 Aug 2006 19:16:01 -0000
1.5
+++ openpkg-src/bittorrent/rc.bittorrent 3 Nov 2006 19:42:39 -0000
1.6
@@ -6,6 +6,8 @@
%config
bittorrent_enable="$openpkg_rc_def"
bittorrent_port="6969"
+ bittorrent_bind="127.0.0.1"
+ bittorrent_flags=""
bittorrent_log_prolog="true"
bittorrent_log_epilog="true"
bittorrent_log_numfiles="10"
@@ -13,17 +15,20 @@
bittorrent_log_complevel="9"
%common
- bittorrent_datafile="@l_prefix@/var/bittorrent/bttrack.data"
- bittorrent_logfile="@l_prefix@/var/bittorrent/bttrack.log"
- bittorrent_pidfile="@l_prefix@/var/bittorrent/bttrack.pid"
+ bittorrent_datadir="@l_prefix@/var/bittorrent"
+ bittorrent_datafile="@l_prefix@/var/bittorrent/bittorrent-tracker.data"
+ bittorrent_logfile="@l_prefix@/var/bittorrent/bittorrent-tracker.log"
+ bittorrent_pidfile="@l_prefix@/var/bittorrent/bittorrent-tracker.pid"
bittorrent_signal () {
[ -f $bittorrent_pidfile ] \
&& kill -$1 `cat $bittorrent_pidfile`
}
-%status -u @l_susr@ -o
+%status -u @l_rusr@ -o
bittorrent_usable="no"
bittorrent_active="no"
+ rcService bittorrent enable yes && \
+ bittorrent_signal 0 && bittorrent_active="yes"
echo "bittorrent_enable=\"$bittorrent_enable\""
echo "bittorrent_usable=\"$bittorrent_usable\""
echo "bittorrent_active=\"$bittorrent_active\""
@@ -31,12 +36,16 @@
%start -u @l_rusr@
rcService bittorrent enable yes || exit 0
rcService bittorrent active yes && exit 0
- ( nohup @l_prefix@/bin/bttrack \
- --port $bittorrent_port \
- --dfile $bittorrent_datafile \
- --logfile $bittorrent_logfile \
- </dev/null >/dev/null 2>&1 &
- echo $! >$bittorrent_pidfile
+ export HOME="$bittorrent_datadir"
+ ( nohup @l_prefix@/bin/bittorrent-tracker \
+ --port "$bittorrent_port" \
+ --bind "$bittorrent_bind" \
+ --dfile "$bittorrent_datafile" \
+ --data_dir "$bittorrent_datadir" \
+ --logfile "$bittorrent_logfile" \
+ --pid "$bittorrent_pidfile" \
+ --twisted 1 bittorrent_flags \
+ </dev/null >/dev/null 2>&1 &
) >/dev/null 2>&1
%stop -u @l_rusr@
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]