From patchwork Mon Dec 16 20:46:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via arch-projects X-Patchwork-Id: 1411 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id D49D615AF8C50 for ; Mon, 16 Dec 2019 20:47:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.3 (2019-12-06) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001, T_DMARC_POLICY_NONE=0.01 autolearn=ham autolearn_force=no version=3.4.3 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 16 Dec 2019 20:47:04 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 4294017468DB25; Mon, 16 Dec 2019 20:46:41 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id 75E4517468DAD5; Mon, 16 Dec 2019 20:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1576529194; bh=eUN3eWBQMMAe+prMVHGB56+Sr0zuEnUWZiI4TNgvoAg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc; b=Uuy+oh+qhPKbNUHF5l0fNQ7m8/plcpCBAMPxA/pTRlFMbyEz7hKSFNnAvQM3LZq9T E8LAS4QlZefoG0VS/KL8B1cdurx8SvxP+t6rBEPhtvnnfNMY5HI2tobV/WKVjj/ZyI 2aLq0IZA/B+aMfESytPyz57+Pm1sFqnUDe90OfJE6tbiFK3+lX6t18BlB43rvqj4jf RoDC2hMWqv6E9UFPmKJGaBLN17IEnb4raHE7qlEqzGMdCjaQjZEIUctMqv8HDk8nVX bcf26FX4e8YfigUJTrQgjkH2VuoCk0LzBd1mxF12dhMAMm38HpKfQ8im+CQ82LQNgf 88Og/hZJCWU7oszx0spro25RgqKCk1ZvPxiY+lvENQjMUOe3ZzWSEerJOMHo4BkYQQ AMT9lW4i6PGUtQrBX2y6R3Hes+r1+omxV4kOqV26HCn1gbQ/Kw2fcnK2r3dM70Gowm ivPJVJAg8ac2bO6xPVSrhWgAqTTwL5BgK2li8V0/X9CLLyrGLyQpzCUqBgWTpd7NiN 9JoVdGPDkOjYdRyX8wZt5wPjoYdjbCnY7GRxclyU8+XP/nplU67T0J+wv5XarY1eZg 06NojE1GXQYiSraREXUL1TqxQb9FhLhVo/dZz2f513RBEi22DlQcPtWmDsC19/4if7 GR8KQtzEXNyu0fO9bZKcvIZE= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 407762B794; Mon, 16 Dec 2019 20:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1576529194; bh=eUN3eWBQMMAe+prMVHGB56+Sr0zuEnUWZiI4TNgvoAg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc; b=GcxlxNsqhhkOOEA4KTDYT1pkSbX3pc04pQ9ShCYUc4Z++Uz2FFHWSTv78ZS28s+PM 5iHjfNRNOvueS2/1i6EHpamqWeBCfJbB3lZx+BxAtAGL2+enBAzaUTxT3EED9M2vqI coLsnBFShHbSY+3j7FEGxZfwp+FuXAKAxiboEfeEkRj80vk41GkTm61JeYuvfq7TMC UY1LGstBDihNFoNGnLwkM9lc/t+saLoBHrYGPhskJiP0ghVjtXBxPXpiFZj5x7ufRy 1nLcQMQurXeREtm2tNmB0c964rpCtXvT0/tlTfa+Y6dCBmkuYCAgVx16IpdILLt2Aj FChfwdbXbn3WAivFmUwcoQVZhXWKxlKlOr92lEzBv0mx9kqkwOjCdiIJ3DLOHsrFYv XnujhFS3asBFnJ3J5lzE8Wm68VaTWzaDIQU//wHR743Z0N3PB7scVoLMexAZtLjyLS ApMGD8cPGjBxxhSZNLR4oLcn9PmCyfcT+CWkaDw1hS7byE0sxEOVXOcEe3RI2JvkFY xqEYwvgZX1Kb2lNPqGuq/zhlsVBrcqxZbQ3MTIDWA/pdCaK18s8gVBjMhsZAO0BTSC uDjnA5+LmBcK6fxA8aIlLbtBSj74bWhgfc/9UkT0siNkjVG5JmbTpzjU/RQsDDtYcX P5FnSO8SwVaKJHq4RJlfqECc= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 2DE5E2B78C for ; Mon, 16 Dec 2019 20:46:31 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 16 Dec 2019 20:46:31 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id BE28617468DABD; Mon, 16 Dec 2019 20:46:29 +0000 (UTC) Received: from didactylos.attlocal.net (unknown [IPv6:2600:1700:57f0:ca20:763a:c795:fcf6:91ea]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: eschwartz) by orion.archlinux.org (Postfix) with ESMTPSA id 2F35B17468DABB; Mon, 16 Dec 2019 20:46:29 +0000 (UTC) To: arch-projects@archlinux.org Date: Mon, 16 Dec 2019 15:46:08 -0500 Message-Id: <20191216204609.111647-3-eschwartz@archlinux.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216204609.111647-1-eschwartz@archlinux.org> References: <20191216204609.111647-1-eschwartz@archlinux.org> MIME-Version: 1.0 Subject: [arch-projects] [devtools] [PATCH 2/3] makerepropkg: add support to check unreproducible packages using diffoscope X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Eli Schwartz via arch-projects Reply-To: Arch Linux projects development discussion Cc: Eli Schwartz Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" Signed-off-by: Eli Schwartz --- doc/makerepropkg.1.asciidoc | 3 +++ makerepropkg.in | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/makerepropkg.1.asciidoc b/doc/makerepropkg.1.asciidoc index 7d68e5e..301b73e 100644 --- a/doc/makerepropkg.1.asciidoc +++ b/doc/makerepropkg.1.asciidoc @@ -26,6 +26,9 @@ link:https://reproducible-builds.org/[Reproducible Builds] project. Options ------- +*-d*:: + If packages are not reproducible, compare them using diffoscope. + *-c*:: Set the pacman cache directory. diff --git a/makerepropkg.in b/makerepropkg.in index 2b0945e..60fee95 100755 --- a/makerepropkg.in +++ b/makerepropkg.in @@ -29,6 +29,7 @@ declare -a buildenv buildopts installed installpkgs archiveurl='https://archive.archlinux.org/packages' buildroot=/var/lib/archbuild/reproducible chroot=testenv +diffoscope=0 parse_buildinfo() { local line var val @@ -94,14 +95,16 @@ package, including the .PKGINFO as well as the buildinfo. For more details see https://reproducible-builds.org/ OPTIONS + -d Run diffoscope if the package is unreproducible -c Set pacman cache -M Location of a makepkg config file -h Show this usage message __EOF__ } -while getopts 'M:c:h' arg; do +while getopts 'dM:c:h' arg; do case "$arg" in + d) diffoscope=1 ;; M) archroot_args+=(-M "$OPTARG") ;; c) cache_dirs+=("$OPTARG") ;; h) usage; exit 0 ;; @@ -177,12 +180,17 @@ arch-nspawn "${buildroot}/${chroot}" \ if (( $? == 0 )); then msg2 "built succeeded! built packages can be found in ${buildroot}/${chroot}/pkgdest" msg "comparing artifacts..." - if cmp -s "${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}"; then + + comparefiles=("${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}") + if cmp -s "${comparefiles[@]}"; then msg2 "Package successfully reproduced!" exit 0 else warning "Package is not reproducible. :(" - sha256sum "${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}" + sha256sum "${comparefiles[@]}" + if (( diffoscope )); then + diffoscope "${comparefiles[@]}" + fi fi fi