Commit 725ce40c authored by Holger Levsen's avatar Holger Levsen
Browse files

reproducible OpenWrt: pass 5 of drop all OpenWrt stuff, then rename all LEDE stuff to Openwrt

parent e63ae263
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ elif [[ "$*" =~ ^rsync\ --server\ --sender\ .*\ \.\ /var/lib/jenkins/jobs/.*/wor
elif [[ "$*" =~ ^rsync\ --server\ .*\ \.\ /srv/d-i/isos/ ]] ; then
	exec rsync --server "$3" . "$5" ; croak "Exec failed";
elif [[ "$*" =~ ^rsync\ --server\ .*\ \.\ /srv/workspace/chroots/.* ]] ; then
	# LEDE is using this to share files between master node1 node2.
	# OpenWrt is using this to share files between master node1 node2.
	exec rsync --server "$3" . "$5" ; croak "Exec failed";
elif [[ "$*" =~ ^rsync\ --server\ .*\ \.\ /srv/reproducible-results/.* ]] ; then
	# allow to push files to /srv/reproducible-results/
+3 −7
Original line number Diff line number Diff line
@@ -342,13 +342,9 @@ write_page_intro() {
		write_page "        <p><em>Reproducible Coreboot</em> is an effort to apply this to coreboot. Thus each coreboot.rom is build twice (without payloads), with a few variations added and then those two ROMs are compared using <a href=\"https://tracker.debian.org/diffoscope\">diffoscope</a>. Please note that the toolchain is not varied at all as the rebuild happens on exactly the same system. More variations are expected to be seen in the wild.</p>"
		local PROJECTNAME="$1"
		local PROJECTURL="https://review.coreboot.org/p/coreboot.git"
	elif [ "$1" = "OpenWrt" ] || [ "$1" = "LEDE" ]; then
	elif [ "$1" = "OpenWrt" ] ; then
		local PROJECTNAME="$1"
		if [ "$PROJECTNAME" = "OpenWrt" ] ; then
		local PROJECTURL="https://github.com/openwrt/openwrt.git"
		else
			local PROJECTURL="https://git.lede-project.org/?p=source.git;a=summary"
		fi
		write_page "        <p><em>Reproducible $PROJECTNAME</em> is an effort to apply this to $PROJECTNAME. Thus each $PROJECTNAME target is build twice, with a few variations added and then the resulting images and packages from the two builds are compared using <a href=\"https://tracker.debian.org/diffoscope\">diffoscope</a>. $PROJECTNAME generates many different types of raw <code>.bin</code> files, and diffoscope does not know how to parse these. Thus the resulting diffoscope output is not nearly as clear as it could be - hopefully this limitation will be overcome eventually, but in the meanwhile the input components (uImage kernel file, rootfs.tar.gz, and/or rootfs squashfs) can be inspected. Also please note that the toolchain is not varied at all as the rebuild happens on exactly the same system. More variations are expected to be seen in the wild.</p>"
	elif [ "$1" = "NetBSD" ] ; then
		write_page "        <p><em>Reproducible NetBSD</em> is an effort to apply this to NetBSD. Thus each NetBSD target is build twice, with a few variations added and then the resulting files from the two builds are compared using <a href=\"https://tracker.debian.org/diffoscope\">diffoscope</a>. Please note that the toolchain is not varied at all as the rebuild happens on exactly the same system. More variations are expected to be seen in the wild.</p>"
@@ -443,7 +439,7 @@ write_variation_table() {
		write_page "</td><td>i-capture-the-hostname</td></tr>"
		write_page "<tr><td>domainname</td><td>$(hostname -d)</td><td>i-capture-the-domainname</td></tr>"
	else
		if [ "$1" = "LEDE" ] || [ "$1" != "Arch Linux" ] || [ "$1" != "OpenWrt" ] ; then
		if [ "$1" != "Arch Linux" ] || [ "$1" != "OpenWrt" ] ; then
			write_page "<tr><td>hostname</td><td> profitbricks-build3-amd64 or profitbricks-build4-amd64</td><td>the other one</td></tr>"
		else
			write_page "<tr><td>hostname</td><td colspan=\"2\"> is not yet varied between rebuilds of $1.</td></tr>"
+39 −79
Original line number Diff line number Diff line
@@ -11,16 +11,14 @@ GENERIC_NODE2=profitbricks-build4-amd64.debian.net
OPENWRT_GIT_REPO=https://git.openwrt.org/openwrt/staging/lynxis.git
OPENWRT_GIT_BRANCH=master
DEBUG=false
LEDE_CONFIG=
LEDE_TARGET=
OPENWRT_CONFIG=
OPENWRT_TARGET=

. /srv/jenkins/bin/common-functions.sh
common_init "$@"

# common code defining db access
. /srv/jenkins/bin/reproducible_common.sh
# common code defining functions for OpenWrt/LEDE
. /srv/jenkins/bin/reproducible_lede_common.sh
set -e

# run on jenkins master
@@ -83,11 +81,6 @@ master_cleanup_tmpdirs() {
	fi
}

create_results_dirs() {
	local project=$1
	mkdir -p "$BASE/$project/dbd"
}

node_document_environment() {
	local tmpdir=$1
	local toolchain_html=$tmpdir/toolchain.html
@@ -146,7 +139,7 @@ node_save_logs() {
# RUN - is b1 or b2. b1 for first run, b2 for second
# save the images and packages under $TMPDIR/$RUN
# run on the master
save_lede_results() {
save_openwrt_results() {
	RUN=$1

	# first save all images and target specific packages
@@ -195,29 +188,6 @@ save_lede_results() {
	popd
}

# RUN - is b1 or b2. b1 for first run, b2 for second
# save the images and packages under $TMPDIR/$RUN
save_openwrt_results() {
	RUN=$1
	cd bin
	for i in * ; do
		cd "$i"
		# save images
		mkdir -p "$TMPDIR/$RUN/$i"
		for j in $(find * -name "*.bin" -o -name "*.squashfs") ; do
			cp -p "$j" "$TMPDIR/$RUN/$i/"
		done
		# save packages
		cd packages
		for j in $(find * -name "*.ipk") ; do
			mkdir -p "$TMPDIR/$RUN/$i/$(dirname "$j")"
			cp -p "$j" "$TMPDIR/$RUN/$i/$(dirname "$j")/"
		done
		cd ../..
	done
	cd ..
}

# apply variations change the environment for
# the subsequent run
# RUN - b1 or b2. b1 for first run, b2 for the second
@@ -268,7 +238,7 @@ openwrt_build_toolchain() {
	ionice -c 3 make $OPTIONS toolchain/install
}

# TYPE - openwrt or lede
# TYPE - openwrt or openwrt
# RUN - b1 or b2. b1 means first run, b2 second
# TARGET - a target including subtarget. E.g. ar71xx_generic
openwrt_compile() {
@@ -291,14 +261,14 @@ openwrt_compile() {
openwrt_create_signing_keys() {
	echo "============================================================================="
	cat <<- EOF
# LEDE signs the release with a signing key, but generate the signing key if not
# OpenWrt signs the release with a signing key, but generate the signing key if not
# present. To have a reproducible release we need to take care of signing keys.

# LEDE will also put the key-build.pub into the resulting image (pkg: base-files)!
# OpenWrt will also put the key-build.pub into the resulting image (pkg: base-files)!
# At the end of the build it will use the key-build to sign the Packages repo list.
# Use a workaround this problem:

# key-build.pub contains the pubkey of LEDE buildbot
# key-build.pub contains the pubkey of OpenWrt buildbot
# key-build     contains our build key

# Meaning only signed files will be different but not the images.
@@ -314,8 +284,8 @@ EOF
	echo "\n# public key"
	echo -e 'untrusted comment: Local build key\nRWQ/EgKaN9SUNja2aAZ5VyPiElHhzG1GhZjs8wUewfbvy4V9ygJi7Kz3' | tee key-build.pub

	echo "# override the pubkey with 'LEDE usign key for unattended build jobs' to have the same base-files pkg and images"
	echo -e 'untrusted comment: LEDE usign key for unattended build jobs\nRWS1BD5w+adc3j2Hqg9+b66CvLR7NlHbsj7wjNVj0XGt/othDgIAOJS+' | tee key-build.pub
	echo "# override the pubkey with 'OpenWrt usign key for unattended build jobs' to have the same base-files pkg and images"
	echo -e 'untrusted comment: OpenWrt usign key for unattended build jobs\nRWS1BD5w+adc3j2Hqg9+b66CvLR7NlHbsj7wjNVj0XGt/othDgIAOJS+' | tee key-build.pub
	echo "============================================================================="
}

@@ -340,7 +310,7 @@ openwrt_download() {
	echo "$(date -u) - received git version $(git log -1 --pretty=oneline)"
	echo "================================================================================"

	# otherwise LEDE will generate new release keys every build
	# otherwise OpenWrt will generate new release keys every build
	openwrt_create_signing_keys

	# update feeds
@@ -370,12 +340,11 @@ openwrt_get_banner() {
}

# openwrt_build is run on a remote host
# TYPE - openwrt or lede
# TYPE - openwrt or openwrt
# RUN - b1 or b2. b1 means first run, b2 second
# TARGET - a target including subtarget. E.g. ar71xx_generic
# CONFIG - a simple basic .config as string. Use \n to seperate lines
# TMPPATH - is a unique path generated with mktmp
# lede has a different output directory than openwrt
openwrt_build() {
	local TYPE=$1
	local RUN=$2
@@ -386,7 +355,7 @@ openwrt_build() {

	mv "$TMPDIR/download" "$TMPBUILDDIR"

	# openwrt/lede is checkouted under /download
	# openwrt is checked out under /download
	cd "$TMPBUILDDIR/source"

	# set tz, date, core, ..
@@ -397,18 +366,16 @@ openwrt_build() {
	openwrt_compile "$TYPE" "$RUN" "$TARGET"

	# save the results
	[ "$TYPE" = "lede" ] && save_lede_results "$RUN"
	[ "$TYPE" = "openwrt" ] && save_openwrt_results "$RUN"

	# copy logs
	node_save_logs "$TMPDIR"
}

# build openwrt/lede on two different hosts
# build openwrt/openwrt on two different hosts
# TARGET a target including subtarget. E.g. ar71xx_generic
# CONFIG - a simple basic .config as string. Use \n to seperate lines
# TYPE - openwrt or lede
# lede has a different output directory than openwrt
# TYPE - openwrt or openwrt
build_two_times() {
	TYPE=$1
	TARGET=$2
@@ -488,8 +455,8 @@ case $1 in
	;;
	master)
		# master code following
		LEDE_TARGET=$2
		LEDE_CONFIG=$3
		OPENWRT_TARGET=$2
		OPENWRT_CONFIG=$3
	;;
	*)
		echo "Unsupported mode $1. Arguments are $*"
@@ -502,20 +469,17 @@ esac
#
DATE=$(date -u +'%Y-%m-%d')
START=$(date +'%s')
TMPBUILDDIR=$(mktemp --tmpdir=/srv/workspace/chroots/ -d -t "rbuild-lede-build-${DATE}-XXXXXXXX")  # used to build on tmpfs
RESULTSDIR=$(mktemp --tmpdir=/srv/reproducible-results -d -t rbuild-lede-results-XXXXXXXX)  # accessable in schroots, used to compare results
TMPBUILDDIR=$(mktemp --tmpdir=/srv/workspace/chroots/ -d -t "rbuild-openwrt-build-${DATE}-XXXXXXXX")  # used to build on tmpfs
RESULTSDIR=$(mktemp --tmpdir=/srv/reproducible-results -d -t rbuild-openwrt-results-XXXXXXXX)  # accessable in schroots, used to compare results
BANNER_HTML=$(mktemp "--tmpdir=$RESULTSDIR")
trap master_cleanup_tmpdirs INT TERM EXIT

cd "$TMPBUILDDIR"

create_results_dirs lede
mkdir -p "$BASE/openwrt/dbd"

build_two_times lede "$LEDE_TARGET" "$LEDE_CONFIG"

# for now we only build one architecture until it's at most reproducible
#build_two_times x86_64 "CONFIG_TARGET_x86=y\nCONFIG_TARGET_x86_64=y\n"
#build_two_times ramips_rt288x_RTN15 "CONFIG_TARGET_ramips=y\nCONFIG_TARGET_ramips_rt288x=y\nCONFIG_TARGET_ramips_rt288x_RTN15=y\n"
build_two_times openwrt "$OPENWRT_TARGET" "$OPENWRT_CONFIG"

#
# create html about toolchain used
@@ -528,14 +492,14 @@ echo "==========================================================================
TOOLCHAIN_HTML=$RESULTSDIR/toolchain.html

# clean up builddir to save space on tmpfs
rm -rf "$TMPBUILDDIR/lede"
rm -rf "$TMPBUILDDIR/openwrt"

# run diffoscope on the results
# (this needs refactoring rather badly)
TIMEOUT="30m"
DIFFOSCOPE="$(schroot --directory /tmp -c "chroot:jenkins-reproducible-${DBDSUITE}-diffoscope" diffoscope -- --version 2>&1)"
echo "============================================================================="
echo "$(date -u) - Running $DIFFOSCOPE on LEDE images and packages."
echo "$(date -u) - Running $DIFFOSCOPE on OpenWrt images and packages."
echo "============================================================================="
DBD_HTML=$(mktemp "--tmpdir=$RESULTSDIR")
DBD_GOOD_PKGS_HTML=$(mktemp "--tmpdir=$RESULTSDIR")
@@ -568,7 +532,7 @@ for target in * ; do
			let ALL_IMAGES+=1
			if [ ! -f "$RESULTSDIR/b1/targets/$target/$subtarget/$image" ] || [ ! -f "$RESULTSDIR/b2/targets/$target/$subtarget/$image" ] ; then
				echo "         <tr><td><img src=\"/userContent/static/weather-storm.png\" alt=\"ftbfs icon\" /> $image (${SIZE}) failed to build.</td></tr>" >> "$DBD_HTML"
				rm -f "$BASE/lede/dbd/targets/$target/$subtarget/$image.html" # cleanup from previous (unreproducible) tests - if needed
				rm -f "$BASE/openwrt/dbd/targets/$target/$subtarget/$image.html" # cleanup from previous (unreproducible) tests - if needed
				continue
			fi

@@ -580,14 +544,14 @@ for target in * ; do
			fi
			get_filesize "$image"
			if [ -f "$RESULTSDIR/targets/$target/$subtarget/$image.html" ] ; then
				mkdir -p "$BASE/lede/dbd/targets/$target/$subtarget"
				mv "$RESULTSDIR/targets/$target/$subtarget/$image.html" "$BASE/lede/dbd/targets/$target/$subtarget/$image.html"
				mkdir -p "$BASE/openwrt/dbd/targets/$target/$subtarget"
				mv "$RESULTSDIR/targets/$target/$subtarget/$image.html" "$BASE/openwrt/dbd/targets/$target/$subtarget/$image.html"
				echo "         <tr><td><a href=\"dbd/targets/$target/$subtarget/$image.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $image</a> (${SIZE}) is unreproducible.</td></tr>" >> "$DBD_HTML"
			else
				SHASUM=$(sha256sum "$image" |cut -d " " -f1)
				echo "         <tr><td><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $image ($SHASUM, $SIZE) is reproducible.</td></tr>" >> "$DBD_HTML"
				let GOOD_IMAGES+=1
				rm -f "$BASE/lede/dbd/targets/$target/$subtarget/$image.html" # cleanup from previous (unreproducible) tests - if needed
				rm -f "$BASE/openwrt/dbd/targets/$target/$subtarget/$image.html" # cleanup from previous (unreproducible) tests - if needed
			fi
		done
		cd ..
@@ -613,7 +577,7 @@ for i in * ; do
		let ALL_PACKAGES+=1
		if [ ! -f "$RESULTSDIR/b1/$i/$j" ] || [ ! -f "$RESULTSDIR/b2/$i/$j" ] ; then
			echo "         <tr><td><img src=\"/userContent/static/weather-storm.png\" alt=\"ftbfs icon\" /> $j (${SIZE}) failed to build.</td></tr>" >> "$DBD_BAD_PKGS_HTML"
			rm -f "$BASE/lede/dbd/$i/$j.html" # cleanup from previous (unreproducible) tests - if needed
			rm -f "$BASE/openwrt/dbd/$i/$j.html" # cleanup from previous (unreproducible) tests - if needed
			continue
		fi

@@ -624,14 +588,14 @@ for i in * ; do
		fi
		get_filesize "$j"
		if [ -f "$RESULTSDIR/$i/$j.html" ] ; then
			mkdir -p "$BASE/lede/dbd/$i/$(dirname "$j")"
			mv "$RESULTSDIR/$i/$j.html" "$BASE/lede/dbd/$i/$j.html"
			mkdir -p "$BASE/openwrt/dbd/$i/$(dirname "$j")"
			mv "$RESULTSDIR/$i/$j.html" "$BASE/openwrt/dbd/$i/$j.html"
			echo "         <tr><td><a href=\"dbd/$i/$j.html\"><img src=\"/userContent/static/weather-showers-scattered.png\" alt=\"unreproducible icon\" /> $j</a> ($SIZE) is unreproducible.</td></tr>" >> "$DBD_BAD_PKGS_HTML"
		else
			SHASUM=$(sha256sum "$j" |cut -d " " -f1)
			echo "         <tr><td><img src=\"/userContent/static/weather-clear.png\" alt=\"reproducible icon\" /> $j ($SHASUM, $SIZE) is reproducible.</td></tr>" >> "$DBD_GOOD_PKGS_HTML"
			let GOOD_PACKAGES+=1
			rm -f "$BASE/lede/dbd/$i/$j.html" # cleanup from previous (unreproducible) tests - if needed
			rm -f "$BASE/openwrt/dbd/$i/$j.html" # cleanup from previous (unreproducible) tests - if needed
		fi
	done
	cd ..
@@ -653,20 +617,16 @@ fi
#
#  finally create the webpage
#
cd "$RESULTSDIR" ; mkdir lede
PAGE=lede/lede_$LEDE_TARGET.html
cd "$RESULTSDIR" ; mkdir openwrt
PAGE=openwrt/openwrt_$OPENWRT_TARGET.html
cat > "$PAGE" <<- EOF
<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>Reproducible LEDE ?</title>
    <link rel="stylesheet" href="foundation.css"/>
    <link rel="stylesheet" href="font-awesome.css"/>
    <link rel="stylesheet" href="coderay.css"/>
    <link rel="stylesheet" href="asciidoctor.css"/>
    <link rel="stylesheet" href="lede.css"/>
    <title>Reproducible OpenWrt ?</title>
    <link rel='stylesheet' id='kamikaze-style-css'  href='cascade.css?ver=4.0' type='text/css' media='all'>
  </head>
  <body>
    <div id="content">
@@ -675,22 +635,22 @@ EOF
cat "$BANNER_HTML" >> "$PAGE"
write_page "       </pre>"
write_page "     </div><div id=\"main-content\">"
write_page "       <h1>LEDE - <em>reproducible</em> wireless freedom$MAGIC_SIGN</h1>"
write_page_intro LEDE
write_page "       <h1>OpenWrt - <em>reproducible</em> wireless freedom$MAGIC_SIGN</h1>"
write_page_intro OpenWrt
write_page "       <p>$GOOD_IMAGES ($GOOD_PERCENT_IMAGES%) out of $ALL_IMAGES built images and $GOOD_PACKAGES ($GOOD_PERCENT_PACKAGES%) out of $ALL_PACKAGES built packages were reproducible in our test setup."
write_page "        These tests were last run on $DATE for version ${OPENWRT_VERSION} using ${DIFFOSCOPE}.</p>"
write_variation_table LEDE
write_variation_table OpenWrt
cat "$DBD_HTML" >> "$PAGE"
cat "$TOOLCHAIN_HTML" >> "$PAGE"
write_page "    </div>"
write_page_footer LEDE
write_page_footer OpenWrt
publish_page
rm -f "$DBD_HTML" "$DBD_GOOD_PKGS_HTML" "$DBD_BAD_PKGS_HTML" "$TOOLCHAIN_HTML" "$BANNER_HTML"

# the end
calculate_build_duration
print_out_duration
for CHANNEL in reproducible-builds lede-dev ; do
for CHANNEL in reproducible-builds openwrt-devel ; do
	irc_message $CHANNEL "$REPRODUCIBLE_URL/$PAGE has been updated. ($GOOD_PERCENT_IMAGES% images and $GOOD_PERCENT_PACKAGES% packages reproducible in our current test framework.)"
done
echo "============================================================================="
+12 −12
Original line number Diff line number Diff line
@@ -584,24 +584,24 @@

        - '{name}_{otherproject_artifacts}':
            otherproject_artifacts:
                - 'lede-target-ar71xx':
                - 'openwrt-target-ar71xx':
                    my_timed: '42 21 * * 4'
                    my_lede_config: 'CONFIG_TARGET_ar71xx=y'
                    my_lede_target: 'ar71xx'
                - 'lede-target-ramips':
                    my_openwrt_config: 'CONFIG_TARGET_ar71xx=y'
                    my_openwrt_target: 'ar71xx'
                - 'openwrt-target-ramips':
                    my_timed: '42 23 * * 4'
                    my_lede_config: 'CONFIG_TARGET_ramips=y'
                    my_lede_target: 'ramips'
                - 'lede-target-x86':
                    my_openwrt_config: 'CONFIG_TARGET_ramips=y'
                    my_openwrt_target: 'ramips'
                - 'openwrt-target-x86':
                    my_timed: '42 1 * * 5'
                    my_lede_config: 'CONFIG_TARGET_x86=y'
                    my_lede_target: 'x86'
            my_description: 'Rebuild LEDE (one target, some packages) twice (with variations) and investigate regarding reproducibility.'
            my_shell: '/srv/jenkins/bin/reproducible_lede.sh master {my_lede_target} {my_lede_config}'
                    my_openwrt_config: 'CONFIG_TARGET_x86=y'
                    my_openwrt_target: 'x86'
            my_description: 'Rebuild OpenWrt (one target, some packages) twice (with variations) and investigate regarding reproducibility.'
            my_shell: '/srv/jenkins/bin/reproducible_openwrt.sh master {my_openwrt_target} {my_openwrt_config}'
            my_trigger: ''
            my_hname: ''
            my_recipients: 'jenkins+reproducible-builds qa-jenkins-scm@lists.alioth.debian.org lynxis@fe80.eu'
            my_blocker: '^reproducible_(lede).*'
            my_blocker: '^reproducible_openwrt.*'

        - '{name}_{otherproject_triggering}':
            otherproject_triggering:
+0 −398

File deleted.

Preview size limit exceeded, changes collapsed.

Loading