Commit 535bad18 authored by Axel Auweter's avatar Axel Auweter
Browse files

Add MD5 checksum verification to distfiles. Fixes ticket #26.

parent f883ce80
MAKEFILENAME := $(lastword $(MAKEFILE_LIST))
include config.mk
LIBRARIES = DCDBLib
......@@ -22,7 +23,10 @@ DISTFILES = apache-cassandra-$(CASSANDRA_VERSION).tar.gz;http://mirrors.sonic.ne
cpp-driver-$(CPPDRV_VERSION).tar.gz;https://github.com/datastax/cpp-driver/archive/$(CPPDRV_VERSION).tar.gz \
libuv-v$(LIBUV_VERSION).tar.gz;http://dist.libuv.org/dist/v$(LIBUV_VERSION)/libuv-v$(LIBUV_VERSION).tar.gz
DISTFILES_HASHES = apache-cassandra-2.2.4.tar.gz;cb77a8e3792a7e8551af6602ac5f11df;mosquitto-1.3.5.tar.gz;55094ad4dc7c7985377f43d4fc3d09da;OpenIPMI-2.0.21.tar.gz;dc0b42ae40b3f1d0db2a94b75b95fae1;boost_1_57_0.tar.gz;25f9a8ac28beeb5ab84aa98510305299;net-snmp-5.7.3.zip;9f682bd70c717efdd9f15b686d07baee;openssl-1.0.1q.tar.gz;54538d0cdcb912f9bc2b36268388205e;cpp-driver-2.0.1.tar.gz;70bf83e1cbd0d35b7e5ed66fc4dccbb1;libuv-v0.10.36.tar.gz;8eb77b4fee4f311c114a9fee06f5a2ab;
FETCH = wget -c --no-check-certificate -O -
MD5 = $(if $(shell which md5),md5,md5sum --tag)
MAKETHREADS ?= $(if $(findstring $(shell uname),Darwin),$(shell sysctl machdep.cpu.thread_count | cut -b 27-),\
$(if $(findstring $(shell uname),Linux),$(shell cat /proc/cpuinfo | grep processor | wc -l),4))
......@@ -110,6 +114,7 @@ cleanall: clean
distclean: clean
@echo "Wiping dependencies..."
@rm -rf $(DCDBDEPSPATH)
@rm -rf .md5sums
mrproper: distclean
$(eval U := $(shell whoami))
......@@ -118,6 +123,15 @@ mrproper: distclean
@echo "Wiping installation directory..."
@rm -rf $(DCDBDEPLOYPATH)
update-distfile-hashes: .md5sums
$(eval X := $(shell cat .md5sums | tr \\\n \; ))
@echo "Updating $(MAKEFILENAME)..."
@sed -i -e 's/^DISTFILES_HASHES\ =.*/DISTFILES_HASHES\ =\ $(X)/' $(MAKEFILENAME) ;
@rm -f .md5sums
.md5sums: $(DCDBDEPSPATH)/.download-distfiles
@$(foreach f,$(DISTFILESNAMES),echo "Checksumming $(f)..." && printf "$(f);" >> .md5sums && $(MD5) $(DCDBDEPSPATH)/distfiles/$(f) | sed -e 's/.*\ //' >> .md5sums; )
all: check-cross-compile $(DCDBDEPSPATH)/.prerequesites
@make $(LIBRARIES)
@make $(PROJECTS)
......@@ -301,6 +315,18 @@ $(DCDBDEPSPATH)/distfiles/%:
$(eval FF := $(shell echo "$(DISTFILES)" | sed 's/.*$(F);//' | sed 's/ .*//'))
@echo "Downloading $(FF) as $(F)..."
@cd $(DCDBDEPSPATH)/distfiles && $(FETCH) $(FF) > $(F)
@if [ "$(NOCHECK)" = "" ]; then \
printf "Verifying checksum... "; \
if [ "`echo "$(DISTFILES_HASHES)" | sed -e 's/.*$(F);//' | sed -e 's/;.*//';`" = "`$(MD5) $(DCDBDEPSPATH)/distfiles/$(F) | sed -e 's/.*\ //'`" ]; then \
echo "Checksum OK!"; \
else \
echo "Checksum FAIL!"; \
exit 2; \
fi \
else \
echo "Skipping checksum verification..."; \
fi
@echo ""
$(DCDBDEPSPATH)/%/.dirstamp: $(DCDBDEPSPATH)/.download-distfiles
$(eval F := $(shell echo "$@" | sed 's/\/.dirstamp//' | sed 's/.*\///'))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment