@@ -342,27 +342,9 @@ clean:
342342 make -C $(EF_TESTS ) clean
343343 make -C $(STATE_TRANSITION_VECTORS ) clean
344344
345- .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
346- # # Install cargo-deb if not present
347- install-cargo-deb :
348- @if ! command -v cargo-deb & > /dev/null; then \
349- echo " Installing cargo-deb..." ; \
350- cargo install cargo-deb; \
351- else \
352- echo " cargo-deb already installed" ; \
353- fi
354-
355- # # Build .deb package using cargo-deb with reproducible settings
356- deb-cargo : install-cargo-deb build-reproducible
345+ .PHONY : deb-cargo
346+ deb-cargo : build-reproducible # # Build .deb package using cargo-deb with reproducible settings
357347 @echo " Building .deb package with cargo-deb..."
358- @if [ ! -f " lighthouse/lighthouse.service" ]; then \
359- echo " ❌ lighthouse.service not found in lighthouse/ directory" ; \
360- exit 1; \
361- fi
362- @if [ ! -f " README.md" ]; then \
363- echo " ❌ README.md not found in current directory" ; \
364- exit 1; \
365- fi
366348
367349 cd lighthouse && \
368350 SOURCE_DATE_EPOCH=$(SOURCE_DATE ) \
@@ -374,65 +356,26 @@ deb-cargo: install-cargo-deb build-reproducible
374356 @echo " ✅ Package built successfully!"
375357 @find target/$(RUST_TARGET ) /debian -name " *.deb" -exec ls -la {} \;
376358
377- # # Build .deb for specific architectures
378- deb-cargo-x86_64 :
359+
360+ .PHONY : deb-cargo-x86_64
361+ deb-cargo-x86_64 : # # Build .deb for specific architectures
379362 $(MAKE ) deb-cargo RUST_TARGET=x86_64-unknown-linux-gnu
380363
364+ .PHONY : deb-cargo-aarch64
381365deb-cargo-aarch64 :
382366 $(MAKE ) deb-cargo RUST_TARGET=aarch64-unknown-linux-gnu
383367
368+ .PHONY : deb-cargo-all
384369deb-cargo-all : deb-cargo-x86_64 deb-cargo-aarch64
385370
386- # # Test reproducibility of cargo-deb packages
387- test-deb-reproducible :
388- @echo " Testing cargo-deb package reproducibility..."
389- @if ! command -v diffoscope & > /dev/null; then \
390- echo " Installing diffoscope..." ; \
391- sudo apt-get update; \
392- sudo apt-get install -y diffoscope binutils-multiarch; \
393- fi
394-
395- @echo " Building first package..."
396- @rm -f lighthouse_* .deb lighthouse-deb-* .deb
397- @$(MAKE ) clean || true
398- @$(MAKE ) deb-cargo
399- @FIRST_PACKAGE=$$(find target/$(RUST_TARGET ) /debian -name "*.deb" | head -1 ) ; \
400- if [ -n " $$ FIRST_PACKAGE" ]; then \
401- cp " $$ FIRST_PACKAGE" ./lighthouse-deb-build-1.deb; \
402- else \
403- echo " ❌ First package not found" ; exit 1; \
404- fi
405-
406- @echo " Building second package..."
407- @$(MAKE ) clean || true
408- @$(MAKE ) deb-cargo
409- @SECOND_PACKAGE=$$(find target/$(RUST_TARGET ) /debian -name "*.deb" | head -1 ) ; \
410- if [ -n " $$ SECOND_PACKAGE" ]; then \
411- cp " $$ SECOND_PACKAGE" ./lighthouse-deb-build-2.deb; \
412- else \
413- echo " ❌ Second package not found" ; exit 1; \
414- fi
415-
416- @echo " Comparing packages..."
417- @echo " === Package sizes ==="
418- @ls -la lighthouse-deb-build-* .deb
419- @echo " === SHA256 checksums ==="
420- @sha256sum lighthouse-deb-build-* .deb
421-
422- @if cmp -s lighthouse-deb-build-1.deb lighthouse-deb-build-2.deb; then \
423- echo " ✅ SUCCESS: cargo-deb packages are identical!" ; \
424- echo " ✅ Reproducible build PASSED" ; \
425- else \
426- echo " ❌ FAILED: cargo-deb packages differ" ; \
427- echo " Running detailed analysis with diffoscope..." ; \
428- diffoscope --text lighthouse-deb-build-1.deb lighthouse-deb-build-2.deb > cargo-deb-diff.txt || true ; \
429- echo " Differences saved to cargo-deb-diff.txt" ; \
430- echo " ❌ Reproducible build FAILED" ; \
431- exit 1; \
432- fi
433371
434- # # Install .deb package locally for testing
435- install-deb-local :
372+ .PHONY : test-deb-reproducible
373+ test-deb-reproducible : # # Test reproducibility of cargo-deb packages
374+ @./scripts/test-deb-reproducible.sh $(RUST_TARGET )
375+
376+
377+ .PHONY : install-deb-local
378+ install-deb-local : # # Install .deb package locally for testing
436379 @PACKAGE=$$(find target/$(RUST_TARGET ) /debian -name "*.deb" | head -1 ) ; \
437380 if [ -n " $$ PACKAGE" ]; then \
438381 echo " Installing lighthouse package: $$ PACKAGE" ; \
@@ -449,22 +392,23 @@ install-deb-local:
449392 echo " ❌ No .deb package found. Run 'make deb-cargo' first." ; \
450393 fi
451394
452- # # Remove installed lighthouse package
453- remove-deb-local :
395+
396+ .PHONY : remove-deb-local
397+ remove-deb-local : # # Remove installed lighthouse package
454398 @echo " Removing lighthouse package..."
455399 sudo dpkg -r lighthouse || true
456400 sudo systemctl daemon-reload || true
457401
458- # # Clean up debian packaging artifacts
459- clean-deb :
402+ .PHONY : clean-deb
403+ clean-deb : # # Clean up debian packaging artifacts
460404 @echo " Cleaning up debian packaging artifacts..."
461405 rm -f lighthouse_* .deb lighthouse-deb-* .deb * -diff.txt
462406 rm -rf target/* /debian/
463407
464- # # Show help for debian packaging
465- help-deb :
408+
409+ .PHONY : help-deb
410+ help-deb : # # Show help for debian packaging
466411 @echo " Clean Debian Packaging Targets:"
467- @echo " install-cargo-deb - Install cargo-deb tool"
468412 @echo " deb-cargo - Build .deb package with cargo-deb"
469413 @echo " deb-cargo-x86_64 - Build x86_64 .deb package"
470414 @echo " deb-cargo-aarch64 - Build aarch64 .deb package"
0 commit comments