tests/docker: remove SKIP_DOCKER_BUILD
It is now unused. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20220401141326.1244422-17-pbonzini@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220419091020.3008144-20-alex.bennee@linaro.org>
This commit is contained in:
parent
544f4a2578
commit
77162849a6
@ -33,15 +33,7 @@ $(DOCKER_SRC_COPY):
|
||||
|
||||
docker-qemu-src: $(DOCKER_SRC_COPY)
|
||||
|
||||
# General rule for building docker images. If we are a sub-make
|
||||
# invoked with SKIP_DOCKER_BUILD we still check the image is up to date
|
||||
# though
|
||||
ifdef SKIP_DOCKER_BUILD
|
||||
docker-image-%: $(DOCKER_FILES_DIR)/%.docker
|
||||
$(call quiet-command, \
|
||||
$(DOCKER_SCRIPT) check --quiet qemu/$* $<, \
|
||||
"CHECK", "$*")
|
||||
else
|
||||
# General rule for building docker images.
|
||||
docker-image-%: $(DOCKER_FILES_DIR)/%.docker
|
||||
$(call quiet-command,\
|
||||
$(DOCKER_SCRIPT) build -t qemu/$* -f $< \
|
||||
@ -77,8 +69,6 @@ docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
|
||||
{ echo "You will need to build $(EXECUTABLE)"; exit 1;},\
|
||||
"CHECK", "debian-$* exists"))
|
||||
|
||||
endif
|
||||
|
||||
# Enforce dependencies for composite images
|
||||
# we don't run tests on intermediate images (used as base by another image)
|
||||
DOCKER_PARTIAL_IMAGES := debian10 debian11
|
||||
|
@ -676,63 +676,6 @@ class CcCommand(SubCommand):
|
||||
as_user=True)
|
||||
|
||||
|
||||
class CheckCommand(SubCommand):
|
||||
"""Check if we need to re-build a docker image out of a dockerfile.
|
||||
Arguments: <tag> <dockerfile>"""
|
||||
name = "check"
|
||||
|
||||
def args(self, parser):
|
||||
parser.add_argument("tag",
|
||||
help="Image Tag")
|
||||
parser.add_argument("dockerfile", default=None,
|
||||
help="Dockerfile name", nargs='?')
|
||||
parser.add_argument("--checktype", choices=["checksum", "age"],
|
||||
default="checksum", help="check type")
|
||||
parser.add_argument("--olderthan", default=60, type=int,
|
||||
help="number of minutes")
|
||||
|
||||
def run(self, args, argv):
|
||||
tag = args.tag
|
||||
|
||||
try:
|
||||
dkr = Docker()
|
||||
except subprocess.CalledProcessError:
|
||||
print("Docker not set up")
|
||||
return 1
|
||||
|
||||
info = dkr.inspect_tag(tag)
|
||||
if info is None:
|
||||
print("Image does not exist")
|
||||
return 1
|
||||
|
||||
if args.checktype == "checksum":
|
||||
if not args.dockerfile:
|
||||
print("Need a dockerfile for tag:%s" % (tag))
|
||||
return 1
|
||||
|
||||
dockerfile = _read_dockerfile(args.dockerfile)
|
||||
|
||||
if dkr.image_matches_dockerfile(tag, dockerfile):
|
||||
if not args.quiet:
|
||||
print("Image is up to date")
|
||||
return 0
|
||||
else:
|
||||
print("Image needs updating")
|
||||
return 1
|
||||
elif args.checktype == "age":
|
||||
timestr = dkr.get_image_creation_time(info).split(".")[0]
|
||||
created = datetime.strptime(timestr, "%Y-%m-%dT%H:%M:%S")
|
||||
past = datetime.now() - timedelta(minutes=args.olderthan)
|
||||
if created < past:
|
||||
print ("Image created @ %s more than %d minutes old" %
|
||||
(timestr, args.olderthan))
|
||||
return 1
|
||||
else:
|
||||
if not args.quiet:
|
||||
print ("Image less than %d minutes old" % (args.olderthan))
|
||||
return 0
|
||||
|
||||
|
||||
def main():
|
||||
global USE_ENGINE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user