forked from Mirror/pmbootstrap
Add --offline flag
Allow working offline with pmbootstrap, as long as all packages that are being used have already been downloaded.
This commit is contained in:
parent
5b33eb7520
commit
e458b1fdbc
5 changed files with 15 additions and 1 deletions
|
@ -229,6 +229,8 @@ def install(args, packages, suffix="native", build=True):
|
||||||
["add"] + packages,
|
["add"] + packages,
|
||||||
["del", ".pmbootstrap"]]
|
["del", ".pmbootstrap"]]
|
||||||
for command in commands:
|
for command in commands:
|
||||||
|
if args.offline:
|
||||||
|
command = ["--no-network"] + command
|
||||||
pmb.chroot.root(args, ["apk", "--no-progress"] + command, suffix)
|
pmb.chroot.root(args, ["apk", "--no-progress"] + command, suffix)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -181,4 +181,6 @@ def init(args):
|
||||||
|
|
||||||
|
|
||||||
def run(args, parameters):
|
def run(args, parameters):
|
||||||
|
if args.offline:
|
||||||
|
parameters = ["--no-network"] + parameters
|
||||||
pmb.helpers.run.root(args, [args.work + "/apk.static"] + parameters)
|
pmb.helpers.run.root(args, [args.work + "/apk.static"] + parameters)
|
||||||
|
|
|
@ -115,7 +115,8 @@ def add_cache(args):
|
||||||
"apk_min_version_checked": [],
|
"apk_min_version_checked": [],
|
||||||
"apk_repository_list_updated": [],
|
"apk_repository_list_updated": [],
|
||||||
"built": {},
|
"built": {},
|
||||||
"find_aport": {}})
|
"find_aport": {},
|
||||||
|
"offline_msg_shown": False})
|
||||||
|
|
||||||
|
|
||||||
def add_deviceinfo(args):
|
def add_deviceinfo(args):
|
||||||
|
|
|
@ -118,6 +118,13 @@ def update(args, arch=None, force=False, existing_only=False):
|
||||||
|
|
||||||
:returns: True when files have been downloaded, False otherwise
|
:returns: True when files have been downloaded, False otherwise
|
||||||
"""
|
"""
|
||||||
|
# Skip in offline mode, only show once
|
||||||
|
if args.offline:
|
||||||
|
if not args.cache["offline_msg_shown"]:
|
||||||
|
logging.info("NOTE: skipping package index update (offline mode)")
|
||||||
|
args.cache["offline_msg_shown"] = True
|
||||||
|
return False
|
||||||
|
|
||||||
# Architectures and retention time
|
# Architectures and retention time
|
||||||
architectures = [arch] if arch else pmb.config.build_device_architectures
|
architectures = [arch] if arch else pmb.config.build_device_architectures
|
||||||
retention_hours = pmb.config.apkindex_retention_time
|
retention_hours = pmb.config.apkindex_retention_time
|
||||||
|
|
|
@ -281,6 +281,8 @@ def arguments():
|
||||||
" recommended, may screw up your work folders"
|
" recommended, may screw up your work folders"
|
||||||
" directory permissions!)", dest="as_root",
|
" directory permissions!)", dest="as_root",
|
||||||
action="store_true")
|
action="store_true")
|
||||||
|
parser.add_argument("-o", "--offline", help="Do not attempt to update"
|
||||||
|
" the package index files", action="store_true")
|
||||||
|
|
||||||
# Compiler
|
# Compiler
|
||||||
parser.add_argument("--ccache-disable", action="store_false",
|
parser.add_argument("--ccache-disable", action="store_false",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue