commit
5bf04936d9
|
@ -15,7 +15,8 @@ from utils import (
|
||||||
remove_duplicates,
|
remove_duplicates,
|
||||||
add_execution_right,
|
add_execution_right,
|
||||||
get_sha256,
|
get_sha256,
|
||||||
print_status,
|
print_progress,
|
||||||
|
setup_print_progress,
|
||||||
StopBuild,
|
StopBuild,
|
||||||
SkipCommand,
|
SkipCommand,
|
||||||
Defaultdict,
|
Defaultdict,
|
||||||
|
@ -453,9 +454,9 @@ class BuildEnv:
|
||||||
break
|
break
|
||||||
if tsize:
|
if tsize:
|
||||||
current += batch_size
|
current += batch_size
|
||||||
print_status("{:.2%}".format(current/tsize))
|
print_progress("{:.2%}".format(current/tsize))
|
||||||
else:
|
else:
|
||||||
print_status(progress_chars[current])
|
print_progress(progress_chars[current])
|
||||||
current = (current+1)%4
|
current = (current+1)%4
|
||||||
file.write(batch)
|
file.write(batch)
|
||||||
|
|
||||||
|
@ -924,6 +925,8 @@ def parse_args():
|
||||||
parser.add_argument('--verbose', '-v', action="store_true",
|
parser.add_argument('--verbose', '-v', action="store_true",
|
||||||
help=("Print all logs on stdout instead of in specific"
|
help=("Print all logs on stdout instead of in specific"
|
||||||
" log files per commands"))
|
" log files per commands"))
|
||||||
|
parser.add_argument('--hide-progress', action='store_false', dest='show_progress',
|
||||||
|
help="Hide intermediate progress information.")
|
||||||
parser.add_argument('--no-cert-check', action='store_true',
|
parser.add_argument('--no-cert-check', action='store_true',
|
||||||
help="Skip SSL certificate verification during download")
|
help="Skip SSL certificate verification during download")
|
||||||
parser.add_argument('--skip-source-prepare', action='store_true',
|
parser.add_argument('--skip-source-prepare', action='store_true',
|
||||||
|
@ -952,5 +955,6 @@ def parse_args():
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
options = parse_args()
|
options = parse_args()
|
||||||
options.working_dir = os.path.abspath(options.working_dir)
|
options.working_dir = os.path.abspath(options.working_dir)
|
||||||
|
setup_print_progress(options.show_progress)
|
||||||
builder = Builder(options)
|
builder = Builder(options)
|
||||||
builder.run()
|
builder.run()
|
||||||
|
|
|
@ -25,6 +25,7 @@ then
|
||||||
${TRAVIS_BUILD_DIR}/kiwix-build.py \
|
${TRAVIS_BUILD_DIR}/kiwix-build.py \
|
||||||
--target-platform $PLATFORM \
|
--target-platform $PLATFORM \
|
||||||
--build-deps-only \
|
--build-deps-only \
|
||||||
|
--hide-progress \
|
||||||
${TARGET}
|
${TARGET}
|
||||||
rm ${BASE_DIR}/.install_packages_ok
|
rm ${BASE_DIR}/.install_packages_ok
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ EOF
|
||||||
scp -i ${SSH_KEY} ${ARCHIVE_NAME} nightlybot@download.kiwix.org:/var/www/tmp.kiwix.org/ci/
|
scp -i ${SSH_KEY} ${ARCHIVE_NAME} nightlybot@download.kiwix.org:/var/www/tmp.kiwix.org/ci/
|
||||||
)
|
)
|
||||||
|
|
||||||
${TRAVIS_BUILD_DIR}/kiwix-build.py --target-platform $PLATFORM ${TARGET}
|
${TRAVIS_BUILD_DIR}/kiwix-build.py --hide-progress --target-platform $PLATFORM ${TARGET}
|
||||||
rm ${BASE_DIR}/.install_packages_ok
|
rm ${BASE_DIR}/.install_packages_ok
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -96,5 +97,6 @@ else
|
||||||
fi
|
fi
|
||||||
${TRAVIS_BUILD_DIR}/kiwix-build.py \
|
${TRAVIS_BUILD_DIR}/kiwix-build.py \
|
||||||
--target-platform $PLATFORM \
|
--target-platform $PLATFORM \
|
||||||
|
--hide-progress \
|
||||||
${TARGET}
|
${TARGET}
|
||||||
fi
|
fi
|
||||||
|
|
16
utils.py
16
utils.py
|
@ -8,6 +8,13 @@ from collections import namedtuple, defaultdict
|
||||||
|
|
||||||
pj = os.path.join
|
pj = os.path.join
|
||||||
|
|
||||||
|
g_print_progress = True
|
||||||
|
|
||||||
|
|
||||||
|
def setup_print_progress(print_progress):
|
||||||
|
global g_print_progress
|
||||||
|
g_print_progress = print_progress
|
||||||
|
|
||||||
|
|
||||||
class Defaultdict(defaultdict):
|
class Defaultdict(defaultdict):
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
|
@ -37,14 +44,17 @@ def get_sha256(path):
|
||||||
if not batch:
|
if not batch:
|
||||||
break
|
break
|
||||||
sha256.update(batch)
|
sha256.update(batch)
|
||||||
print_status(progress_chars[current])
|
print_progress(progress_chars[current])
|
||||||
current = (current+1)%4
|
current = (current+1)%4
|
||||||
return sha256.hexdigest()
|
return sha256.hexdigest()
|
||||||
|
|
||||||
def print_status(status):
|
|
||||||
text = "{}\033[{}D".format(status, len(status))
|
def print_progress(progress):
|
||||||
|
if g_print_progress:
|
||||||
|
text = "{}\033[{}D".format(progress, len(progress))
|
||||||
print(text, end="")
|
print(text, end="")
|
||||||
|
|
||||||
|
|
||||||
def add_execution_right(file_path):
|
def add_execution_right(file_path):
|
||||||
current_permissions = stat.S_IMODE(os.lstat(file_path).st_mode)
|
current_permissions = stat.S_IMODE(os.lstat(file_path).st_mode)
|
||||||
os.chmod(file_path, current_permissions | stat.S_IXUSR)
|
os.chmod(file_path, current_permissions | stat.S_IXUSR)
|
||||||
|
|
Loading…
Reference in New Issue