-----BEGIN PGP SIGNATURE-----
iQFEBAABCAAuFiEEUAN8t5cGD3bwIa1WyjViTGqRccYFAloFrG0QHGZhbXpAcmVk aGF0LmNvbQAKCRDKNWJMapFxxmkQB/9E8+c1dNd3QaiISTg+7pyk7LMPB7sEaSZx Zj2kz3TalGsNsI9tTL/hfoi5oqBgxpQYL9FjU7yCCqKIq9pO+aKfC8f+mMm4h2hR wqYRbxkWHeKG2uVaGgH0MPeA85Vcn+U1j3RxZf1SnV2hlA9mnKu+sNZaf/KRYtWk dOzFKg0OUeDR4lF+NYj+p3YThjge1HxIFf5Li16CBZCbdZ78gqHCOspbYWAWSVFv X2m0tqROqAEXX7x1zKJn/yp7N0K5VykFX/WbVmEKpjDUTxDrhFnJiSVvsuMHJJjY 2IN/2ePjwCa9cRpUJyhX6mlplaaTC4meuaJF4WmjIyT64n4QdM7k =Xymd -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' into staging # gpg: Signature made Fri 10 Nov 2017 13:41:01 GMT # gpg: using RSA key 0xCA35624C6A9171C6 # gpg: Good signature from "Fam Zheng <famz@redhat.com>" # Primary key fingerprint: 5003 7CB7 9706 0F76 F021 AD56 CA35 624C 6A91 71C6 * remotes/famz/tags/docker-pull-request: docker: correctly escape $BACKEND in the help output docker: Improved image checksum Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
02e5844db2
@ -109,7 +109,7 @@ docker:
|
||||
@echo ' DEBUG=1 Stop and drop to shell in the created container'
|
||||
@echo ' before running the command.'
|
||||
@echo ' NETWORK=1 Enable virtual network interface with default backend.'
|
||||
@echo ' NETWORK=$BACKEND Enable virtual network interface with $BACKEND.'
|
||||
@echo ' NETWORK=$$BACKEND Enable virtual network interface with $$BACKEND.'
|
||||
@echo ' NOUSER Define to disable adding current user to containers passwd.'
|
||||
@echo ' NOCACHE=1 Ignore cache when build images.'
|
||||
@echo ' EXECUTABLE=<path> Include executable in image.'
|
||||
|
@ -105,6 +105,28 @@ def _copy_binary_with_libs(src, dest_dir):
|
||||
so_path = os.path.dirname(l)
|
||||
_copy_with_mkdir(l , dest_dir, so_path)
|
||||
|
||||
def _read_qemu_dockerfile(img_name):
|
||||
df = os.path.join(os.path.dirname(__file__), "dockerfiles",
|
||||
img_name + ".docker")
|
||||
return open(df, "r").read()
|
||||
|
||||
def _dockerfile_preprocess(df):
|
||||
out = ""
|
||||
for l in df.splitlines():
|
||||
if len(l.strip()) == 0 or l.startswith("#"):
|
||||
continue
|
||||
from_pref = "FROM qemu:"
|
||||
if l.startswith(from_pref):
|
||||
# TODO: Alternatively we could replace this line with "FROM $ID"
|
||||
# where $ID is the image's hex id obtained with
|
||||
# $ docker images $IMAGE --format="{{.Id}}"
|
||||
# but unfortunately that's not supported by RHEL 7.
|
||||
inlining = _read_qemu_dockerfile(l[len(from_pref):])
|
||||
out += _dockerfile_preprocess(inlining)
|
||||
continue
|
||||
out += l + "\n"
|
||||
return out
|
||||
|
||||
class Docker(object):
|
||||
""" Running Docker commands """
|
||||
def __init__(self):
|
||||
@ -196,7 +218,7 @@ class Docker(object):
|
||||
checksum = self.get_image_dockerfile_checksum(tag)
|
||||
except Exception:
|
||||
return False
|
||||
return checksum == _text_checksum(dockerfile)
|
||||
return checksum == _text_checksum(_dockerfile_preprocess(dockerfile))
|
||||
|
||||
def run(self, cmd, keep, quiet):
|
||||
label = uuid.uuid1().hex
|
||||
|
Loading…
Reference in New Issue
Block a user