@@ -333,27 +333,9 @@ clean:
333333 make -C $(EF_TESTS ) clean
334334 make -C $(STATE_TRANSITION_VECTORS ) clean
335335
336- .PHONY : install-cargo-deb deb-cargo deb-cargo-x86_64 deb-cargo-aarch64 deb-cargo-all test-deb-reproducible install-deb-local remove-deb-local clean-deb help-deb
337- # # Install cargo-deb if not present
338- install-cargo-deb :
339- @if ! command -v cargo-deb & > /dev/null; then \
340- echo " Installing cargo-deb..." ; \
341- cargo install cargo-deb; \
342- else \
343- echo " cargo-deb already installed" ; \
344- fi
345-
346- # # Build .deb package using cargo-deb with reproducible settings
347- deb-cargo : install-cargo-deb build-reproducible
336+ .PHONY : deb-cargo
337+ deb-cargo : build-reproducible # # Build .deb package using cargo-deb with reproducible settings
348338 @echo " Building .deb package with cargo-deb..."
349- @if [ ! -f " lighthouse/lighthouse.service" ]; then \
350- echo " ❌ lighthouse.service not found in lighthouse/ directory" ; \
351- exit 1; \
352- fi
353- @if [ ! -f " README.md" ]; then \
354- echo " ❌ README.md not found in current directory" ; \
355- exit 1; \
356- fi
357339
358340 cd lighthouse && \
359341 SOURCE_DATE_EPOCH=$(SOURCE_DATE ) \
@@ -365,65 +347,26 @@ deb-cargo: install-cargo-deb build-reproducible
365347 @echo " ✅ Package built successfully!"
366348 @find target/$(RUST_TARGET ) /debian -name " *.deb" -exec ls -la {} \;
367349
368- # # Build .deb for specific architectures
369- deb-cargo-x86_64 :
350+
351+ .PHONY : deb-cargo-x86_64
352+ deb-cargo-x86_64 : # # Build .deb for specific architectures
370353 $(MAKE ) deb-cargo RUST_TARGET=x86_64-unknown-linux-gnu
371354
355+ .PHONY : deb-cargo-aarch64
372356deb-cargo-aarch64 :
373357 $(MAKE ) deb-cargo RUST_TARGET=aarch64-unknown-linux-gnu
374358
359+ .PHONY : deb-cargo-all
375360deb-cargo-all : deb-cargo-x86_64 deb-cargo-aarch64
376361
377- # # Test reproducibility of cargo-deb packages
378- test-deb-reproducible :
379- @echo " Testing cargo-deb package reproducibility..."
380- @if ! command -v diffoscope & > /dev/null; then \
381- echo " Installing diffoscope..." ; \
382- sudo apt-get update; \
383- sudo apt-get install -y diffoscope binutils-multiarch; \
384- fi
385-
386- @echo " Building first package..."
387- @rm -f lighthouse_* .deb lighthouse-deb-* .deb
388- @$(MAKE ) clean || true
389- @$(MAKE ) deb-cargo
390- @FIRST_PACKAGE=$$(find target/$(RUST_TARGET ) /debian -name "*.deb" | head -1 ) ; \
391- if [ -n " $$ FIRST_PACKAGE" ]; then \
392- cp " $$ FIRST_PACKAGE" ./lighthouse-deb-build-1.deb; \
393- else \
394- echo " ❌ First package not found" ; exit 1; \
395- fi
396-
397- @echo " Building second package..."
398- @$(MAKE ) clean || true
399- @$(MAKE ) deb-cargo
400- @SECOND_PACKAGE=$$(find target/$(RUST_TARGET ) /debian -name "*.deb" | head -1 ) ; \
401- if [ -n " $$ SECOND_PACKAGE" ]; then \
402- cp " $$ SECOND_PACKAGE" ./lighthouse-deb-build-2.deb; \
403- else \
404- echo " ❌ Second package not found" ; exit 1; \
405- fi
406-
407- @echo " Comparing packages..."
408- @echo " === Package sizes ==="
409- @ls -la lighthouse-deb-build-* .deb
410- @echo " === SHA256 checksums ==="
411- @sha256sum lighthouse-deb-build-* .deb
412-
413- @if cmp -s lighthouse-deb-build-1.deb lighthouse-deb-build-2.deb; then \
414- echo " ✅ SUCCESS: cargo-deb packages are identical!" ; \
415- echo " ✅ Reproducible build PASSED" ; \
416- else \
417- echo " ❌ FAILED: cargo-deb packages differ" ; \
418- echo " Running detailed analysis with diffoscope..." ; \
419- diffoscope --text lighthouse-deb-build-1.deb lighthouse-deb-build-2.deb > cargo-deb-diff.txt || true ; \
420- echo " Differences saved to cargo-deb-diff.txt" ; \
421- echo " ❌ Reproducible build FAILED" ; \
422- exit 1; \
423- fi
424362
425- # # Install .deb package locally for testing
426- install-deb-local :
363+ .PHONY : test-deb-reproducible
364+ test-deb-reproducible : # # Test reproducibility of cargo-deb packages
365+ @./scripts/test-deb-reproducible.sh $(RUST_TARGET )
366+
367+
368+ .PHONY : install-deb-local
369+ install-deb-local : # # Install .deb package locally for testing
427370 @PACKAGE=$$(find target/$(RUST_TARGET ) /debian -name "*.deb" | head -1 ) ; \
428371 if [ -n " $$ PACKAGE" ]; then \
429372 echo " Installing lighthouse package: $$ PACKAGE" ; \
@@ -440,22 +383,23 @@ install-deb-local:
440383 echo " ❌ No .deb package found. Run 'make deb-cargo' first." ; \
441384 fi
442385
443- # # Remove installed lighthouse package
444- remove-deb-local :
386+
387+ .PHONY : remove-deb-local
388+ remove-deb-local : # # Remove installed lighthouse package
445389 @echo " Removing lighthouse package..."
446390 sudo dpkg -r lighthouse || true
447391 sudo systemctl daemon-reload || true
448392
449- # # Clean up debian packaging artifacts
450- clean-deb :
393+ .PHONY : clean-deb
394+ clean-deb : # # Clean up debian packaging artifacts
451395 @echo " Cleaning up debian packaging artifacts..."
452396 rm -f lighthouse_* .deb lighthouse-deb-* .deb * -diff.txt
453397 rm -rf target/* /debian/
454398
455- # # Show help for debian packaging
456- help-deb :
399+
400+ .PHONY : help-deb
401+ help-deb : # # Show help for debian packaging
457402 @echo " Clean Debian Packaging Targets:"
458- @echo " install-cargo-deb - Install cargo-deb tool"
459403 @echo " deb-cargo - Build .deb package with cargo-deb"
460404 @echo " deb-cargo-x86_64 - Build x86_64 .deb package"
461405 @echo " deb-cargo-aarch64 - Build aarch64 .deb package"
0 commit comments