[packages_10.03.2] transmission: merge r27718, r28280, r28289, r28342, r28343, r28389...
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 5 Feb 2012 16:20:54 +0000 (16:20 +0000)
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 5 Feb 2012 16:20:54 +0000 (16:20 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/branches/packages_10.03.2@30271 3c298f89-4303-0410-b956-a3cf2f4a3e73

net/transmission/Makefile
net/transmission/files/transmission.config
net/transmission/files/transmission.init
net/transmission/patches/010-opt_scrape_paused.patch [deleted file]

index 6c8258b..bd115f3 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=transmission
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=transmission
-PKG_VERSION:=2.32
-PKG_RELEASE:=2
+PKG_VERSION:=2.42
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://mirrors.m0k.org/transmission/files
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://mirrors.m0k.org/transmission/files
-PKG_MD5SUM:=cac5d0e07b92e563b34b61de5a6235c7
+PKG_MD5SUM:=2ade0818d465779bd956b8b72ea56b02
 
 PKG_FIXUP:=libtool
 PKG_INSTALL:=1
 
 PKG_FIXUP:=libtool
 PKG_INSTALL:=1
index 8e3db7b..912f52f 100644 (file)
@@ -1,7 +1,7 @@
 config transmission
        option enabled 0
        option config_dir '/tmp/transmission'
 config transmission
        option enabled 0
        option config_dir '/tmp/transmission'
-       option run_daemon_as_user root
+       #option user 'nobody'
        option alt_speed_down 50
        option alt_speed_enabled false
        option alt_speed_time_begin  540
        option alt_speed_down 50
        option alt_speed_enabled false
        option alt_speed_time_begin  540
@@ -16,6 +16,8 @@ config transmission
        option cache_size_mb 2
        option dht_enabled true
        option download_dir '/tmp/transmission/done'
        option cache_size_mb 2
        option dht_enabled true
        option download_dir '/tmp/transmission/done'
+       option download_queue_enabled true
+       option download_queue_size 4
        option encryption 1
        option idle_seeding_limit 30
        option idle_seeding_limit_enabled false
        option encryption 1
        option idle_seeding_limit 30
        option idle_seeding_limit_enabled false
@@ -32,11 +34,13 @@ config transmission
        option peer_port_random_high 65535
        option peer_port_random_low 49152
        option peer_port_random_on_start false
        option peer_port_random_high 65535
        option peer_port_random_low 49152
        option peer_port_random_on_start false
-       option peer_socket_tos 0
+       option peer_socket_tos 'default'
        option pex_enabled true
        option port_forwarding_enabled true
        option preallocation 1
        option prefetch_enabled 1
        option pex_enabled true
        option port_forwarding_enabled true
        option preallocation 1
        option prefetch_enabled 1
+       option queue_stalled_enabled true
+       option queue_stalled_minutes 30
        option ratio_limit 2.0000
        option ratio_limit_enabled false
        option rename_partial_files true
        option ratio_limit 2.0000
        option ratio_limit_enabled false
        option rename_partial_files true
@@ -49,8 +53,11 @@ config transmission
        option rpc_username ''
        option rpc_whitelist '127.0.0.1,192.168.1.*'
        option rpc_whitelist_enabled true
        option rpc_username ''
        option rpc_whitelist '127.0.0.1,192.168.1.*'
        option rpc_whitelist_enabled true
+       option scrape_paused_torrents_enabled true
        option script_torrent_done_enabled false
        option script_torrent_done_filename ''
        option script_torrent_done_enabled false
        option script_torrent_done_filename ''
+       option seed_queue_enabled false
+       option seed_queue_size 10
        option speed_limit_down 100
        option speed_limit_down_enabled false
        option speed_limit_up 20
        option speed_limit_down 100
        option speed_limit_down_enabled false
        option speed_limit_up 20
index bb5e52a..fc8fe9a 100644 (file)
@@ -1,11 +1,11 @@
 #!/bin/sh /etc/rc.common
 #!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
 
 START=99
 
 START=99
-BIN=/usr/bin/transmission-daemon
-SSD=start-stop-daemon
 
 LIST_SEP="
 "
 
 LIST_SEP="
 "
+
 append_params() {
        local p; local v; local s="$1"; shift
        for p in $*; do
 append_params() {
        local p; local v; local s="$1"; shift
        for p in $*; do
@@ -13,7 +13,7 @@ append_params() {
                IFS="$LIST_SEP"
                for v in $v; do
                        [ -n "$v" ] && (
                IFS="$LIST_SEP"
                for v in $v; do
                        [ -n "$v" ] && (
-                               echo "\""$p"\": "$v"," | sed -e 's|_|-|g' >> $config_dir/settings.json
+                               echo "\""$p"\": "$v"," | sed -e 's|_|-|g' >> $config_file
                        )
                done
                unset IFS
                        )
                done
                unset IFS
@@ -27,42 +27,52 @@ append_params_quotes() {
                IFS="$LIST_SEP"
                for v in $v; do
                        [ -n "$v" ] && (
                IFS="$LIST_SEP"
                for v in $v; do
                        [ -n "$v" ] && (
-                               echo -n "\""$p | sed -e 's|/|\\/|g;s|_|-|g' >> $config_dir/settings.json; \
-                               echo "\": \""$v"\"," >> $config_dir/settings.json
+                               echo -n "\""$p | sed -e 's|/|\\/|g;s|_|-|g' >> $config_file; \
+                               echo "\": \""$v"\"," >> $config_file
                        )
                done
                unset IFS
        done
 }
 
                        )
                done
                unset IFS
        done
 }
 
-start_service() {
+section_enabled() {
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ]
+}
+
+start_instance() {
        local s="$1"
        local s="$1"
-       local enable=0
-       local enabled=0
-       local run_as_usr='root'
+       local user
        local open_file_limit=0
        local open_file_limit=0
-       local ulimit_files=`ulimit -n`
+       local ulimit_files=$(ulimit -n)
+
+       section_enabled "$section" || return 1
 
 
-       # disabled?
-       config_get_bool enable "$s" enable 0 # compatibility with prev version
-       config_get_bool enabled "$s" enabled 0
-       [ "$enabled" == 0 -a "$enable" == 0 ] && return 0
-       config_get config_dir "$s" config_dir '/tmp/transmission'
-       mkdir -p "$config_dir"
-       config_get run_as_usr "$s" run_daemon_as_user 'root'
+       config_get config_dir "$s" 'config_dir' '/var/etc/transmission'
+       config_get user "$s" 'user'
 
 
-       echo "{" > $config_dir/settings.json
+       config_file="$config_dir/settings.json"
+       [ -d $config_dir ] || {
+               mkdir -m 0755 -p "$config_dir"
+               touch $config_file
+               [ -z "$user" ] || chown -R $user $config_dir
+       }
+
+       echo "{" > $config_file
 
        append_params "$s" \
                alt_speed_down alt_speed_enabled alt_speed_time_begin alt_speed_time_day \
                alt_speed_time_enabled alt_speed_time_end alt_speed_up blocklist_enabled \
 
        append_params "$s" \
                alt_speed_down alt_speed_enabled alt_speed_time_begin alt_speed_time_day \
                alt_speed_time_enabled alt_speed_time_end alt_speed_up blocklist_enabled \
-               cache_size_mb dht_enabled encryption idle_seeding_limit idle_seeding_limit_enabled \
+               cache_size_mb download_queue_enabled download_queue_size \
+               dht_enabled encryption idle_seeding_limit idle_seeding_limit_enabled \
                incomplete_dir_enabled lazy_bitfield_enabled lpd_enabled message_level \
                open_file_limit peer_limit_global peer_limit_per_torrent peer_port \
                peer_port_random_high peer_port_random_low peer_port_random_on_start \
                incomplete_dir_enabled lazy_bitfield_enabled lpd_enabled message_level \
                open_file_limit peer_limit_global peer_limit_per_torrent peer_port \
                peer_port_random_high peer_port_random_low peer_port_random_on_start \
-               peer_socket_tos pex_enabled port_forwarding_enabled preallocation prefetch_enabled \
+               pex_enabled port_forwarding_enabled preallocation prefetch_enabled \
                ratio_limit ratio_limit_enabled rename_partial_files rpc_authentication_required \
                ratio_limit ratio_limit_enabled rename_partial_files rpc_authentication_required \
-               rpc_enabled rpc_port rpc_whitelist_enabled script_torrent_done_enabled \
+               rpc_enabled rpc_port rpc_whitelist_enabled queue_stalled_enabled \
+               queue_stalled_minutes scrape_paused_torrents_enabled script_torrent_done_enabled \
+               seed_queue_enabled seed_queue_size \
                speed_limit_down speed_limit_down_enabled speed_limit_up \
                speed_limit_up_enabled start_added_torrents trash_original_torrent_files \
                umask upload_slots_per_torrent utp_enabled scrape_paused_torrents \
                speed_limit_down speed_limit_down_enabled speed_limit_up \
                speed_limit_up_enabled start_added_torrents trash_original_torrent_files \
                umask upload_slots_per_torrent utp_enabled scrape_paused_torrents \
@@ -70,33 +80,41 @@ start_service() {
 
        append_params_quotes "$s" \
                blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \
 
        append_params_quotes "$s" \
                blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \
-               peer_congestion_algorithm rpc_bind_address rpc_password rpc_url \
+               peer_congestion_algorithm peer_socket_tos rpc_bind_address rpc_password rpc_url \
                rpc_username rpc_whitelist script_torrent_done_filename watch_dir
 
                rpc_username rpc_whitelist script_torrent_done_filename watch_dir
 
-       echo "\""invalid-key"\": false" >> $config_dir/settings.json
-       echo "}" >> $config_dir/settings.json
-
-       chown -R $run_as_usr $config_dir
+       echo "\""invalid-key"\": false" >> $config_file
+       echo "}" >> $config_file
 
 
-       config_get open_file_limit "$s" open_file_limit 32
-       let open_limit_files="$open_file_limit + 8"
+       config_get open_file_limit "$s" 'open_file_limit' 32
+       open_limit_files=$(($open_file_limit + 8))
 
        if [ ${open_file_limit} -gt ${ulimit_files} ]; then
                ulimit -n $open_limit_files
        fi
 
 
        if [ ${open_file_limit} -gt ${ulimit_files} ]; then
                ulimit -n $open_limit_files
        fi
 
-       eval "$SSD -c $run_as_usr -q -b -x $BIN -S -- -g $config_dir"
+       SERVICE_UID="$user" \
+       service_start /usr/bin/transmission-daemon -g $config_dir
 }
 
 }
 
-start() {
-       config_load transmission
-       config_foreach start_service transmission
+stop_instance() {
+       local s="$1"
+       local user
+
+       section_enabled "$section" || return 1
+
+       config_get user "$s" 'user'
+
+       SERVICE_UID="$user" \
+       service_stop /usr/bin/transmission-daemon
 }
 
 }
 
-stop() {
-       service_kill $(basename $BIN)
+start() {
+       config_load 'transmission'
+       config_foreach start_instance 'transmission'
 }
 
 }
 
-restart() {
-       stop; sleep 5; start
+stop() {
+       config_load 'transmission'
+       config_foreach stop_instance 'transmission'
 }
 }
diff --git a/net/transmission/patches/010-opt_scrape_paused.patch b/net/transmission/patches/010-opt_scrape_paused.patch
deleted file mode 100644 (file)
index 266a305..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-Index: transmission-2.31/libtransmission/announcer.c
-===================================================================
---- transmission-2.31.orig/libtransmission/announcer.c 2011-05-23 13:34:54.000000000 +0200
-+++ transmission-2.31/libtransmission/announcer.c      2011-05-23 13:48:03.000000000 +0200
-@@ -1433,11 +1433,13 @@
-     tor = NULL;
-     while(( tor = tr_torrentNext( announcer->session, tor ))) {
-         struct tr_torrent_tiers * tt = tor->tiers;
-+      const bool paused = !tor->isRunning;
-+      const bool scrapePaused = tr_sessionGetScrapePaused( announcer->session );
-         for( i=0; tt && i<tt->tier_count; ++i ) {
-             tr_tier * tier = &tt->tiers[i];
-             if( tierNeedsToAnnounce( tier, now ) )
-                 tr_ptrArrayAppend( &announceMe, tier );
--            else if( tierNeedsToScrape( tier, now ) )
-+            else if( tierNeedsToScrape( tier, now ) && ( !paused || scrapePaused ) )
-                 tr_ptrArrayAppend( &scrapeMe, tier );
-         }
-     }
-@@ -1505,6 +1507,7 @@
-     tr_tracker_stat * ret;
-     struct tr_torrent_tiers * tt;
-     const time_t now = tr_time( );
-+    bool scrapePaused;
-     assert( tr_isTorrent( torrent ) );
-     assert( tr_torrentIsLocked( torrent ) );
-@@ -1515,6 +1518,8 @@
-     *setmeTrackerCount = tt->tracker_count;
-     ret = tr_new0( tr_tracker_stat, tt->tracker_count );
-+    scrapePaused = tr_sessionGetScrapePaused( torrent->session );
-+
-     /* populate the stats */
-     for( i=0; i<tt->tier_count; ++i )
-     {
-@@ -1559,7 +1564,7 @@
-                 if( tier->isScraping )
-                     st->scrapeState = TR_TRACKER_ACTIVE;
--                else if( !tier->scrapeAt )
-+                else if( !tier->scrapeAt || ( !torrent->isRunning && !scrapePaused ) )
-                     st->scrapeState = TR_TRACKER_INACTIVE;
-                 else if( tier->scrapeAt > now )
-                 {
-Index: transmission-2.31/libtransmission/session.c
-===================================================================
---- transmission-2.31.orig/libtransmission/session.c   2011-05-23 13:41:05.000000000 +0200
-+++ transmission-2.31/libtransmission/session.c        2011-05-23 13:50:23.000000000 +0200
-@@ -359,6 +359,7 @@
-     tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4,        TR_DEFAULT_BIND_ADDRESS_IPV4 );
-     tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6,        TR_DEFAULT_BIND_ADDRESS_IPV6 );
-     tr_bencDictAddBool( d, TR_PREFS_KEY_START,                    true );
-+    tr_bencDictAddBool( d, TR_PREFS_KEY_SCRAPE_PAUSED_TORRENTS,   true );
-     tr_bencDictAddBool( d, TR_PREFS_KEY_TRASH_ORIGINAL,           false );
- }
-@@ -424,6 +425,7 @@
-     tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4,        tr_address_to_string( &s->public_ipv4->addr ) );
-     tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6,        tr_address_to_string( &s->public_ipv6->addr ) );
-     tr_bencDictAddBool( d, TR_PREFS_KEY_START,                    !tr_sessionGetPaused( s ) );
-+    tr_bencDictAddBool( d, TR_PREFS_KEY_SCRAPE_PAUSED_TORRENTS,   tr_sessionGetScrapePaused( s ) );
-     tr_bencDictAddBool( d, TR_PREFS_KEY_TRASH_ORIGINAL,           tr_sessionGetDeleteSource( s ) );
- }
-@@ -776,6 +778,8 @@
-         tr_blocklistSetURL( session, str );
-     if( tr_bencDictFindBool( settings, TR_PREFS_KEY_START, &boolVal ) )
-         tr_sessionSetPaused( session, !boolVal );
-+    if( tr_bencDictFindBool( settings, TR_PREFS_KEY_SCRAPE_PAUSED_TORRENTS, &boolVal ) )
-+        tr_sessionSetScrapePaused( session, boolVal );
-     if( tr_bencDictFindBool( settings, TR_PREFS_KEY_TRASH_ORIGINAL, &boolVal) )
-         tr_sessionSetDeleteSource( session, boolVal );
-@@ -1636,6 +1640,22 @@
- }
- void
-+tr_sessionSetScrapePaused( tr_session * session, bool enable )
-+{
-+    assert( tr_isSession( session ) );
-+
-+    session->scrapePausedTorrents = enable;
-+}
-+
-+bool
-+tr_sessionGetScrapePaused( const tr_session * session )
-+{
-+    assert( tr_isSession( session ) );
-+
-+    return session->scrapePausedTorrents;
-+}
-+
-+void
- tr_sessionSetDeleteSource( tr_session * session, bool deleteSource )
- {
-     assert( tr_isSession( session ) );
-Index: transmission-2.31/libtransmission/session.h
-===================================================================
---- transmission-2.31.orig/libtransmission/session.h   2011-05-23 13:45:30.000000000 +0200
-+++ transmission-2.31/libtransmission/session.h        2011-05-23 13:46:12.000000000 +0200
-@@ -106,6 +106,7 @@
-     bool                         isIdleLimited;
-     bool                         isIncompleteDirEnabled;
-     bool                         pauseAddedTorrent;
-+    bool                         scrapePausedTorrents;
-     bool                         deleteSourceTorrent;
-     tr_benc                      removedTorrents;
-Index: transmission-2.31/libtransmission/transmission.h
-===================================================================
---- transmission-2.31.orig/libtransmission/transmission.h      2011-05-23 13:48:11.000000000 +0200
-+++ transmission-2.31/libtransmission/transmission.h   2011-05-23 13:49:15.000000000 +0200
-@@ -213,6 +213,7 @@
- #define TR_PREFS_KEY_UMASK                        "umask"
- #define TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT     "upload-slots-per-torrent"
- #define TR_PREFS_KEY_START                        "start-added-torrents"
-+#define TR_PREFS_KEY_SCRAPE_PAUSED_TORRENTS       "scrape-paused-torrents"
- #define TR_PREFS_KEY_TRASH_ORIGINAL               "trash-original-torrent-files"
-@@ -731,6 +732,9 @@
- void       tr_sessionSetPaused        ( tr_session *, bool isPaused );
- bool       tr_sessionGetPaused        ( const tr_session * );
-+void       tr_sessionSetScrapePaused  ( tr_session *, bool enable );
-+bool       tr_sessionGetScrapePaused  ( const tr_session * );
-+
- void       tr_sessionSetDeleteSource  ( tr_session *, bool deleteSource );
- bool       tr_sessionGetDeleteSource  ( const tr_session * );