Merge branch 'reproducible-build-windows' (unfinished)

This commit is contained in:
Georges Dupéron 2018-09-22 23:09:41 +02:00
commit 1b36f8e98b
No known key found for this signature in database
GPG Key ID: C7976374130A80F7
3 changed files with 30 additions and 8 deletions

View File

@ -27,7 +27,7 @@ define date_command
fi fi
endef endef
commit_timestamp = "$$(${call date_command,"${COMMIT_TIMESTAMP_ISO_8601}",'+%Y%m%d%H%m.%S'})" commit_timestamp = "$$(${call date_command,"${COMMIT_TIMESTAMP_ISO_8601}",'+%Y%m%d%H%m.%S'})"
commit_faketime = "$$(${call date_command,"${COMMIT_TIMESTAMP_ISO_8601}",'+%Y-%m-%d %H:%m:%S'})" commit_timestamp_iso_8601 = ${COMMIT_TIMESTAMP_ISO_8601}
offset_names = bytes_os_size \ offset_names = bytes_os_size \
bytes_mbr_start \ bytes_mbr_start \
@ -222,7 +222,7 @@ ${bld}/os.iso: ${bld}/iso_files/os.zip ${bld}/iso_files/boot/iso_boot.sys ./util
! test -d ${bld}/iso_files.tmp ! test -d ${bld}/iso_files.tmp
cp -a ${cp_T_option} -- ${bld}/iso_files ${bld}/iso_files.tmp cp -a ${cp_T_option} -- ${bld}/iso_files ${bld}/iso_files.tmp
find ${bld}/iso_files.tmp -depth -exec touch -t ${commit_timestamp} '{}' ';' find ${bld}/iso_files.tmp -depth -exec touch -t ${commit_timestamp} '{}' ';'
UTILS="$$PWD/utils" (cd ./${bld}/iso_files.tmp/ && faketime -f ${commit_faketime} $$UTILS/mkisofs \ UTILS="$$PWD/utils" ./utils/faketime.sh ${commit_timestamp_iso_8601} sh -c '(cd ./${bld}/iso_files.tmp/ && "$$UTILS/mkisofs" \
--input-charset utf-8 \ --input-charset utf-8 \
-rock \ -rock \
-joliet \ -joliet \
@ -232,7 +232,7 @@ ${bld}/os.iso: ${bld}/iso_files/os.zip ${bld}/iso_files/boot/iso_boot.sys ./util
-boot-load-size 4 \ -boot-load-size 4 \
-pad \ -pad \
-output ../os.iso \ -output ../os.iso \
.) .)'
rm -- ${bld}/iso_files.tmp/os.zip \ rm -- ${bld}/iso_files.tmp/os.zip \
${bld}/iso_files.tmp/boot/iso_boot.sys ${bld}/iso_files.tmp/boot/iso_boot.sys
rmdir ${bld}/iso_files.tmp/boot/ rmdir ${bld}/iso_files.tmp/boot/
@ -301,12 +301,12 @@ os_fat12_partition = "$@@@${bytes_fat12_start}"
${bld}/os.fat12: ${bld}/os.zip ${dep_bytes_fat12_size} ${dep_bytes_fat12_start} ${dep_sectors_os_size} \ ${bld}/os.fat12: ${bld}/os.zip ${dep_bytes_fat12_size} ${dep_bytes_fat12_start} ${dep_sectors_os_size} \
./utils/mformat ./utils/mcopy ${bld}/check_makefile ./utils/mformat ./utils/mcopy ${bld}/check_makefile
set -x; dd if=/dev/zero bs=${sector_size} count=${sectors_os_size} of=$@ set -x; dd if=/dev/zero bs=${sector_size} count=${sectors_os_size} of=$@
faketime -f ${commit_faketime} ./utils/mformat -v "Example OS" \ ./utils/faketime.sh ${commit_timestamp_iso_8601} ./utils/mformat -v "Example OS" \
-T ${sectors_fat12_size} \ -T ${sectors_fat12_size} \
-h ${os_floppy_chs_h} \ -h ${os_floppy_chs_h} \
-s ${os_floppy_chs_s} \ -s ${os_floppy_chs_s} \
-i ${os_fat12_partition} -i ${os_fat12_partition}
faketime -f ${commit_faketime} ./utils/mcopy -i ${os_fat12_partition} $< "::os.zip" ./utils/faketime.sh ${commit_timestamp_iso_8601} ./utils/mcopy -i ${os_fat12_partition} $< "::os.zip"
${bld}/iso_files/os.zip: ${bld}/os.zip ${bld}/check_makefile ${bld}/iso_files/os.zip: ${bld}/os.zip ${bld}/check_makefile
# TODO: make it so that the various file formats are mutual quines: # TODO: make it so that the various file formats are mutual quines:

View File

@ -1,7 +1,5 @@
max_jobs: 1 max_jobs: 1
# Are both necessary?
shallow_clone: true shallow_clone: true
clone_depth: 1
image: Visual Studio 2015 image: Visual Studio 2015
@ -24,7 +22,7 @@ install:
- cmd: cd .. - cmd: cd ..
- cmd: set PATH=%cd%\gdisk\;%PATH% - cmd: set PATH=%cd%\gdisk\;%PATH%
# mkisofs,zip,ImageMagick # mkisofs,zip,ImageMagick
- cmd: C:\cygwin\setup-x86.exe --no-replaceonreboot --no-shortcuts --quiet-mode --root c:\cygwin --packages mkisofs,genisoimage,zip,ImageMagick,xorg-server-extra - cmd: C:\cygwin\setup-x86.exe --no-replaceonreboot --no-shortcuts --quiet-mode --root c:\cygwin --packages mkisofs,genisoimage,zip,ImageMagick,xorg-server-extra,datefudge
- cmd: C:\cygwin\bin\find C:\cygwin -iname "import*" - cmd: C:\cygwin\bin\find C:\cygwin -iname "import*"
- cmd: C:\cygwin\bin\find C:\cygwin -iname "convert*" - cmd: C:\cygwin\bin\find C:\cygwin -iname "convert*"
# mtools # mtools

24
utils/faketime.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -euET -o pipefail
timestamp_iso_8601="$1"
shift
date_command() {
# TODO: substring or case … in Darwin*)
if test "$(uname -s)" = Darwin; then
date -j -f '%Y-%m-%dT%H:%M:%S' "$(echo "${1}" | cut -c 1-19)" "${2}";
else
date -d "${1}" "${2}";
fi
}
if which faketime >/dev/null; then
( set -x; faketime -f "$(date_command "${timestamp_iso_8601}" '+%Y-%m-%d %H:%m:%S')" "$@"; )
elif which datefudge >/dev/null; then
( set -x; datefudge --static "${timestamp_iso_8601}" "$@"; )
else
echo "ERROR: command faketime or datefudge not found. Please install either command."
exit 1
fi