From patchwork Mon Jun 17 09:34:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atharva Lele X-Patchwork-Id: 1116921 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YxGsFO4B"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45S5fY1hsvz9sN4 for ; Mon, 17 Jun 2019 19:35:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 47A6987263; Mon, 17 Jun 2019 09:35:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S8r3ZiVECP9A; Mon, 17 Jun 2019 09:35:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id B714E87134; Mon, 17 Jun 2019 09:35:12 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 990381BF3D5 for ; Mon, 17 Jun 2019 09:35:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9644984ADC for ; Mon, 17 Jun 2019 09:35:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lSIf-rhYE9mV for ; Mon, 17 Jun 2019 09:35:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 160DD84ABB for ; Mon, 17 Jun 2019 09:35:11 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id q10so5362267pff.9 for ; Mon, 17 Jun 2019 02:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UHbCGgbnCaapxUoNXe8rhCbJ9nBPhe1gaMS9gxiOyBk=; b=YxGsFO4BF4upqXPc/guk2rZd9sV06UmiiChYp/tkZJyt+xc3Alj5ENysv4XEsXL3v6 Z/nu3zQtk+sENNeZX1vhWUYQ0FMhM1HqJuIp5pYdHHsbaJlnJORxPqY9l7joItE40wXr yoTuX3NHMSx7nFkSqROOIu544Bhsd53jya0a3KyL8lEsObi09gDpUocguvxZYPpGkDbp WLWfdhP6vOvR6loShviJiy/BbuGe03j1DWT3IXxR9Wb2DUxiBt1xK/hQPD4i15ChOmDb o1AJdx3/1K/BHoy+PuERLF4ockXUZ5NivuKmRVPMh0qKutI6MbTEiTouib2/tJkej7q2 vx2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UHbCGgbnCaapxUoNXe8rhCbJ9nBPhe1gaMS9gxiOyBk=; b=NaF4OPiOghdpwckLcJld4id0SdOGHYGGQZFO+zZiWxilT0wgBiRSNy2hhQ+EHRntB6 Tb8w7VGXItu0xrgSM86mllJAH4RZwuQH1RVDGma2Fb09C0TDm9aDfSjUaUTAXpHCI1EU 26kH6+sX2rKJESUAxDyNf8iJMHPNAvQRcSfyaoCXdwb6/gEt9KmqZgxcncJ1402Y9XbL fPZt290N43UwHyzpj/PNfGw2ilpNETeOBfdiLoEvF3AZcOhfTgm2fDJIrNUjwbgd93MU cS6zJAfNCKbQ4Yni7ws8o1/1O/AFUjanRmRuDI75O8XAFloXruACggg/s9P8jrVDKDGA uL6A== X-Gm-Message-State: APjAAAVSHRKzHPuVIgwEONc/Usdw8y5503puiSV9YQVqAOe7hdhaArCF RLxSTqXXH9GRJW0SwmKYhQ93Sb1EvGuwcA== X-Google-Smtp-Source: APXvYqwNlAdNAu/usp84RFxTkFiyH81O+po85Dy3+R+G947cY5lxct1tNGw3qHA6A+LrCxEGkW3F7Q== X-Received: by 2002:aa7:8145:: with SMTP id d5mr114854057pfn.11.1560764110286; Mon, 17 Jun 2019 02:35:10 -0700 (PDT) Received: from localhost.localdomain ([123.201.194.75]) by smtp.gmail.com with ESMTPSA id f3sm4538515pfg.165.2019.06.17.02.35.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 02:35:09 -0700 (PDT) From: Atharva Lele To: buildroot@buildroot.org Date: Mon, 17 Jun 2019 15:04:55 +0530 Message-Id: <20190617093456.6110-3-itsatharva@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190617093456.6110-1-itsatharva@gmail.com> References: <20190617093456.6110-1-itsatharva@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v5 3/4] autobuild-run: initial implementation of do_reproducible_build() X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Atharva Lele , yann.morin.1998@free.fr, thomas.petazzoni@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This new function will call do_build() twice to produce two builds and then check their reproducibility. Signed-off-by: Atharva Lele Reviewed-by: Arnout Vandecappelle (Essensium/Mind) Reviewed-by: Yann E. MORIN --- Changes v3 -> v4: - Remove spaces on empty lines (suggested by Yann) Changes v2 -> v3: - make clean outputs to logfile, similar to other make calls (suggested by y_morin) - Output dir needs abspath (suggested by y_morin) - Directly use make clean as arguments rather than putting it into a variable - Added missing period at end of commit message (suggested by arnout) Changes v1 -> v2: - make clean outputs to devnull (suggested by arnout) - remove unnecessary arguments to make clean (suggested by arnout) --- scripts/autobuild-run | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/scripts/autobuild-run b/scripts/autobuild-run index 3f5af65..339fbde 100755 --- a/scripts/autobuild-run +++ b/scripts/autobuild-run @@ -492,6 +492,43 @@ def do_build(**kwargs): log_write(log, "INFO: build successful") return 0 +def do_reproducible_build(**kwargs): + """Run the builds for reproducibility testing + + Build twice with the same configuration. Calls do_build() to + perform the actual build. + """ + + idir = "instance-%d" % kwargs['instance'] + outputdir = os.path.abspath(os.path.join(idir, "output")) + srcdir = os.path.join(idir, "buildroot") + log = kwargs['log'] + + # Start the first build + log_write(log, "INFO: Reproducible Build Test, starting build 1") + ret = do_build(**kwargs) + if ret != 0: + log_write(log, "INFO: build 1 failed, skipping build 2") + return ret + + # First build has been built, move files and start build 2 + os.rename(os.path.join(outputdir, "images"), os.path.join(outputdir, "images-1")) + + # Clean up build 1 + f = open(os.path.join(outputdir, "logfile"), "w+") + subprocess.call(["make", "O=%s" % outputdir, "-C", srcdir, "clean"], stdout=f, stderr=f) + + # Start the second build + log_write(log, "INFO: Reproducible Build Test, starting build 2") + ret = do_build(**kwargs) + if ret != 0: + log_write(log, "INFO: build 2 failed") + return ret + + # Assuming both have built successfully + ret = check_reproducibility(**kwargs) + return ret + def send_results(result, **kwargs): """Prepare and store/send tarball with results