From 2baf058dcf323aa07f6d5dd3214982e7fccac3da Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Mon, 29 Jul 2019 20:43:20 +0100 Subject: Checking software tarball checksums before building software Until now, there was no check on the integrity of the contents of the downloaded/copied software tarballs, we only relied on the tarball name. This could be bad for reproducibility and security, for example on one server the name of a tarball may be the same but with different content. With this commit, the SHA512 checksums of all the software are stored in the newly created `checksums.mk' (similar to how the versions are stored in the `versions.mk'). The resulting variable is then defined for each software and after downloading/copying the file we check to see if the new tarball has the same checksum as the stored value. If it doesn't the script will crash with an error, informing the user of the problem. The only limitation now is a bootstrapping problem: if the host system doesn't already an `sha512sum' executable, we will not do any checksum verification until we install our `sha512sum' (as part of GNU Coreutils). All the tarballs downloaded after GNU Coreutils are built will have their checksums validated. By default almost all GNU/Linux systems will have a usable `sha512sum' (its part of GNU Coreutils after all for a long time: from the Coreutils Changelog file atleast since 2013). This completes task #15347. --- reproduce/software/make/basic.mk | 136 ++++++++++++---------- reproduce/software/make/high-level.mk | 182 ++++++++++++++++------------- reproduce/software/make/python.mk | 213 ++++++++++++++++++---------------- 3 files changed, 292 insertions(+), 239 deletions(-) (limited to 'reproduce/software/make') diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk index e4ab55a..98aea0d 100644 --- a/reproduce/software/make/basic.mk +++ b/reproduce/software/make/basic.mk @@ -36,6 +36,7 @@ include reproduce/software/make/build-rules.mk include reproduce/software/config/installation/LOCAL.mk include reproduce/software/config/installation/versions.mk +include reproduce/software/config/installation/checksums.mk lockdir = $(BDIR)/locks tdir = $(BDIR)/software/tarballs @@ -137,66 +138,71 @@ tarballs = $(foreach t, bash-$(bash-version).tar.lz \ zlib-$(zlib-version).tar.gz \ , $(tdir)/$(t) ) $(tarballs): $(tdir)/%: | $(lockdir) + + n=$$(echo $* | sed -e's/[0-9\-]/ /g' \ + -e's/\./ /g' \ + | awk '{print $$1}' ); \ + \ + mergenames=1; \ + if [ $$n = bash ]; then c=$(bash-checksum); w=http://akhlaghi.org/src; \ + elif [ $$n = binutils ]; then c=$(binutils-checksum); w=http://ftp.gnu.org/gnu/binutils; \ + elif [ $$n = bzip ]; then c=$(bzip2-checksum); w=http://akhlaghi.org/src; \ + elif [ $$n = cert ]; then c=$(cert-checksum); w=http://akhlaghi.org/src; \ + elif [ $$n = coreutils ]; then c=$(coreutils-checksum); w=http://ftp.gnu.org/gnu/coreutils;\ + elif [ $$n = curl ]; then c=$(curl-checksum); w=https://curl.haxx.se/download; \ + elif [ $$n = diffutils ]; then c=$(diffutils-checksum); w=http://ftp.gnu.org/gnu/diffutils;\ + elif [ $$n = file ]; then c=$(file-checksum); w=ftp://ftp.astron.com/pub/file; \ + elif [ $$n = findutils ]; then c=$(findutils-checksum); w=http://akhlaghi.org/src; \ + elif [ $$n = gawk ]; then c=$(gawk-checksum); w=http://ftp.gnu.org/gnu/gawk; \ + elif [ $$n = gcc ]; then c=$(gcc-checksum); w=http://ftp.gnu.org/gnu/gcc/gcc-$(gcc-version); \ + elif [ $$n = git ]; then c=$(git-checksum); w=http://mirrors.edge.kernel.org/pub/software/scm/git; \ + elif [ $$n = gmp ]; then c=$(gmp-checksum); w=https://gmplib.org/download/gmp; \ + elif [ $$n = grep ]; then c=$(grep-checksum); w=http://ftp.gnu.org/gnu/grep; \ + elif [ $$n = gzip ]; then c=$(gzip-checksum); w=http://ftp.gnu.org/gnu/gzip; \ + elif [ $$n = isl ]; then c=$(isl-checksum); w=ftp://gcc.gnu.org/pub/gcc/infrastructure; \ + elif [ $$n = libbsd ]; then c=$(libbsd-checksum); w=http://libbsd.freedesktop.org/releases; \ + elif [ $$n = libiconv ]; then c=$(libiconv-checksum); w=https://ftp.gnu.org/pub/gnu/libiconv; \ + elif [ $$n = libtool ]; then c=$(libtool-checksum); w=http://ftp.gnu.org/gnu/libtool; \ + elif [ $$n = lzip ]; then c=$(lzip-checksum); w=http://download.savannah.gnu.org/releases/lzip; \ + elif [ $$n = m ]; then \ + mergenames=0; \ + c=$(m4-checksum); \ + w=http://akhlaghi.org/src/m4-1.4.18-patched.tar.gz; \ + elif [ $$n = make ]; then c=$(make-checksum); w=http://akhlaghi.org/src; \ + elif [ $$n = metastore ]; then c=$(metastore-checksum); w=http://akhlaghi.org/src; \ + elif [ $$n = mpc ]; then c=$(mpc-checksum); w=http://ftp.gnu.org/gnu/mpc; \ + elif [ $$n = mpfr ]; then c=$(mpfr-checksum); w=http://www.mpfr.org/mpfr-current;\ + elif [ $$n = ncurses ]; then c=$(ncurses-checksum); w=http://ftp.gnu.org/gnu/ncurses; \ + elif [ $$n = openssl ]; then c=$(openssl-checksum); w=http://www.openssl.org/source; \ + elif [ $$n = patchelf ]; then c=$(patchelf-checksum); w=http://nixos.org/releases/patchelf/patchelf-$(patchelf-version); \ + elif [ $$n = pkg ]; then c=$(pkgconfig-checksum); w=http://pkg-config.freedesktop.org/releases; \ + elif [ $$n = readline ]; then c=$(readline-checksum); w=http://ftp.gnu.org/gnu/readline; \ + elif [ $$n = sed ]; then c=$(sed-checksum); w=http://ftp.gnu.org/gnu/sed; \ + elif [ $$n = tar ]; then c=$(tar-checksum); w=http://ftp.gnu.org/gnu/tar; \ + elif [ $$n = texinfo ]; then c=$(texinfo-checksum); w=http://ftp.gnu.org/gnu/texinfo; \ + elif [ $$n = unzip ]; then \ + c=$(unzip-checksum); \ + mergenames=0; v=$$(echo $(unzip-version) | sed -e's/\.//'); \ + w=ftp://ftp.info-zip.org/pub/infozip/src/unzip$$v.tgz; \ + elif [ $$n = wget ]; then c=$(wget-checksum); w=http://ftp.gnu.org/gnu/wget; \ + elif [ $$n = which ]; then c=$(which-checksum); w=http://ftp.gnu.org/gnu/which; \ + elif [ $$n = xz ]; then c=$(xz-checksum); w=http://tukaani.org/xz; \ + elif [ $$n = zip ]; then \ + c=$(zip-checksum); \ + mergenames=0; v=$$(echo $(zip-version) | sed -e's/\.//'); \ + w=ftp://ftp.info-zip.org/pub/infozip/src/zip$$v.tgz; \ + elif [ $$n = zlib ]; then c=$(zlib-checksum); w=http://www.zlib.net; \ + else \ + echo; echo; echo; \ + echo "'$$n' not recognized as a software tarball name to download."; \ + echo; echo; echo; \ + exit 1; \ + fi; \ + \ + \ if [ -f $(DEPENDENCIES-DIR)/$* ]; then \ - cp $(DEPENDENCIES-DIR)/$* $@; \ + cp $(DEPENDENCIES-DIR)/$* "$@.unchecked"; \ else \ - n=$$(echo $* | sed -e's/[0-9\-]/ /g' \ - -e's/\./ /g' \ - | awk '{print $$1}' ); \ - \ - mergenames=1; \ - if [ $$n = bash ]; then w=http://akhlaghi.org/src; \ - elif [ $$n = binutils ]; then w=http://ftp.gnu.org/gnu/binutils; \ - elif [ $$n = bzip ]; then w=http://akhlaghi.org/src; \ - elif [ $$n = cert ]; then w=http://akhlaghi.org/src; \ - elif [ $$n = coreutils ]; then w=http://ftp.gnu.org/gnu/coreutils;\ - elif [ $$n = curl ]; then w=https://curl.haxx.se/download; \ - elif [ $$n = diffutils ]; then w=http://ftp.gnu.org/gnu/diffutils;\ - elif [ $$n = file ]; then w=ftp://ftp.astron.com/pub/file; \ - elif [ $$n = findutils ]; then w=http://akhlaghi.org/src; \ - elif [ $$n = gawk ]; then w=http://ftp.gnu.org/gnu/gawk; \ - elif [ $$n = gcc ]; then w=http://ftp.gnu.org/gnu/gcc/gcc-$(gcc-version); \ - elif [ $$n = git ]; then w=http://mirrors.edge.kernel.org/pub/software/scm/git; \ - elif [ $$n = gmp ]; then w=https://gmplib.org/download/gmp; \ - elif [ $$n = grep ]; then w=http://ftp.gnu.org/gnu/grep; \ - elif [ $$n = gzip ]; then w=http://ftp.gnu.org/gnu/gzip; \ - elif [ $$n = isl ]; then w=ftp://gcc.gnu.org/pub/gcc/infrastructure; \ - elif [ $$n = libbsd ]; then w=http://libbsd.freedesktop.org/releases; \ - elif [ $$n = libiconv ]; then w=https://ftp.gnu.org/pub/gnu/libiconv; \ - elif [ $$n = libtool ]; then w=http://ftp.gnu.org/gnu/libtool; \ - elif [ $$n = lzip ]; then w=http://download.savannah.gnu.org/releases/lzip; \ - elif [ $$n = m ]; then \ - mergenames=0; \ - w=http://akhlaghi.org/src/m4-1.4.18-patched.tar.gz; \ - elif [ $$n = make ]; then w=http://akhlaghi.org/src; \ - elif [ $$n = metastore ]; then w=http://akhlaghi.org/src; \ - elif [ $$n = mpfr ]; then w=http://www.mpfr.org/mpfr-current;\ - elif [ $$n = mpc ]; then w=http://ftp.gnu.org/gnu/mpc; \ - elif [ $$n = ncurses ]; then w=http://ftp.gnu.org/gnu/ncurses; \ - elif [ $$n = openssl ]; then w=http://www.openssl.org/source; \ - elif [ $$n = patchelf ]; then w=http://nixos.org/releases/patchelf/patchelf-$(patchelf-version); \ - elif [ $$n = pkg ]; then w=http://pkg-config.freedesktop.org/releases; \ - elif [ $$n = readline ]; then w=http://ftp.gnu.org/gnu/readline; \ - elif [ $$n = sed ]; then w=http://ftp.gnu.org/gnu/sed; \ - elif [ $$n = tar ]; then w=http://ftp.gnu.org/gnu/tar; \ - elif [ $$n = texinfo ]; then w=http://ftp.gnu.org/gnu/texinfo; \ - elif [ $$n = unzip ]; then \ - mergenames=0; v=$$(echo $(unzip-version) | sed -e's/\.//'); \ - w=ftp://ftp.info-zip.org/pub/infozip/src/unzip$$v.tgz; \ - elif [ $$n = wget ]; then w=http://ftp.gnu.org/gnu/wget; \ - elif [ $$n = which ]; then w=http://ftp.gnu.org/gnu/which; \ - elif [ $$n = xz ]; then w=http://tukaani.org/xz; \ - elif [ $$n = zip ]; then \ - mergenames=0; v=$$(echo $(zip-version) | sed -e's/\.//'); \ - w=ftp://ftp.info-zip.org/pub/infozip/src/zip$$v.tgz; \ - elif [ $$n = zlib ]; then w=http://www.zlib.net; \ - else \ - echo; echo; echo; \ - echo "'$$n' not a basic dependency name (for downloading)." \ - echo; echo; echo; \ - exit 1; \ - fi; \ - \ if [ $$mergenames = 1 ]; then tarballurl=$$w/"$*"; \ else tarballurl=$$w; \ fi; \ @@ -210,8 +216,18 @@ $(tarballs): $(tdir)/%: | $(lockdir) \ touch $(lockdir)/download; \ $(downloadwrapper) "$$downloader" $(lockdir)/download \ - $$tarballurl $@; \ - fi + $$tarballurl "$@.unchecked"; \ + fi; \ + \ + \ + if type sha512sum > /dev/null 2>/dev/null; then \ + checksum=$$(sha512sum "$@.unchecked" | awk '{print $$1}'); \ + echo "$*: should be '$$c', is '$$checksum'"; \ + if [ x$$checksum = x$$c ]; then mv "$@.unchecked" "$@"; \ + else echo "ERROR: Non-matching checksum for '$*'."; exit 1; \ + fi; \ + else mv "$@.unchecked" "$@"; \ + fi; diff --git a/reproduce/software/make/high-level.mk b/reproduce/software/make/high-level.mk index b9a70de..3b37961 100644 --- a/reproduce/software/make/high-level.mk +++ b/reproduce/software/make/high-level.mk @@ -32,6 +32,7 @@ include reproduce/software/config/installation/LOCAL.mk include reproduce/software/config/installation/TARGETS.mk include reproduce/software/config/installation/texlive.mk include reproduce/software/config/installation/versions.mk +include reproduce/software/config/installation/checksums.mk lockdir = $(BDIR)/locks tdir = $(BDIR)/software/tarballs @@ -161,86 +162,96 @@ tarballs = $(foreach t, astrometry.net-$(astrometrynet-version).tar.gz \ yaml-$(yaml-version).tar.gz \ , $(tdir)/$(t) ) $(tarballs): $(tdir)/%: | $(lockdir) - if [ -f $(DEPENDENCIES-DIR)/$* ]; then - cp $(DEPENDENCIES-DIR)/$* $@ + + # Remove all numbers, `-' and `.' from the tarball name so we can + # search more easily only with the program name. + n=$$(echo $* | sed -e's/[0-9\-]/ /g' -e's/\./ /g' \ + | awk '{print $$1}' ) + + # Set the top download link of the requested tarball. + mergenames=1 + if [ $$n = astrometry ]; then c=$(astrometrynet-checksum); w=http://astrometry.net/downloads + elif [ $$n = atlas ]; then + mergenames=0 + c=$(atlas-checksum) + w=https://sourceforge.net/projects/math-atlas/files/Stable/$(atlas-version)/atlas$(atlas-version).tar.bz2/download + elif [ $$n = cairo ]; then c=$(cairo-checksum); w=https://www.cairographics.org/releases + elif [ $$n = cdsclient ]; then c=$(cdsclient-checksum); w=http://cdsarc.u-strasbg.fr/ftp/pub/sw + elif [ $$n = cfitsio ]; then c=$(cfitsio-checksum); w=https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c + elif [ $$n = cmake ]; then + mergenames=0 + c=$(cmake-checksum) + majv=$$(echo $(cmake-version) \ + | sed -e's/\./ /' \ + | awk '{printf("%d.%d", $$1, $$2)}') + w=https://cmake.org/files/v$$majv/cmake-$(cmake-version).tar.gz + elif [ $$n = fftw ]; then c=$(fftw-checksum); w=ftp://ftp.fftw.org/pub/fftw + elif [ $$n = freetype ]; then c=$(freetype-checksum); w=https://download.savannah.gnu.org/releases/freetype + elif [ $$n = ghostscript ]; then c=$(ghostscript-checksum); w=https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs926 + elif [ $$n = gnuastro ]; then c=$(gnuastro-checksum); w=http://ftp.gnu.org/gnu/gnuastro + elif [ $$n = gsl ]; then c=$(gsl-checksum); w=http://ftp.gnu.org/gnu/gsl + elif [ $$n = hdf ]; then + mergenames=0 + c=$(hdf5-checksum) + majorver=$$(echo $(hdf5-version) | sed -e 's/\./ /g' | awk '{printf("%d.%d", $$1, $$2)}') + w=https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-$$majorver/hdf5-$(hdf5-version)/src/$* + elif [ $$n = imagemagick ]; then + mergenames=0 + c=$(imagemagick-checksum) + w=https://www.imagemagick.org/download/releases/ImageMagick-$(imagemagick-version).tar.xz + elif [ $$n = imfit ]; then + mergenames=0 + c=$(imfit-checksum) + w=http://www.mpe.mpg.de/~erwin/resources/imfit/imfit-$(imfit-version)-source.tar.gz + elif [ $$n = install ]; then c=NO-CHECK-SUM; w=http://mirror.ctan.org/systems/texlive/tlnet + elif [ $$n = jpegsrc ]; then c=$(libjpeg-checksum); w=http://ijg.org/files + elif [ $$n = lapack ]; then c=$(lapack-checksum); w=http://www.netlib.org/lapack + elif [ $$n = libpng ]; then c=$(libpng-checksum); w=https://download.sourceforge.net/libpng + elif [ $$n = libgit ]; then + mergenames=0 + c=$(libgit2-checksum) + w=https://github.com/libgit2/libgit2/archive/v$(libgit2-version).tar.gz + elif [ $$n = libxml ]; then c=$(libxml-checksum); w=ftp://xmlsoft.org/libxml2 + elif [ $$n = netpbm ]; then c=$(netpbm-checksum); w=http://akhlaghi.org/src + elif [ $$n = openblas ]; then + mergenames=0 + c=$(openblas-checksum) + w=https://github.com/xianyi/OpenBLAS/archive/v$(openblas-version).tar.gz + elif [ $$n = openmpi ]; then + mergenames=0 + c=$(openmpi-checksum) + majorver=$$(echo $(openmpi-version) | sed -e 's/\./ /g' | awk '{printf("%d.%d", $$1, $$2)}') + w=https://download.open-mpi.org/release/open-mpi/v$$majorver/$* + elif [ $$n = pixman ]; then c=$(pixman-checksum); w=https://www.cairographics.org/releases + elif [ $$n = scamp ]; then c=$(scamp-checksum); w=http://akhlaghi.org/src + elif [ $$n = scons ]; then + mergenames=0 + c=$(scons-checksum) + w=https://sourceforge.net/projects/scons/files/scons/$(scons-version)/scons-$(scons-version).tar.gz/download + elif [ $$n = sextractor ]; then c=$(sextractor-checksum); w=http://akhlaghi.org/src + elif [ $$n = swarp ]; then c=$(swarp-checksum); w=https://www.astromatic.net/download/swarp + elif [ $$n = swig ]; then c=$(swig-checksum); w=https://sourceforge.net/projects/swig/files/swig/swig-$(swig-version) + elif [ $$n = tides ]; then c=$(tides-checksum); w=http://akhlaghi.org/src + elif [ $$n = tiff ]; then c=$(libtiff-checksum); w=https://download.osgeo.org/libtiff + elif [ $$n = wcslib ]; then c=$(wcslib-checksum); w=ftp://ftp.atnf.csiro.au/pub/software/wcslib + elif [ $$n = yaml ]; then c=$(yaml-checksum); w=pyyaml.org/download/libyaml else - # Remove all numbers, `-' and `.' from the tarball name so we can - # search more easily only with the program name. - n=$$(echo $* | sed -e's/[0-9\-]/ /g' -e's/\./ /g' \ - | awk '{print $$1}' ) - - # Set the top download link of the requested tarball. - mergenames=1 - if [ $$n = astrometry ]; then w=http://astrometry.net/downloads - elif [ $$n = atlas ]; then - mergenames=0 - w=https://sourceforge.net/projects/math-atlas/files/Stable/$(atlas-version)/atlas$(atlas-version).tar.bz2/download - elif [ $$n = cairo ]; then w=https://www.cairographics.org/releases - elif [ $$n = cdsclient ]; then w=http://cdsarc.u-strasbg.fr/ftp/pub/sw - elif [ $$n = cfitsio ]; then w=https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c - elif [ $$n = cmake ]; then - mergenames=0 - majv=$$(echo $(cmake-version) \ - | sed -e's/\./ /' \ - | awk '{printf("%d.%d", $$1, $$2)}') - w=https://cmake.org/files/v$$majv/cmake-$(cmake-version).tar.gz - elif [ $$n = fftw ]; then w=ftp://ftp.fftw.org/pub/fftw - elif [ $$n = freetype ]; then w=https://download.savannah.gnu.org/releases/freetype - elif [ $$n = hdf ]; then - mergenames=0 - majorver=$$(echo $(hdf5-version) | sed -e 's/\./ /g' | awk '{printf("%d.%d", $$1, $$2)}') - w=https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-$$majorver/hdf5-$(hdf5-version)/src/$* - elif [ $$n = ghostscript ]; then w=https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs926 - elif [ $$n = gnuastro ]; then w=http://ftp.gnu.org/gnu/gnuastro - elif [ $$n = gsl ]; then w=http://ftp.gnu.org/gnu/gsl - elif [ $$n = imagemagick ]; then - mergenames=0 - w=https://www.imagemagick.org/download/releases/ImageMagick-$(imagemagick-version).tar.xz - elif [ $$n = imfit ]; then - mergenames=0 - w=http://www.mpe.mpg.de/~erwin/resources/imfit/imfit-$(imfit-version)-source.tar.gz - elif [ $$n = install ]; then w=http://mirror.ctan.org/systems/texlive/tlnet - elif [ $$n = jpegsrc ]; then w=http://ijg.org/files - elif [ $$n = lapack ]; then w=http://www.netlib.org/lapack - elif [ $$n = libpng ]; then w=https://download.sourceforge.net/libpng - elif [ $$n = libgit ]; then - mergenames=0 - w=https://github.com/libgit2/libgit2/archive/v$(libgit2-version).tar.gz - elif [ $$n = libxml ]; then w=ftp://xmlsoft.org/libxml2 - elif [ $$n = netpbm ]; then w=http://akhlaghi.org/src - elif [ $$n = openblas ]; then - mergenames=0 - w=https://github.com/xianyi/OpenBLAS/archive/v$(openblas-version).tar.gz - elif [ $$n = openmpi ]; then - mergenames=0 - majorver=$$(echo $(openmpi-version) | sed -e 's/\./ /g' | awk '{printf("%d.%d", $$1, $$2)}') - w=https://download.open-mpi.org/release/open-mpi/v$$majorver/$* - elif [ $$n = pixman ]; then w=https://www.cairographics.org/releases - elif [ $$n = scamp ]; then w=http://akhlaghi.org/src - elif [ $$n = scons ]; then - mergenames=0 - w=https://sourceforge.net/projects/scons/files/scons/$(scons-version)/scons-$(scons-version).tar.gz/download - elif [ $$n = sextractor ]; then w=http://akhlaghi.org/src - elif [ $$n = swarp ]; then w=https://www.astromatic.net/download/swarp - elif [ $$n = swig ]; then w=https://sourceforge.net/projects/swig/files/swig/swig-$(swig-version) - elif [ $$n = tides ]; then w=http://akhlaghi.org/src - elif [ $$n = tiff ]; then w=https://download.osgeo.org/libtiff - elif [ $$n = wcslib ]; then w=ftp://ftp.atnf.csiro.au/pub/software/wcslib - elif [ $$n = yaml ]; then w=pyyaml.org/download/libyaml - else - echo; echo; echo; - echo "'$$n' not recognized as a dependency name to download." - echo; echo; echo; - exit 1 - fi + echo; echo; echo; + echo "'$$n' not recognized as a software tarball name to download." + echo; echo; echo; + exit 1 + fi - # Download the requested tarball. Note that some packages may not - # follow our naming convention (where the package name is merged - # with its version number). In such cases, `w' will be the full - # address, not just the top directory address. But since we are - # storing all the tarballs in one directory, we want it to have - # the same naming convention, so we'll download it to a temporary - # name, then rename that. + # Download the requested tarball. Note that some packages may not + # follow our naming convention (where the package name is merged + # with its version number). In such cases, `w' will be the full + # address, not just the top directory address. But since we are + # storing all the tarballs in one directory, we want it to have the + # same naming convention, so we'll download it to a temporary name, + # then rename that. + if [ -f $(DEPENDENCIES-DIR)/$* ]; then + cp $(DEPENDENCIES-DIR)/$* "$@.unchecked" + else if [ $$mergenames = 1 ]; then tarballurl=$$w/"$*" else tarballurl=$$w fi @@ -249,7 +260,20 @@ $(tarballs): $(tdir)/%: | $(lockdir) touch $(lockdir)/download downloader="wget --no-use-server-timestamps -O" $(downloadwrapper) "$$downloader" $(lockdir)/download \ - $$tarballurl $@ + $$tarballurl "$@.unchecked" + fi + + # Make sure this is the expected tarball. Note that we now have a + # controlled `sha512sum' build (as part of GNU Coreutils). So we + # don't need to check its existance like `basic.mk'. But for LaTeX, + # we need to ignore a checksum (it downloads the binaries). + if [ $$c == NO-CHECK-SUM ]; then + mv "$@.unchecked" "$@" + else + checksum=$$(sha512sum "$@.unchecked" | awk '{print $$1}') + if [ x$$checksum = x$$c ]; then mv "$@.unchecked" "$@" + else echo "ERROR: Non-matching checksum for '$*'."; exit 1 + fi fi diff --git a/reproduce/software/make/python.mk b/reproduce/software/make/python.mk index ed1c87d..bc2995f 100644 --- a/reproduce/software/make/python.mk +++ b/reproduce/software/make/python.mk @@ -102,108 +102,113 @@ pytarballs = $(foreach t, asn1crypto-$(asn1crypto-version).tar.gz \ , $(tdir)/$(t) ) pytopurl=https://files.pythonhosted.org/packages $(pytarballs): $(tdir)/%: - if [ -f $(DEPENDENCIES-DIR)/$* ]; then - cp $(DEPENDENCIES-DIR)/$* $@ - else - # Convenience variable - # -------------------- - # - # `n' is just for convenience and to avoid having to repeat the - # package tarball name in the conditional to find its URL. - # - # For some packages (for example `python-dateutil', or those with - # a number or dash in their name), we need special consideration - # because the tokenization above will produce `python' as the - # first string. - if [ $* = python-dateutil-$(python-dateutil-version).tar.gz ]; then - n=dateutil - elif [ $* = h5py-$(h5py-version).tar.gz ]; then - n=h5py - - # elif [ $* = strange-tarball5name-version.tar.gz ]; then - # n=strange5-name - else - # Remove all numbers, `-' and `.' from the tarball name so we can - # search more easily only with the program name. - n=$$(echo $* | sed -e's/[0-9\-]/ /g' -e's/\./ /g' \ - | awk '{print $$1}') - fi + # Convenience variable + # -------------------- + # + # `n' is just for convenience and to avoid having to repeat the + # package tarball name in the conditional to find its URL. + # + # For some packages (for example `python-dateutil', or those with + # a number or dash in their name), we need special consideration + # because the tokenization above will produce `python' as the + # first string. + if [ $* = python-dateutil-$(python-dateutil-version).tar.gz ]; then + n=dateutil + elif [ $* = h5py-$(h5py-version).tar.gz ]; then + n=h5py + + # elif [ $* = strange-tarball5name-version.tar.gz ]; then + # n=strange5-name + else + # Remove all numbers, `-' and `.' from the tarball name so we can + # search more easily only with the program name. + n=$$(echo $* | sed -e's/[0-9\-]/ /g' -e's/\./ /g' \ + | awk '{print $$1}') + fi - # Set the top download link of the requested tarball. The ones - # that have non-standard filenames (differing from our archived - # tarball names) are treated first, then the standard ones. - mergenames=1 - if [ $$n = cython ]; then - mergenames=0 - hash=36/da/fcb979fc8cb486a67a013d6aefefbb95a3e19e67e49dff8a35e014046c5e - h=$(pytopurl)/$$hash/Cython-$(cython-version).tar.gz - elif [ $$n = python ]; then - mergenames=0 - h=https://www.python.org/ftp/python/$(python-version)/Python-$(python-version).tgz - elif [ $$n = pyyaml ]; then - mergenames=0 - hash=9f/2c/9417b5c774792634834e730932745bc09a7d36754ca00acf1ccd1ac2594d - h=$(pytopurl)/$$hash/PyYAML-$(pyyaml-version).tar.gz - elif [ $$n = libffi ]; then - mergenames=0 - h=ftp://sourceware.org/pub/libffi/libffi-$(libffi-version).tar.gz - elif [ $$n = secretstorage ]; then - mergenames=0 - hash=a6/89/df343dbc2957a317127e7ff2983230dc5336273be34f2e1911519d85aeb5 - h=$(pytopurl)/$$hash/SecretStorage-$(secretstorage-version).tar.gz - elif [ $$n = asn ]; then h=fc/f1/8db7daa71f414ddabfa056c4ef792e1461ff655c2ae2928a2b675bfed6b4 - elif [ $$n = astroquery ]; then h=61/50/a7a08f9e54d7d9d97e69433cd88231e1ad2901811c9d1ae9ac7ccaef9396 - elif [ $$n = astropy ]; then h=eb/f7/1251bf6881861f24239efe0c24cbcfc4191ccdbb69ac3e9bb740d0c23352 - elif [ $$n = beautifulsoup ]; then h=80/f2/f6aca7f1b209bb9a7ef069d68813b091c8c3620642b568dac4eb0e507748 - elif [ $$n = certifi ]; then h=55/54/3ce77783acba5979ce16674fc98b1920d00b01d337cfaaf5db22543505ed - elif [ $$n = cffi ]; then h=64/7c/27367b38e6cc3e1f49f193deb761fe75cda9f95da37b67b422e62281fcac - elif [ $$n = chardet ]; then h=fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d - elif [ $$n = cryptography ]; then h=07/ca/bc827c5e55918ad223d59d299fff92f3563476c3b00d0a9157d9c0217449 - elif [ $$n = cycler ]; then h=c2/4b/137dea450d6e1e3d474e1d873cd1d4f7d3beed7e0dc973b06e8e10d32488 - elif [ $$n = entrypoints ]; then h=b4/ef/063484f1f9ba3081e920ec9972c96664e2edb9fdc3d8669b0e3b8fc0ad7c - elif [ $$n = h5py ]; then h=43/27/a6e7dcb8ae20a4dbf3725321058923fec262b6f7835179d78ccc8d98deec - elif [ $$n = html ]; then h=85/3e/cf449cf1b5004e87510b9368e7a5f1acd8831c2d6691edd3c62a0823f98f - elif [ $$n = idna ]; then h=ad/13/eb56951b6f7950cadb579ca166e448ba77f9d24efc03edd7e55fa57d04b7 - elif [ $$n = jeepney ]; then h=16/1d/74adf3b164a8d19a60d0fcf706a751ffa2a1eaa8e5bbb1b6705c92a05263 - elif [ $$n = keyring ]; then h=15/88/c6ce9509438bc02d54cf214923cfba814412f90c31c95028af852b19f9b2 - elif [ $$n = kiwisolver ]; then h=31/60/494fcce70d60a598c32ee00e71542e52e27c978e5f8219fae0d4ac6e2864 - elif [ $$n = matplotlib ]; then h=89/0c/653aec68e9cfb775c4fbae8f71011206e5e7fe4d60fcf01ea1a9d3bc957f - elif [ $$n = mpi ]; then h=55/a2/c827b196070e161357b49287fa46d69f25641930fd5f854722319d431843 - elif [ $$n = mpmath ]; then h=ca/63/3384ebb3b51af9610086b23ea976e6d27d6d97bf140a76a365bd77a3eb32 - elif [ $$n = numpy ]; then h=cf/8d/6345b4f32b37945fedc1e027e83970005fc9c699068d2f566b82826515f2 - elif [ $$n = pip ]; then h=4c/4d/88bc9413da11702cbbace3ccc51350ae099bb351febae8acc85fec34f9af - elif [ $$n = pkgconfig ]; then h=6e/a9/ff67ef67217dfdf2aca847685fe789f82b931a6957a3deac861297585db6 - elif [ $$n = pycparser ]; then h=68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a - elif [ $$n = pyparsing ]; then h=b9/b8/6b32b3e84014148dcd60dd05795e35c2e7f4b72f918616c61fdce83d27fc - elif [ $$n = dateutil ]; then h=ad/99/5b2e99737edeb28c71bcbec5b5dda19d0d9ef3ca3e92e3e925e7c0bb364c - elif [ $$n = requests ]; then h=52/2c/514e4ac25da2b08ca5a464c50463682126385c4272c18193876e91f4bc38 - elif [ $$n = scipy ]; then h=a9/b4/5598a706697d1e2929eaf7fe68898ef4bea76e4950b9efbe1ef396b8813a - elif [ $$n = secretstorage ]; then h=a6/89/df343dbc2957a317127e7ff2983230dc5336273be34f2e1911519d85aeb5 - elif [ $$n = setuptools ]; then h=c2/f7/c7b501b783e5a74cf1768bc174ee4fb0a8a6ee5af6afa92274ff964703e0 - elif [ $$n = setuptools_scm ]; then h=54/85/514ba3ca2a022bddd68819f187ae826986051d130ec5b972076e4f58a9f3 - elif [ $$n = six ]; then h=dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca - elif [ $$n = sip_tpv ]; then h=27/93/a973aab2a3bf0c12cb385611819710921e13b090304c6bd015026cf9c502 - elif [ $$n = soupsieve ]; then h=0c/52/e9088bb9b96e2d39fc3b33fcda5b4fde9d71473536ac660a1ca9a0958a2f - elif [ $$n = sympy ]; then h=54/2e/6adb11fe599d4cfb7e8833753350ac51aa2c0603c226b36f9051cc9d2425 - elif [ $$n = urllib ]; then h=b1/53/37d82ab391393565f2f831b8eedbffd57db5a718216f82f1a8b4d381a1c1 - elif [ $$n = virtualenv ]; then h=51/aa/c395a6e6eaaedfa5a04723b6446a1df783b16cca6fec66e671cede514688 - elif [ $$n = webencodings ]; then h=0b/02/ae6ceac1baeda530866a85075641cec12989bd8d31af6d5ab4a3e8c92f47 -# elif [ $$n = strange5-name ]; then h=XXXXX - else - echo; echo; echo; - echo "'$$n' not recognized as a dependency name to download." - echo; echo; echo; - exit 1 - fi + # Set the top download link of the requested tarball. The ones + # that have non-standard filenames (differing from our archived + # tarball names) are treated first, then the standard ones. + mergenames=1 + if [ $$n = cython ]; then + mergenames=0 + c=$(cython-checksum) + hash=36/da/fcb979fc8cb486a67a013d6aefefbb95a3e19e67e49dff8a35e014046c5e + h=$(pytopurl)/$$hash/Cython-$(cython-version).tar.gz + elif [ $$n = python ]; then + mergenames=0 + c=$(python-checksum) + h=https://www.python.org/ftp/python/$(python-version)/Python-$(python-version).tgz + elif [ $$n = pyyaml ]; then + mergenames=0 + c=$(pyyaml-checksum) + hash=9f/2c/9417b5c774792634834e730932745bc09a7d36754ca00acf1ccd1ac2594d + h=$(pytopurl)/$$hash/PyYAML-$(pyyaml-version).tar.gz + elif [ $$n = libffi ]; then + mergenames=0 + c=$(libffi-checksum) + h=ftp://sourceware.org/pub/libffi/libffi-$(libffi-version).tar.gz + elif [ $$n = secretstorage ]; then + mergenames=0 + c=$(secretstorage-checksum) + hash=a6/89/df343dbc2957a317127e7ff2983230dc5336273be34f2e1911519d85aeb5 + h=$(pytopurl)/$$hash/SecretStorage-$(secretstorage-version).tar.gz + elif [ $$n = asn ]; then h=fc/f1/8db7daa71f414ddabfa056c4ef792e1461ff655c2ae2928a2b675bfed6b4; c=$(asn1crypto-checksum) + elif [ $$n = astroquery ]; then h=61/50/a7a08f9e54d7d9d97e69433cd88231e1ad2901811c9d1ae9ac7ccaef9396; c=$(astroquery-checksum) + elif [ $$n = astropy ]; then h=eb/f7/1251bf6881861f24239efe0c24cbcfc4191ccdbb69ac3e9bb740d0c23352; c=$(astropy-checksum) + elif [ $$n = beautifulsoup ]; then h=80/f2/f6aca7f1b209bb9a7ef069d68813b091c8c3620642b568dac4eb0e507748; c=$(beautifulsoup-checksum) + elif [ $$n = certifi ]; then h=55/54/3ce77783acba5979ce16674fc98b1920d00b01d337cfaaf5db22543505ed; c=$(certifi-checksum) + elif [ $$n = cffi ]; then h=64/7c/27367b38e6cc3e1f49f193deb761fe75cda9f95da37b67b422e62281fcac; c=$(cffi-checksum) + elif [ $$n = chardet ]; then h=fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d; c=$(chardet-checksum) + elif [ $$n = cryptography ]; then h=07/ca/bc827c5e55918ad223d59d299fff92f3563476c3b00d0a9157d9c0217449; c=$(cryptography-checksum) + elif [ $$n = cycler ]; then h=c2/4b/137dea450d6e1e3d474e1d873cd1d4f7d3beed7e0dc973b06e8e10d32488; c=$(cycler-checksum) + elif [ $$n = entrypoints ]; then h=b4/ef/063484f1f9ba3081e920ec9972c96664e2edb9fdc3d8669b0e3b8fc0ad7c; c=$(entrypoints-checksum) + elif [ $$n = h5py ]; then h=43/27/a6e7dcb8ae20a4dbf3725321058923fec262b6f7835179d78ccc8d98deec; c=$(h5py-checksum) + elif [ $$n = html ]; then h=85/3e/cf449cf1b5004e87510b9368e7a5f1acd8831c2d6691edd3c62a0823f98f; c=$(html5lib-checksum) + elif [ $$n = idna ]; then h=ad/13/eb56951b6f7950cadb579ca166e448ba77f9d24efc03edd7e55fa57d04b7; c=$(idna-checksum) + elif [ $$n = jeepney ]; then h=16/1d/74adf3b164a8d19a60d0fcf706a751ffa2a1eaa8e5bbb1b6705c92a05263; c=$(jeepney-checksum) + elif [ $$n = keyring ]; then h=15/88/c6ce9509438bc02d54cf214923cfba814412f90c31c95028af852b19f9b2; c=$(keyring-checksum) + elif [ $$n = kiwisolver ]; then h=31/60/494fcce70d60a598c32ee00e71542e52e27c978e5f8219fae0d4ac6e2864; c=$(kiwisolver-checksum) + elif [ $$n = matplotlib ]; then h=89/0c/653aec68e9cfb775c4fbae8f71011206e5e7fe4d60fcf01ea1a9d3bc957f; c=$(matplotlib-checksum) + elif [ $$n = mpi ]; then h=55/a2/c827b196070e161357b49287fa46d69f25641930fd5f854722319d431843; c=$(mpi4py-checksum) + elif [ $$n = mpmath ]; then h=ca/63/3384ebb3b51af9610086b23ea976e6d27d6d97bf140a76a365bd77a3eb32; c=$(mpmath-checksum) + elif [ $$n = numpy ]; then h=cf/8d/6345b4f32b37945fedc1e027e83970005fc9c699068d2f566b82826515f2; c=$(numpy-checksum) + elif [ $$n = pip ]; then h=4c/4d/88bc9413da11702cbbace3ccc51350ae099bb351febae8acc85fec34f9af; c=$(pip-checksum) + elif [ $$n = pkgconfig ]; then h=6e/a9/ff67ef67217dfdf2aca847685fe789f82b931a6957a3deac861297585db6; c=$(pypkgconfig-checksum) + elif [ $$n = pycparser ]; then h=68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a; c=$(pycparser-checksum) + elif [ $$n = pyparsing ]; then h=b9/b8/6b32b3e84014148dcd60dd05795e35c2e7f4b72f918616c61fdce83d27fc; c=$(pyparsing-checksum) + elif [ $$n = dateutil ]; then h=ad/99/5b2e99737edeb28c71bcbec5b5dda19d0d9ef3ca3e92e3e925e7c0bb364c; c=$(python-dateutil-checksum) + elif [ $$n = requests ]; then h=52/2c/514e4ac25da2b08ca5a464c50463682126385c4272c18193876e91f4bc38; c=$(requests-checksum) + elif [ $$n = scipy ]; then h=a9/b4/5598a706697d1e2929eaf7fe68898ef4bea76e4950b9efbe1ef396b8813a; c=$(scipy-checksum) + elif [ $$n = secretstorage ]; then h=a6/89/df343dbc2957a317127e7ff2983230dc5336273be34f2e1911519d85aeb5; c=$(secretstorage-checksum) + elif [ $$n = setuptools ]; then h=c2/f7/c7b501b783e5a74cf1768bc174ee4fb0a8a6ee5af6afa92274ff964703e0; c=$(setuptools-checksum) + elif [ $$n = setuptools_scm ]; then h=54/85/514ba3ca2a022bddd68819f187ae826986051d130ec5b972076e4f58a9f3; c=$(setuptools_scm-checksum) + elif [ $$n = six ]; then h=dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca; c=$(six-checksum) + elif [ $$n = sip_tpv ]; then h=27/93/a973aab2a3bf0c12cb385611819710921e13b090304c6bd015026cf9c502; c=$(sip_tpv-checksum) + elif [ $$n = soupsieve ]; then h=0c/52/e9088bb9b96e2d39fc3b33fcda5b4fde9d71473536ac660a1ca9a0958a2f; c=$(soupsieve-checksum) + elif [ $$n = sympy ]; then h=54/2e/6adb11fe599d4cfb7e8833753350ac51aa2c0603c226b36f9051cc9d2425; c=$(sympy-checksum) + elif [ $$n = urllib ]; then h=b1/53/37d82ab391393565f2f831b8eedbffd57db5a718216f82f1a8b4d381a1c1; c=$(urllib3-checksum) + elif [ $$n = virtualenv ]; then h=51/aa/c395a6e6eaaedfa5a04723b6446a1df783b16cca6fec66e671cede514688; c=$(virtualenv-checksum) + elif [ $$n = webencodings ]; then h=0b/02/ae6ceac1baeda530866a85075641cec12989bd8d31af6d5ab4a3e8c92f47; c=$(webencodings-checksum) +# elif [ $$n = strange5-name ]; then h=XXXXX; c=$(XXXXX-checksum) + else + echo; echo; echo; + echo "'$$n' not recognized as a dependency name to download." + echo; echo; echo; + exit 1 + fi - # Download the requested tarball. Note that some packages may not - # follow our naming convention (where the package name is merged - # with its version number). In such cases, `w' will be the full - # address, not just the top directory address. But since we are - # storing all the tarballs in one directory, we want it to have - # the same naming convention, so we'll download it to a temporary - # name, then rename that. + # Download the requested tarball. Note that some packages may not + # follow our naming convention (where the package name is merged + # with its version number). In such cases, `w' will be the full + # address, not just the top directory address. But since we are + # storing all the tarballs in one directory, we want it to have + # the same naming convention, so we'll download it to a temporary + # name, then rename that. + if [ -f $(DEPENDENCIES-DIR)/$* ]; then + cp $(DEPENDENCIES-DIR)/$* "$@.unchecked" + else if [ $$mergenames = 1 ]; then tarballurl=$(pytopurl)/$$h/"$*" else tarballurl=$$h fi @@ -212,7 +217,15 @@ $(pytarballs): $(tdir)/%: touch $(lockdir)/download downloader="wget --no-use-server-timestamps -O" $(downloadwrapper) "$$downloader" $(lockdir)/download \ - $$tarballurl $@ + $$tarballurl "$@.unchecked" + fi + + # Make sure this is the expected tarball. Note that we now have a + # controlled `sha512sum' build (as part of GNU Coreutils). So we + # don't need to check its existance like `basic.mk'. + checksum=$$(sha512sum "$@.unchecked" | awk '{print $$1}') + if [ x$$checksum = x$$c ]; then mv "$@.unchecked" "$@" + else echo "ERROR: Non-matching checksum for '$*'."; exit 1 fi -- cgit v1.2.1