packages: apply usign padding workarounds to package indexes if needed
[openwrt/openwrt.git] / package / Makefile
index cc1e9d4b6631210a1f69dc666c7ac3a503561579..7f4fd16498aa7d68ce2430d5ea9711d95748fa47 100644 (file)
@@ -80,8 +80,12 @@ $(curdir)/index: FORCE
                mkdir -p $$d; \
                cd $$d || continue; \
                $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \
-               grep -vE '^(Maintainer|LicenseFiles|Source|Require)' Packages.manifest > Packages && \
-                       gzip -9nc Packages > Packages.gz; \
+               grep -vE '^(Maintainer|LicenseFiles|Source|Require)' Packages.manifest > Packages; \
+               case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \
+                       $(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \
+                       { echo ""; echo ""; } >> Packages;; \
+               esac; \
+               gzip -9nc Packages > Packages.gz; \
        ); done
 ifdef CONFIG_SIGNED_PACKAGES
        @echo Signing package index...