File 0005-tfix-threshold.patch of Package php-sabre-dav
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Thu, 26 Feb 2015 13:40:12 -0400
Subject: tfix: threshold
Forwarded: https://github.com/fruux/sabre-dav/pull/615
Applied-Upstream: https://github.com/fruux/sabre-dav/commit/60a1e4e70e315a1098712e43e7f16b196abd0b12
---
bin/naturalselection | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/bin/naturalselection b/bin/naturalselection
index 8ccd33b..086722a 100755
--- a/bin/naturalselection
+++ b/bin/naturalselection
@@ -16,16 +16,16 @@ def getfreespace(path):
stat = os.statvfs(path)
return stat.f_frsize * stat.f_bavail
-def getbytesleft(path,treshold):
- return getfreespace(path)-treshold
+def getbytesleft(path,threshold):
+ return getfreespace(path)-threshold
-def run(cacheDir, treshold, sleep=5, simulate=False, min_erase = 0):
+def run(cacheDir, threshold, sleep=5, simulate=False, min_erase = 0):
- bytes = getbytesleft(cacheDir,treshold)
+ bytes = getbytesleft(cacheDir,threshold)
if (bytes>0):
- print "Bytes to go before we hit treshhold:", bytes
+ print "Bytes to go before we hit threshold:", bytes
else:
- print "Treshold exceeded with:", -bytes, "bytes"
+ print "Threshold exceeded with:", -bytes, "bytes"
dir = os.listdir(cacheDir)
dir2 = []
for file in dir:
@@ -46,7 +46,7 @@ def run(cacheDir, treshold, sleep=5, simulate=False, min_erase = 0):
left = min_erase
# If the min_erase setting is lower than the amount of bytes over
- # the treshold, we use that number instead.
+ # the threshold, we use that number instead.
if left < -bytes :
left = -bytes
@@ -73,7 +73,7 @@ def run(cacheDir, treshold, sleep=5, simulate=False, min_erase = 0):
def main():
parser = OptionParser(
version="naturalselecton v0.3",
- description="Cache directory manager. Deletes cache entries based on accesstime and free space tresholds.\n" +
+ description="Cache directory manager. Deletes cache entries based on accesstime and free space thresholds.\n" +
"This utility is distributed alongside SabreDAV.",
usage="usage: %prog [options] cacheDirectory",
)
@@ -98,15 +98,15 @@ def main():
default=5
)
parser.add_option(
- '-l','--treshold',
- help="Treshhold in bytes (default = 10737418240, which is 10GB)",
+ '-l','--threshold',
+ help="Threshold in bytes (default = 10737418240, which is 10GB)",
type="int",
- dest="treshold",
+ dest="threshold",
default=10737418240
)
parser.add_option(
'-m', '--min-erase',
- help="Minimum number of bytes to erase when the treshold is reached. " +
+ help="Minimum number of bytes to erase when the threshold is reached. " +
"Setting this option higher will reduce the amount of times the cache directory will need to be scanned. " +
"(the default is 1073741824, which is 1GB.)",
type="int",
@@ -130,7 +130,7 @@ def main():
cacheDir,
sleep=options.sleep,
simulate=options.simulate,
- treshold=options.treshold,
+ threshold=options.threshold,
min_erase=options.min_erase
)
if runs>0: