Skip to content

Instantly share code, notes, and snippets.

@liut
Last active October 19, 2021 16:28
Show Gist options
  • Save liut/f137f15493876692b6e63a1c0e8befb3 to your computer and use it in GitHub Desktop.
Save liut/f137f15493876692b6e63a1c0e8befb3 to your computer and use it in GitHub Desktop.
build transmission in CentOS 7 with docker
FROM centos:7 as builder
WORKDIR app
RUN yum -y install epel-release
ENV PATH=/opt/rh/devtoolset-7/root/usr/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
RUN yum makecache && yum -y install centos-release-scl scl-utils \
&& yum -y install devtoolset-7-runtime devtoolset-7-gcc devtoolset-7-gcc-c++ \
&& ls -al /etc/scl/ /etc/scl/* \
&& scl enable devtoolset-7 bash \
&& gcc --version \
&& yum -y install cmake m4 make automake libtool gettext openssl-devel systemd-devel \
libcurl-devel libevent-devel libnatpmp-devel miniupnpc-devel zlib-devel git \
&& rm -rf /var/lib/yum/history/*
# get source from github.com/transmission
ADD transmission /app
RUN rm -rf build && mkdir build && cd build && cmake .. \
&& pwd && ls -al . daemon \
&& make depend \
&& make transmission-daemon transmission-create transmission-edit transmission-remote transmission-show \
&& ls -al . daemon utils \
&& mkdir -p /app/bin \
&& install daemon/transmission-daemon /app/bin/ \
&& install utils/transmission-create /app/bin/ \
&& install utils/transmission-edit /app/bin/ \
&& install utils/transmission-show /app/bin/ \
&& install utils/transmission-remote /app/bin/
diff --git a/libtransmission/verify.c b/libtransmission/verify.c
index 8dcc4cd04..273694b1e 100644
--- a/libtransmission/verify.c
+++ b/libtransmission/verify.c
@@ -49,7 +49,7 @@ static bool verifyTorrent(tr_torrent* tor, bool* stopFlag)
sha = tr_sha1_init();
- tr_logAddTorInfo(tor, "%s", "verifying torrent...");
+ tr_logAddTorInfo(tor, "Verifying torrent: ps %d, blocks %d * %d", tor->info.pieceSize, tor->blockSize, tor->blockCount);
tr_torrentSetChecked(tor, 0);
while (!*stopFlag && pieceIndex < tor->info.pieceCount)
@@ -110,11 +110,17 @@ static bool verifyTorrent(tr_torrent* tor, bool* stopFlag)
tr_sha1_final(sha, hash);
hasPiece = memcmp(hash, tor->info.pieces[pieceIndex].hash, SHA_DIGEST_LENGTH) == 0;
+ time_t markerPos = tr_time();
if (hasPiece || hadPiece)
{
tr_torrentSetHasPiece(tor, pieceIndex, hasPiece);
changed |= hasPiece != hadPiece;
}
+ uint64_t elapsed = tr_time() - markerPos;
+ if (elapsed > 1)
+ {
+ tr_logAddTorDbg(tor, "Verifying set has piece #%03d (file #%d) took %d seconds", pieceIndex, fileIndex, (int)elapsed);
+ }
tr_torrentSetPieceChecked(tor, pieceIndex);
now = tr_time();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment