diff --git a/Scripts/capturer.py b/Scripts/capturer.py index 7cbdee1d..2124f42d 100755 --- a/Scripts/capturer.py +++ b/Scripts/capturer.py @@ -7,14 +7,17 @@ from asyncio.subprocess import DEVNULL, PIPE, STDOUT from dataclasses import dataclass -import psutil - if sys.version_info[0] != 3 or sys.version_info[1] < 6: print( "This script requires Python version 3.7 and later. Please upgrade your Python version to grade this lab." ) sys.exit(0) +try: + import psutil +except ImportError: + print("This script requires PsUtil as main dependencies. Please install this module first.") + sys.exit(255) @dataclass class LineCapture: diff --git a/Scripts/extras/lab5.mk b/Scripts/extras/lab5.mk index e134ce3e..5fb741f2 100644 --- a/Scripts/extras/lab5.mk +++ b/Scripts/extras/lab5.mk @@ -51,6 +51,6 @@ gdb: grade: $(MAKE) distclean - $(Q)$(GRADER) + $(Q)$(DOCKER_RUN) $(GRADER) -t $(TIMEOUT) -f $(LABDIR)/scores.json -s $(SERIAL) make SERIAL=$(SERIAL) qemu-grade .PHONY: qemu qemu-gdb gdb defconfig build clean distclean grade all diff --git a/Scripts/kernel.mk b/Scripts/kernel.mk index bfe78c49..e4e6fe59 100644 --- a/Scripts/kernel.mk +++ b/Scripts/kernel.mk @@ -50,6 +50,6 @@ gdb: grade: $(MAKE) distclean - $(Q)$(GRADER) -t $(TIMEOUT) -f $(LABDIR)/scores.json -s $(SERIAL) make SERIAL=$(SERIAL) qemu-grade + $(Q)$(DOCKER_RUN) $(GRADER) -t $(TIMEOUT) -f $(LABDIR)/scores.json -s $(SERIAL) make SERIAL=$(SERIAL) qemu-grade .PHONY: qemu qemu-gdb gdb defconfig build clean distclean grade all diff --git a/Scripts/lab.mk b/Scripts/lab.mk index bdc429f8..e3d6bea0 100644 --- a/Scripts/lab.mk +++ b/Scripts/lab.mk @@ -24,6 +24,22 @@ include $(SCRIPTS)/env_generated.mk # Toolchain configuration GDB ?= gdb +DOCKER ?= docker +DOCKER_IMAGE ?= ipads/oslab:24.09 +ifeq (,$(wildcard /docker.env)) +DOCKER_RUN ?= +else +DOCKER_RUN ?= $(DOCKER) run -it --rm \ + -e SCRIPTS=$(SCRIPTS) \ + -e LABROOT=$(LABROOT) \ + -e LABDIR=$(LABDIR) \ + -e TIMEOUT=$(TIMEOUT) \ + -e LAB=$(LAB) \ + -u $(shell id -u $(USER)):$(shell id -g $(USER)) \ + -v $(LABROOT):$(LABROOT) -w $(CURDIR) \ + --security-opt=seccomp:unconfined \ + ipads/oslab:24.09 +endif QEMU-SYS ?= qemu-system-aarch64 QEMU-USER ?= qemu-aarch64 diff --git a/Scripts/submit.mk b/Scripts/submit.mk index febb8bfd..c0f292f0 100644 --- a/Scripts/submit.mk +++ b/Scripts/submit.mk @@ -1,5 +1,8 @@ include $(CURDIR)/filelist.mk +FILES := $(FILES) $(shell find -name "*.pdf" \ + -o -name "*.doc" \ + -o -name "*.docx") submit: $(Q)tar -czf lab$(LAB).tar.gz $(FILES) | : $(Q)echo " Submit Lab$(LAB)"