[arch-commits] Commit in hefur/repos (12 files)
Thomas Bächler
thomas at archlinux.org
Fri Nov 30 21:59:44 UTC 2012
Date: Friday, November 30, 2012 @ 16:59:44
Author: thomas
Revision: 172176
archrelease: copy trunk to extra-i686, extra-x86_64
Added:
hefur/repos/extra-i686/Check-that-added-torrents-from-the-disk-are-still-on.patch
(from rev 172175, hefur/trunk/Check-that-added-torrents-from-the-disk-are-still-on.patch)
hefur/repos/extra-i686/PKGBUILD
(from rev 172175, hefur/trunk/PKGBUILD)
hefur/repos/extra-i686/Replace-by-amp-in-stat.html.patch
(from rev 172175, hefur/trunk/Replace-by-amp-in-stat.html.patch)
hefur/repos/extra-i686/hefurd.service
(from rev 172175, hefur/trunk/hefurd.service)
hefur/repos/extra-x86_64/Check-that-added-torrents-from-the-disk-are-still-on.patch
(from rev 172175, hefur/trunk/Check-that-added-torrents-from-the-disk-are-still-on.patch)
hefur/repos/extra-x86_64/PKGBUILD
(from rev 172175, hefur/trunk/PKGBUILD)
hefur/repos/extra-x86_64/Replace-by-amp-in-stat.html.patch
(from rev 172175, hefur/trunk/Replace-by-amp-in-stat.html.patch)
hefur/repos/extra-x86_64/hefurd.service
(from rev 172175, hefur/trunk/hefurd.service)
Deleted:
hefur/repos/extra-i686/PKGBUILD
hefur/repos/extra-i686/hefurd.service
hefur/repos/extra-x86_64/PKGBUILD
hefur/repos/extra-x86_64/hefurd.service
-------------------------------------------------------------------------+
extra-i686/Check-that-added-torrents-from-the-disk-are-still-on.patch | 93 ++++++++++
extra-i686/PKGBUILD | 72 ++++---
extra-i686/Replace-by-amp-in-stat.html.patch | 27 ++
extra-i686/hefurd.service | 23 +-
extra-x86_64/Check-that-added-torrents-from-the-disk-are-still-on.patch | 93 ++++++++++
extra-x86_64/PKGBUILD | 72 ++++---
extra-x86_64/Replace-by-amp-in-stat.html.patch | 27 ++
extra-x86_64/hefurd.service | 23 +-
8 files changed, 342 insertions(+), 88 deletions(-)
Copied: hefur/repos/extra-i686/Check-that-added-torrents-from-the-disk-are-still-on.patch (from rev 172175, hefur/trunk/Check-that-added-torrents-from-the-disk-are-still-on.patch)
===================================================================
--- extra-i686/Check-that-added-torrents-from-the-disk-are-still-on.patch (rev 0)
+++ extra-i686/Check-that-added-torrents-from-the-disk-are-still-on.patch 2012-11-30 21:59:44 UTC (rev 172176)
@@ -0,0 +1,93 @@
+From dbd00cfc3805b6f1ff794f7de0b52b1a7893401f Mon Sep 17 00:00:00 2001
+From: Alexandre Bique <bique.alexandre at gmail.com>
+Date: Thu, 15 Nov 2012 20:43:41 +0100
+Subject: [PATCH 07/12] Check that added torrents from the disk are still on
+ the disk.
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+---
+ hefur/fs-tree-white-list.cc | 20 ++++++++++++++++++++
+ hefur/fs-tree-white-list.hh | 1 +
+ hefur/torrent-db.hh | 4 +++-
+ 3 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/hefur/fs-tree-white-list.cc b/hefur/fs-tree-white-list.cc
+index f493e95..61714d0 100644
+--- a/hefur/fs-tree-white-list.cc
++++ b/hefur/fs-tree-white-list.cc
+@@ -54,10 +54,30 @@ namespace hefur
+ }
+
+ void
++ FsTreeWhiteList::check()
++ {
++ std::vector<m::StringRef> keys;
++ auto db = Hefur::instance().torrentDb();
++ m::SharedMutex::Locker locker(db->torrents_lock_);
++ db->torrents_.foreach([this, &keys] (Torrent::Ptr torrent) {
++ if (::strncmp(torrent->path().c_str(), root_.c_str(), root_.size()))
++ return;
++
++ struct ::stat st;
++ if (::stat(torrent->path().c_str(), &st) && errno == ENOENT)
++ keys.push_back(torrent->key());
++ });
++
++ for (auto it = keys.begin(); it != keys.end(); ++it)
++ db->torrents_.erase(*it);
++ }
++
++ void
+ FsTreeWhiteList::loopScan()
+ {
+ do {
+ scan();
++ check();
+ } while (!stop_.timedWait(m::time() + rescan_interval_));
+ }
+ }
+diff --git a/hefur/fs-tree-white-list.hh b/hefur/fs-tree-white-list.hh
+index c32bcd4..643fb78 100644
+--- a/hefur/fs-tree-white-list.hh
++++ b/hefur/fs-tree-white-list.hh
+@@ -30,6 +30,7 @@ namespace hefur
+ * When a .torrent is found, call TorrentDb::addTorrent().
+ */
+ void scan();
++ void check();
+
+ private:
+ /**
+diff --git a/hefur/torrent-db.hh b/hefur/torrent-db.hh
+index a1e5d38..e25ed33 100644
+--- a/hefur/torrent-db.hh
++++ b/hefur/torrent-db.hh
+@@ -17,6 +17,7 @@ namespace hefur
+ {
+ class StatHandler;
+ class PeersHandler;
++ class FsTreeWhiteList;
+
+ /**
+ * This is the "in memory" torrent database.
+@@ -63,6 +64,7 @@ namespace hefur
+ friend class StatHandler;
+ friend class PeersHandler;
+ friend class FileHandler;
++ friend class FsTreeWhiteList;
+
+ /** helper to use torrent->key() as a key for the trie */
+ static inline m::StringRef torrentKey(Torrent::Ptr torrent) {
+@@ -77,7 +79,7 @@ namespace hefur
+ m::Future<bool> cleanup_stop_;
+ m::Thread cleanup_thread_;
+ m::SharedMutex torrents_lock_;
+- torrents_type torrents_;
++ torrents_type torrents_;
+ };
+ }
+
+--
+1.8.0.1
+
Deleted: extra-i686/PKGBUILD
===================================================================
--- extra-i686/PKGBUILD 2012-11-30 21:59:17 UTC (rev 172175)
+++ extra-i686/PKGBUILD 2012-11-30 21:59:44 UTC (rev 172176)
@@ -1,33 +0,0 @@
-# $Id$
-# Maintainer: Pierre Schmitz <pierre at archlinux.de>
-# Contributor: Alexandre Bique <bique.alexandre at gmail.com>
-
-pkgname=hefur
-pkgver=0.3
-pkgrel=3
-pkgdesc='A standalone and lightweight BitTorrent tracker'
-arch=('i686' 'x86_64')
-url='http://github.com/abique/hefur'
-license=('MIT')
-makedepends=('cmake')
-depends=('gnutls' 'xz')
-source=("https://github.com/downloads/abique/${pkgname}/${pkgname}-${pkgver}.tar.xz"
- 'hefurd.service')
-md5sums=('446ca4e659ce0ca3c8f32b0990ee7f5f'
- 'fec6d1a7a96bd6c5605d5316fec4fc2f')
-
-build() {
- cd ${srcdir}/${pkgname}-${pkgver}
- mkdir build
- cd build
- cmake -DCMAKE_INSTALL_PREFIX=/usr ..
- make
-}
-
-package() {
- cd ${srcdir}/${pkgname}-${pkgver}/build
- DESTDIR=${pkgdir} make install
- install -D -m644 ${srcdir}/hefurd.service ${pkgdir}/usr/lib/systemd/system/hefurd.service
- install -D -m644 ${srcdir}/${pkgname}-${pkgver}/LICENSE ${pkgdir}/usr/share/licenses/hefur/LICENSE
- install -d -m755 ${pkgdir}/var/lib/hefurd
-}
Copied: hefur/repos/extra-i686/PKGBUILD (from rev 172175, hefur/trunk/PKGBUILD)
===================================================================
--- extra-i686/PKGBUILD (rev 0)
+++ extra-i686/PKGBUILD 2012-11-30 21:59:44 UTC (rev 172176)
@@ -0,0 +1,39 @@
+# $Id$
+# Maintainer: Pierre Schmitz <pierre at archlinux.de>
+# Contributor: Alexandre Bique <bique.alexandre at gmail.com>
+
+pkgname=hefur
+pkgver=0.3
+pkgrel=4
+pkgdesc='A standalone and lightweight BitTorrent tracker'
+arch=('i686' 'x86_64')
+url='http://github.com/abique/hefur'
+license=('MIT')
+makedepends=('cmake')
+depends=('gnutls' 'xz')
+source=("https://github.com/downloads/abique/${pkgname}/${pkgname}-${pkgver}.tar.xz"
+ 'hefurd.service'
+ 'Check-that-added-torrents-from-the-disk-are-still-on.patch'
+ 'Replace-by-amp-in-stat.html.patch')
+md5sums=('446ca4e659ce0ca3c8f32b0990ee7f5f'
+ '731d5be04d74a52541450b5127abeff3'
+ 'f912a75467a30251403923c0a7abe049'
+ 'f11af93e9a8074c8ba73f7a47e978362')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ patch -p1 -i ${srcdir}/Check-that-added-torrents-from-the-disk-are-still-on.patch
+ patch -p1 -i ${srcdir}/Replace-by-amp-in-stat.html.patch
+ mkdir build
+ cd build
+ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
+ make
+}
+
+package() {
+ cd ${srcdir}/${pkgname}-${pkgver}/build
+ DESTDIR=${pkgdir} make install
+ install -D -m644 ${srcdir}/hefurd.service ${pkgdir}/usr/lib/systemd/system/hefurd.service
+ install -D -m644 ${srcdir}/${pkgname}-${pkgver}/LICENSE ${pkgdir}/usr/share/licenses/hefur/LICENSE
+ install -d -m755 ${pkgdir}/var/lib/hefurd
+}
Copied: hefur/repos/extra-i686/Replace-by-amp-in-stat.html.patch (from rev 172175, hefur/trunk/Replace-by-amp-in-stat.html.patch)
===================================================================
--- extra-i686/Replace-by-amp-in-stat.html.patch (rev 0)
+++ extra-i686/Replace-by-amp-in-stat.html.patch 2012-11-30 21:59:44 UTC (rev 172176)
@@ -0,0 +1,27 @@
+From 6986df22d293b7a149f51d4d8ba4a995645a4560 Mon Sep 17 00:00:00 2001
+From: Alexandre Bique <bique.alexandre at gmail.com>
+Date: Sun, 4 Nov 2012 14:08:47 +0100
+Subject: [PATCH 03/12] Replace & by & in stat.html.
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+---
+ www/tpl/stat.html | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/www/tpl/stat.html b/www/tpl/stat.html
+index 3234679..1e3b148 100644
+--- a/www/tpl/stat.html
++++ b/www/tpl/stat.html
+@@ -21,7 +21,7 @@
+ {{*torrents}}
+ <tr>
+ <td>
+- <a href="magnet:?xt=urn:btih:{{info_sha1|b16}}&dn={{name|u}}&tr={{tracker_udp|u}}&tr={{tracker_http|u}}"
++ <a href="magnet:?xt=urn:btih:{{info_sha1|b16}}&dn={{name|u}}&tr={{tracker_udp|u}}&tr={{tracker_http|u}}"
+ title="Magnet link">
+ <img src="/img/magnet-icon.gif"/>
+ </a>
+--
+1.8.0.1
+
Deleted: extra-i686/hefurd.service
===================================================================
--- extra-i686/hefurd.service 2012-11-30 21:59:17 UTC (rev 172175)
+++ extra-i686/hefurd.service 2012-11-30 21:59:44 UTC (rev 172176)
@@ -1,11 +0,0 @@
-[Unit]
-Description=A standalone and lightweight BitTorrent tracker
-After=network.target
-
-[Service]
-ExecStart=/usr/bin/hefurd -torrent-dir /var/lib/hefurd
-User=nobody
-Group=nobody
-
-[Install]
-WantedBy=multi-user.target
Copied: hefur/repos/extra-i686/hefurd.service (from rev 172175, hefur/trunk/hefurd.service)
===================================================================
--- extra-i686/hefurd.service (rev 0)
+++ extra-i686/hefurd.service 2012-11-30 21:59:44 UTC (rev 172176)
@@ -0,0 +1,12 @@
+[Unit]
+Description=A standalone and lightweight BitTorrent tracker
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/hefurd -torrent-dir /var/lib/hefurd
+User=nobody
+Group=nobody
+CPUSchedulingPolicy=batch
+
+[Install]
+WantedBy=multi-user.target
Copied: hefur/repos/extra-x86_64/Check-that-added-torrents-from-the-disk-are-still-on.patch (from rev 172175, hefur/trunk/Check-that-added-torrents-from-the-disk-are-still-on.patch)
===================================================================
--- extra-x86_64/Check-that-added-torrents-from-the-disk-are-still-on.patch (rev 0)
+++ extra-x86_64/Check-that-added-torrents-from-the-disk-are-still-on.patch 2012-11-30 21:59:44 UTC (rev 172176)
@@ -0,0 +1,93 @@
+From dbd00cfc3805b6f1ff794f7de0b52b1a7893401f Mon Sep 17 00:00:00 2001
+From: Alexandre Bique <bique.alexandre at gmail.com>
+Date: Thu, 15 Nov 2012 20:43:41 +0100
+Subject: [PATCH 07/12] Check that added torrents from the disk are still on
+ the disk.
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+---
+ hefur/fs-tree-white-list.cc | 20 ++++++++++++++++++++
+ hefur/fs-tree-white-list.hh | 1 +
+ hefur/torrent-db.hh | 4 +++-
+ 3 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/hefur/fs-tree-white-list.cc b/hefur/fs-tree-white-list.cc
+index f493e95..61714d0 100644
+--- a/hefur/fs-tree-white-list.cc
++++ b/hefur/fs-tree-white-list.cc
+@@ -54,10 +54,30 @@ namespace hefur
+ }
+
+ void
++ FsTreeWhiteList::check()
++ {
++ std::vector<m::StringRef> keys;
++ auto db = Hefur::instance().torrentDb();
++ m::SharedMutex::Locker locker(db->torrents_lock_);
++ db->torrents_.foreach([this, &keys] (Torrent::Ptr torrent) {
++ if (::strncmp(torrent->path().c_str(), root_.c_str(), root_.size()))
++ return;
++
++ struct ::stat st;
++ if (::stat(torrent->path().c_str(), &st) && errno == ENOENT)
++ keys.push_back(torrent->key());
++ });
++
++ for (auto it = keys.begin(); it != keys.end(); ++it)
++ db->torrents_.erase(*it);
++ }
++
++ void
+ FsTreeWhiteList::loopScan()
+ {
+ do {
+ scan();
++ check();
+ } while (!stop_.timedWait(m::time() + rescan_interval_));
+ }
+ }
+diff --git a/hefur/fs-tree-white-list.hh b/hefur/fs-tree-white-list.hh
+index c32bcd4..643fb78 100644
+--- a/hefur/fs-tree-white-list.hh
++++ b/hefur/fs-tree-white-list.hh
+@@ -30,6 +30,7 @@ namespace hefur
+ * When a .torrent is found, call TorrentDb::addTorrent().
+ */
+ void scan();
++ void check();
+
+ private:
+ /**
+diff --git a/hefur/torrent-db.hh b/hefur/torrent-db.hh
+index a1e5d38..e25ed33 100644
+--- a/hefur/torrent-db.hh
++++ b/hefur/torrent-db.hh
+@@ -17,6 +17,7 @@ namespace hefur
+ {
+ class StatHandler;
+ class PeersHandler;
++ class FsTreeWhiteList;
+
+ /**
+ * This is the "in memory" torrent database.
+@@ -63,6 +64,7 @@ namespace hefur
+ friend class StatHandler;
+ friend class PeersHandler;
+ friend class FileHandler;
++ friend class FsTreeWhiteList;
+
+ /** helper to use torrent->key() as a key for the trie */
+ static inline m::StringRef torrentKey(Torrent::Ptr torrent) {
+@@ -77,7 +79,7 @@ namespace hefur
+ m::Future<bool> cleanup_stop_;
+ m::Thread cleanup_thread_;
+ m::SharedMutex torrents_lock_;
+- torrents_type torrents_;
++ torrents_type torrents_;
+ };
+ }
+
+--
+1.8.0.1
+
Deleted: extra-x86_64/PKGBUILD
===================================================================
--- extra-x86_64/PKGBUILD 2012-11-30 21:59:17 UTC (rev 172175)
+++ extra-x86_64/PKGBUILD 2012-11-30 21:59:44 UTC (rev 172176)
@@ -1,33 +0,0 @@
-# $Id$
-# Maintainer: Pierre Schmitz <pierre at archlinux.de>
-# Contributor: Alexandre Bique <bique.alexandre at gmail.com>
-
-pkgname=hefur
-pkgver=0.3
-pkgrel=3
-pkgdesc='A standalone and lightweight BitTorrent tracker'
-arch=('i686' 'x86_64')
-url='http://github.com/abique/hefur'
-license=('MIT')
-makedepends=('cmake')
-depends=('gnutls' 'xz')
-source=("https://github.com/downloads/abique/${pkgname}/${pkgname}-${pkgver}.tar.xz"
- 'hefurd.service')
-md5sums=('446ca4e659ce0ca3c8f32b0990ee7f5f'
- 'fec6d1a7a96bd6c5605d5316fec4fc2f')
-
-build() {
- cd ${srcdir}/${pkgname}-${pkgver}
- mkdir build
- cd build
- cmake -DCMAKE_INSTALL_PREFIX=/usr ..
- make
-}
-
-package() {
- cd ${srcdir}/${pkgname}-${pkgver}/build
- DESTDIR=${pkgdir} make install
- install -D -m644 ${srcdir}/hefurd.service ${pkgdir}/usr/lib/systemd/system/hefurd.service
- install -D -m644 ${srcdir}/${pkgname}-${pkgver}/LICENSE ${pkgdir}/usr/share/licenses/hefur/LICENSE
- install -d -m755 ${pkgdir}/var/lib/hefurd
-}
Copied: hefur/repos/extra-x86_64/PKGBUILD (from rev 172175, hefur/trunk/PKGBUILD)
===================================================================
--- extra-x86_64/PKGBUILD (rev 0)
+++ extra-x86_64/PKGBUILD 2012-11-30 21:59:44 UTC (rev 172176)
@@ -0,0 +1,39 @@
+# $Id$
+# Maintainer: Pierre Schmitz <pierre at archlinux.de>
+# Contributor: Alexandre Bique <bique.alexandre at gmail.com>
+
+pkgname=hefur
+pkgver=0.3
+pkgrel=4
+pkgdesc='A standalone and lightweight BitTorrent tracker'
+arch=('i686' 'x86_64')
+url='http://github.com/abique/hefur'
+license=('MIT')
+makedepends=('cmake')
+depends=('gnutls' 'xz')
+source=("https://github.com/downloads/abique/${pkgname}/${pkgname}-${pkgver}.tar.xz"
+ 'hefurd.service'
+ 'Check-that-added-torrents-from-the-disk-are-still-on.patch'
+ 'Replace-by-amp-in-stat.html.patch')
+md5sums=('446ca4e659ce0ca3c8f32b0990ee7f5f'
+ '731d5be04d74a52541450b5127abeff3'
+ 'f912a75467a30251403923c0a7abe049'
+ 'f11af93e9a8074c8ba73f7a47e978362')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ patch -p1 -i ${srcdir}/Check-that-added-torrents-from-the-disk-are-still-on.patch
+ patch -p1 -i ${srcdir}/Replace-by-amp-in-stat.html.patch
+ mkdir build
+ cd build
+ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
+ make
+}
+
+package() {
+ cd ${srcdir}/${pkgname}-${pkgver}/build
+ DESTDIR=${pkgdir} make install
+ install -D -m644 ${srcdir}/hefurd.service ${pkgdir}/usr/lib/systemd/system/hefurd.service
+ install -D -m644 ${srcdir}/${pkgname}-${pkgver}/LICENSE ${pkgdir}/usr/share/licenses/hefur/LICENSE
+ install -d -m755 ${pkgdir}/var/lib/hefurd
+}
Copied: hefur/repos/extra-x86_64/Replace-by-amp-in-stat.html.patch (from rev 172175, hefur/trunk/Replace-by-amp-in-stat.html.patch)
===================================================================
--- extra-x86_64/Replace-by-amp-in-stat.html.patch (rev 0)
+++ extra-x86_64/Replace-by-amp-in-stat.html.patch 2012-11-30 21:59:44 UTC (rev 172176)
@@ -0,0 +1,27 @@
+From 6986df22d293b7a149f51d4d8ba4a995645a4560 Mon Sep 17 00:00:00 2001
+From: Alexandre Bique <bique.alexandre at gmail.com>
+Date: Sun, 4 Nov 2012 14:08:47 +0100
+Subject: [PATCH 03/12] Replace & by & in stat.html.
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+---
+ www/tpl/stat.html | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/www/tpl/stat.html b/www/tpl/stat.html
+index 3234679..1e3b148 100644
+--- a/www/tpl/stat.html
++++ b/www/tpl/stat.html
+@@ -21,7 +21,7 @@
+ {{*torrents}}
+ <tr>
+ <td>
+- <a href="magnet:?xt=urn:btih:{{info_sha1|b16}}&dn={{name|u}}&tr={{tracker_udp|u}}&tr={{tracker_http|u}}"
++ <a href="magnet:?xt=urn:btih:{{info_sha1|b16}}&dn={{name|u}}&tr={{tracker_udp|u}}&tr={{tracker_http|u}}"
+ title="Magnet link">
+ <img src="/img/magnet-icon.gif"/>
+ </a>
+--
+1.8.0.1
+
Deleted: extra-x86_64/hefurd.service
===================================================================
--- extra-x86_64/hefurd.service 2012-11-30 21:59:17 UTC (rev 172175)
+++ extra-x86_64/hefurd.service 2012-11-30 21:59:44 UTC (rev 172176)
@@ -1,11 +0,0 @@
-[Unit]
-Description=A standalone and lightweight BitTorrent tracker
-After=network.target
-
-[Service]
-ExecStart=/usr/bin/hefurd -torrent-dir /var/lib/hefurd
-User=nobody
-Group=nobody
-
-[Install]
-WantedBy=multi-user.target
Copied: hefur/repos/extra-x86_64/hefurd.service (from rev 172175, hefur/trunk/hefurd.service)
===================================================================
--- extra-x86_64/hefurd.service (rev 0)
+++ extra-x86_64/hefurd.service 2012-11-30 21:59:44 UTC (rev 172176)
@@ -0,0 +1,12 @@
+[Unit]
+Description=A standalone and lightweight BitTorrent tracker
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/hefurd -torrent-dir /var/lib/hefurd
+User=nobody
+Group=nobody
+CPUSchedulingPolicy=batch
+
+[Install]
+WantedBy=multi-user.target
More information about the arch-commits
mailing list