From 84bd74057f0d2543ddbc7de2351b0a310df329c6 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 25 Dec 2016 16:40:05 +0100 Subject: build: use mkhash to replace various quirky md5sum/openssl calls Signed-off-by: Felix Fietkau --- include/depends.mk | 2 +- include/download.mk | 2 +- include/image.mk | 2 +- include/kernel-defaults.mk | 2 +- include/prereq-build.mk | 5 ----- include/quilt.mk | 3 ++- include/scan.mk | 2 +- include/shell.sh | 7 ------- 8 files changed, 7 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/depends.mk b/include/depends.mk index 7135e52..293409d 100644 --- a/include/depends.mk +++ b/include/depends.mk @@ -13,7 +13,7 @@ DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -find_md5=$(SH_FUNC) find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | md5s +find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | mkhash md5 define rdep .PRECIOUS: $(2) diff --git a/include/download.mk b/include/download.mk index 09b929b..b87686d 100644 --- a/include/download.mk +++ b/include/download.mk @@ -61,7 +61,7 @@ else check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix)) endif -gen_sha256sum = $(shell openssl dgst -sha256 $(DL_DIR)/$(1) | awk '{print $$2}') +gen_sha256sum = $(shell mkhash sha256 $(DL_DIR)/$(1)) ifdef FIXUP F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2) diff --git a/include/image.mk b/include/image.mk index 93c3bbd..65f9b0e 100644 --- a/include/image.mk +++ b/include/image.mk @@ -33,7 +33,7 @@ param_get_default = $(firstword $(call param_get,$(1),$(2)) $(3)) param_mangle = $(subst $(space),_,$(strip $(1))) param_unmangle = $(subst _,$(space),$(1)) -mkfs_packages_id = $(shell echo $(sort $(1)) | md5sum | head -c 8) +mkfs_packages_id = $(shell echo $(sort $(1)) | mkhash md5 | head -c 8) mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call param_get,pkg,$(1)),$(TARGET_DIR)) KDIR=$(KERNEL_BUILD_DIR) diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index a17b489..10bd67a 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -125,7 +125,7 @@ define Kernel/Configure/Default cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \ } $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install - $(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic + grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | mkhash md5 > $(LINUX_DIR)/.vermagic endef define Kernel/Configure/Initramfs diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 496fc04..af4e8b5 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -127,11 +127,6 @@ $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \ gstat -c%s $(TMP_DIR)/.host.mk, \ stat -c%s $(TMP_DIR)/.host.mk)) -$(eval $(call SetupHostCommand,md5sum,, \ - gmd5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \ - md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \ - $(SCRIPT_DIR)/md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e)) - $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \ unzip 2>&1 | grep zipfile, \ unzip)) diff --git a/include/quilt.mk b/include/quilt.mk index cd392a7..796e716 100644 --- a/include/quilt.mk +++ b/include/quilt.mk @@ -149,7 +149,8 @@ define Quilt/Template echo "The source directory contains no quilt patches."; \ false; \ } - @[ -n "$$$$(ls $(1)/patches/series)" -o "$$$$(cat $(1)/patches/series | md5sum)" = "$$(sort $(1)/patches/series | md5sum)" ] || { \ + @[ -n "$$$$(ls $(1)/patches/series)" -o \ + "$$$$(cat $(1)/patches/series | mkhash md5)" = "$$(sort $(1)/patches/series | mkhash md5)" ] || { \ echo "The patches are not sorted in the right order. Please fix."; \ false; \ } diff --git a/include/scan.mk b/include/scan.mk index e6bc068..5b1f53b 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -85,7 +85,7 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST) $(TARGET_STAMP):: +( \ $(NO_TRACE_MAKE) $(FILELIST); \ - MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | (md5sum || md5) 2>/dev/null | awk '{print $$1}'); \ + MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | mkhash md5 | awk '{print $$1}'); \ [ -f "$@.$$MD5SUM" ] || { \ rm -f $@.*; \ touch $@.$$MD5SUM; \ diff --git a/include/shell.sh b/include/shell.sh index 8f6f6f0..6ee0cf6 100644 --- a/include/shell.sh +++ b/include/shell.sh @@ -13,10 +13,3 @@ isset() { eval "var=\"\${$1}\"" [ -n "$var" ] } - -md5s() { - cat "$@" | ( - md5sum 2>/dev/null || - md5 - ) | awk '{print $1}' -} -- cgit v1.1