import click
import re
import os
-import hashlib
from os.path import isdir, join, isfile, abspath, dirname, \
realpath, splitext, relpath
from subprocess import check_call, check_output, CalledProcessError, DEVNULL
# this is to allow to use it directory from source repository
sys.path.append(join(HERE, 'src'))
-from debocker.utils import cached_constant, cached_property, tmppath
+from debocker.utils import cached_constant, cached_property, tmppath, \
+ calculate_md5_and_size
__version__ = "0.2"
with open(filename, 'wb') as output:
self.build_docker_tarball_to_fd(output, buildinfo)
-def calculate_md5_and_size(path):
- md5 = hashlib.md5()
- count = 0
- with open(path, 'rb') as f:
- while True:
- buff = f.read(8192)
- if len(buff) == 0:
- break
- count += len(buff)
- md5.update(buff)
- return md5.hexdigest(), count
-
def make_native_bundle(name, version, control,
source, buildinfo, output):
dsc_name = '{}_{}.dsc'.format(name, version)
from datetime import datetime
from os.path import join
import os
+import hashlib
def cached_constant(f):
cache = []
if directory:
os.mkdir(tmp_path)
return tmp_path
+
+def calculate_md5_and_size(path):
+ md5 = hashlib.md5()
+ count = 0
+ with open(path, 'rb') as f:
+ while True:
+ buff = f.read(8192)
+ if len(buff) == 0:
+ break
+ count += len(buff)
+ md5.update(buff)
+ return md5.hexdigest(), count