Skip to content

Commit

Permalink
rutorrent: upgrade 3.10 => 4.1.5 (#5617)
Browse files Browse the repository at this point in the history
* Upgrade rutorrent 3.10 => 4.1.5
* Migrate to python 3.11
* Upgrade cloudscraper 1.2.58 => 1.2.71
  • Loading branch information
smaarn authored May 24, 2023
1 parent 3ad22db commit 0590cb5
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cross/rutorrent/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PKG_NAME = ruTorrent
PKG_VERS = 3.10
PKG_VERS = 4.1.5
PKG_EXT = tar.gz
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/Novik/ruTorrent/archive
PKG_DIST_SITE = https://github.com/Novik/ruTorrent/archive/refs/tags
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

Expand Down
6 changes: 3 additions & 3 deletions cross/rutorrent/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ruTorrent-3.10.tar.gz SHA1 d797fa58a54061e73e71ebdaff671efd6cf823fc
ruTorrent-3.10.tar.gz SHA256 dac1e3e0079eb475066d6be738b8372596fa382b074792db5ecab31bce6cfa6d
ruTorrent-3.10.tar.gz MD5 632964bab3ce949abb1fb9ce8d0fba31
ruTorrent-4.1.5.tar.gz SHA1 1e5ef5c381a218a40ce373c968432c7a3e581684
ruTorrent-4.1.5.tar.gz SHA256 b84da2c9169444aa50b438ce2fdb0ce81f7bbcdd3e3138b3cc215dd27c58b2bf
ruTorrent-4.1.5.tar.gz MD5 19e906f37be308ee7c9030ad6091c64f
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Subject: [PATCH] Change default localHostedMode
---
Index: conf/config.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/conf/config.php b/conf/config.php
--- conf/config.php.orig (revision 48933089370b667e8d3b19fb8f9b92bc6db5409d)
+++ conf/config.php (date 1683473924000)
@@ -63,7 +63,7 @@
"mediainfo" => '', // Something like /usr/bin/mediainfo. If empty, will be found in PATH
);

- $localHostedMode = false; // Set to true if rTorrent is hosted on the SAME machine as ruTorrent
+ $localHostedMode = true; // Set to false if rTorrent is NOT hosted on the SAME machine as ruTorrent

$cachedPluginLoading = false; // Set to true to enable rapid cached loading of ruTorrent plugins
// Required to clear web browser cache when upgrading versions
12 changes: 4 additions & 8 deletions spk/rutorrent/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
SPK_NAME = rutorrent
SPK_VERS = 3.10
SPK_REV = 14
SPK_VERS = 4.1.5
SPK_REV = 15
SPK_ICON = src/rutorrent.png
DSM_UI_DIR = app

SPK_DEPENDS = "WebStation:python310:PHP7.4:Apache2.4"
SPK_DEPENDS = "WebStation:python311:PHP7.4:Apache2.4"
WHEELS = src/requirements-pure.txt

DEPENDS = cross/busybox cross/curl cross/mediainfo cross/rtorrent cross/rutorrent cross/screen cross/unzip
Expand All @@ -27,7 +27,7 @@ DESCRIPTION = ruTorrent is a front-end for the popular Bittorrent client rTorren
ADMIN_URL = /rutorrent/
STARTABLE = yes
DISPLAY_NAME = ruTorrent
CHANGELOG = "<ol><li>Remove outdated resources</li><li>Fix missing dependency declaration on Apache 2.4</li><li>Fixed invalid handling of volume customization upon installation</li><li>Fix handling of watch directory by creating it if it does not exist.</li></ol>"
CHANGELOG = "<ol><li>Upgrade rutorrent to 4.1.5</li><li>Update to Python 3.11</li><li>Update to PHP 7.4</li><li>Remove tools from procps-ng</li><li>Fix support of DSM 7.</li><li>Fix torrent creation wizard (\#5288)</li><li>Add service port declarations</li></ol>"

HOMEPAGE = https://github.com/Novik/ruTorrent
LICENSE = GPLv3
Expand All @@ -46,10 +46,6 @@ CONF_DIR = src/conf/
WIZARDS_DIR = $(WORK_DIR)/generated-wizards
WIZARDS = install_uifile upgrade_uifile

INSTALL_DEP_SERVICES = apache-web
START_DEP_SERVICES = apache-web
INSTUNINST_RESTART_SERVICES = apache-web

POST_STRIP_TARGET = rutorrent_extra_install

ENV += BUSYBOX_CONFIG="$(BUSYBOX_CONFIG)"
Expand Down
2 changes: 1 addition & 1 deletion spk/rutorrent/src/requirements-pure.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cloudscraper==1.2.58
cloudscraper==1.2.71
56 changes: 51 additions & 5 deletions spk/rutorrent/src/service-setup.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Package
PACKAGE="rutorrent"

# Define python310 binary path
PYTHON_DIR="/var/packages/python310/target/bin"
# Add local bin, virtualenv along with python310 to the default PATH
# Define python311 binary path
PYTHON_DIR="/var/packages/python311/target/bin"
# Add local bin, virtualenv along with python311 to the default PATH
PATH="${SYNOPKG_PKGDEST}/env/bin:${SYNOPKG_PKGDEST}/bin:${SYNOPKG_PKGDEST}/usr/bin:${PYTHON_DIR}:${PATH}"
# Others
DSM6_WEB_DIR="/var/services/web"
Expand Down Expand Up @@ -202,14 +202,37 @@ service_save ()
if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -ge 7 ] && [ ! -f "${SYNOPKG_PKGVAR}/.dsm7_migrated" ]; then
source_directory="${DSM6_WEB_DIR}/${PACKAGE}"
fi
local ruTorrentConfigFile="${source_directory}/conf/config.php"

# Revision 8 introduces backward incompatible changes
if [ `echo "${SYNOPKG_OLD_PKGVER}" | sed -r "s/^.*-([0-9]+)$/\1/"` -le 8 ]; then
sed -i -e "s|http_cacert = .*|http_cacert = /etc/ssl/certs/ca-certificates.crt|g" ${RTORRENT_RC}
fi

# Revision 15 introduces backward incompatible changes in the configuration
if [ `echo "${SYNOPKG_OLD_PKGVER}" | sed -r "s/^.*-([0-9]+)$/\1/"` -lt 15 ]; then
sed -i -E -e "s/@define\(\s*'HTTP_USER_AGENT'\s*,\s*'(.*)'\s*(,\s*(true|false)\s*)?\)/\$httpUserAgent = '\\1'/g" \
-e "s/@define\(\s*'HTTP_TIME_OUT'\s*,\s*([0-9]*)\s*(,\s*(true|false)\s*)?\)/\$httpTimeOut = \\1/g" \
-e "s/@define\(\s*'HTTP_USE_GZIP'\s*,\s*(true|false)\s*(,\s*(true|false)\s*)?\)/\$httpUseGzip = \\1/g" \
-e "s/@define\(\s*'RPC_TIME_OUT'\s*,\s*([0-9]*)\s*(,\s*(true|false)\s*)?\)/\$rpcTimeOut = \\1/g" \
-e "s/@define\(\s*'LOG_RPC_CALLS'\s*,\s*(true|false)\s*(,\s*(true|false)\s*)?\)/\$rpcLogCalls = \\1/g" \
-e "s/@define\(\s*'LOG_RPC_FAULTS'\s*,\s*(true|false)\s*(,\s*(true|false)\s*)?\)/\$rpcLogFaults = \\1/g" \
-e "s/@define\(\s*'PHP_USE_GZIP'\s*,\s*(true|false)\s*(,\s*(true|false)\s*)?\)/\$phpUseGzip = \\1/g" \
-e "s/@define\(\s*'PHP_GZIP_LEVEL'\s*,\s*([0-9]*)\s*(,\s*(true|false)\s*)?\)/\$phpGzipLevel = \\1/g" \
-e "s|\\\$profilePath(\s*)=(\s*)'\\.\\./share'|\\\$profilePath\\1=\\2'../../share'|g" \
"${ruTorrentConfigFile}"
echo ' $throttleMaxSpeed = 327625*1024; // DO NOT EDIT THIS LINE!!! DO NOT COMMENT THIS LINE!!!' >> "${ruTorrentConfigFile}"
echo " // Can't be greater then 327625*1024 due to limitation in libtorrent ResourceManager::set_max_upload_unchoked function." >> "${ruTorrentConfigFile}"
echo " \$al_diagnostic = true; // Diagnose auto-loader. Set to \"false\" to make composer plugins work." >> "${ruTorrentConfigFile}"
echo " \$localHostedMode = true; // Set to false if rTorrent is NOT hosted on the SAME machine as ruTorrent" >> "${ruTorrentConfigFile}"
echo " \$cachedPluginLoading = false; // Set to true to enable rapid cached loading of ruTorrent plugins" >> "${ruTorrentConfigFile}"
echo " \$enableCSRFCheck = false; // If true then Origin and Referer will be checked" >> "${ruTorrentConfigFile}"
echo " \$enabledOrigins = array(); // List of enabled domains for CSRF check (only hostnames, without protocols, port etc.)." >> "${ruTorrentConfigFile}"
echo " // If empty, then will retrieve domain from HTTP_HOST / HTTP_X_FORWARDED_HOST" >> "${ruTorrentConfigFile}"
fi

# Save the configuration file
cp -ap -t "${TMP_DIR}" "${source_directory}/conf/config.php"
cp -ap -t "${TMP_DIR}" "${ruTorrentConfigFile}"
if [ -f "${source_directory}/.htaccess" ]; then
cp -ap -t "${TMP_DIR}" "${source_directory}/.htaccess"
fi
Expand Down Expand Up @@ -242,6 +265,29 @@ is_not_defined_external_program()
return $?
}

is_not_defined_variable()
{
local variable_name="$1"
php -r "require_once('${RUTORRENT_WEB_DIR}/conf/config.php'); if (isset(\$${variable_name})) { exit(1); } else { exit(0); }"
return $?
}

define_variable()
{
local variable_name="$1"
shift
local value="$1"
shift
local comment="$1"
shift
echo "\$${variable_name} = ${value}; // ${comment}" \
>> "${RUTORRENT_WEB_DIR}/conf/config.php"
while [ "$#" -ne 0 ]; do
echo "// $1" >> "${RUTORRENT_WEB_DIR}/conf/config.php"
shift
done
}

define_external_program()
{
program=$1
Expand Down Expand Up @@ -337,7 +383,7 @@ service_restore ()
if is_not_defined_external_program 'php'; then
define_external_program 'php' '/bin/php' '/usr/bin/php'
fi

if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -ge 7 -a ! -f "${SYNOPKG_PKGVAR}/.dsm7_migrated" ]; then
touch "${SYNOPKG_PKGVAR}/.dsm7_migrated"
fi
Expand Down

0 comments on commit 0590cb5

Please sign in to comment.