package/cache-calibrator: fix legal-info
authorYann E. MORIN <yann.morin.1998@free.fr>
Mon, 3 Jul 2017 21:30:01 +0000 (23:30 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Mon, 3 Jul 2017 22:03:39 +0000 (00:03 +0200)
Fixes:
http://autobuild.buildroot.net/results/e1b/e1b3dee917f5ab3961f3dea006720431444d0ef5/

cache-calibrator is a single C file that is downloaded as-is, and we
patch it. We also use that file as the license file.

Thus, the file when it is downloaded has a specific hash, but when
saved by legal-info, it has a different hash.

However, we can't store two different hashes for the same _filename_
with different content.

So, we extract the license file as a pre-patch hook, and store it in a
separate file, for which we can now add a hash.

[Peter: add autobuilder reference]
Reported-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Stephan Hoffmann <sho@relinux.de>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/cache-calibrator/cache-calibrator.hash
package/cache-calibrator/cache-calibrator.mk

index df61d17e10e74fd735e1b74642860f52550dc795..a4b4b70cf7393d55fa2c99ccee4609a1281409d5 100644 (file)
@@ -1,2 +1,3 @@
 # Locally calculated
 sha256 2018ed8fa733155d44ceb1c0066c5cf8df7771cdf7cfca0a07b8dd9bebd9c221 calibrator.c
+sha256 a853663f5b4fb3ad77bf2790ab53146f456b8d9b9ddf83b99fe28c0bdec42514 calibrator.c.license
index d0620655c7ea53b5b6d3d9f2a45f54370d88c788..6f12d119ef74c0f9c41caf913255023bc4deb4fc 100644 (file)
@@ -7,12 +7,17 @@
 CACHE_CALIBRATOR_SOURCE = calibrator.c
 CACHE_CALIBRATOR_SITE = http://homepages.cwi.nl/~manegold/Calibrator/src
 CACHE_CALIBRATOR_LICENSE = Cache calibrator license
-CACHE_CALIBRATOR_LICENSE_FILES = calibrator.c
+CACHE_CALIBRATOR_LICENSE_FILES = calibrator.c.license
 
 define CACHE_CALIBRATOR_EXTRACT_CMDS
        cp $(DL_DIR)/$(CACHE_CALIBRATOR_SOURCE) $(@D)
 endef
 
+define CACHE_CALIBRATOR_EXTRACT_LICENSE
+       head -n 38 $(@D)/calibrator.c >$(@D)/calibrator.c.license
+endef
+CACHE_CALIBRATOR_PRE_PATCH_HOOKS += CACHE_CALIBRATOR_EXTRACT_LICENSE
+
 define CACHE_CALIBRATOR_BUILD_CMDS
        $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(@D)/calibrator.c -o $(@D)/cache_calibrator -lm
 endef