From patchwork Mon Dec 16 20:46:09 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: 1412 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 AD32715AF8C5D for ; Mon, 16 Dec 2019 20:47:09 +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:09 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 41CB317468DB3B; Mon, 16 Dec 2019 20:46:44 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (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 BE86F17468DAE5; Mon, 16 Dec 2019 20:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1576529195; bh=287GbpEFfUYXQ7duoU92aDJxrYDVtnAu142Z5vBAHD8=; 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=A1IhFSz2+EF9EtOuyKPqjcF4rqW89mkApSFN27uKLe5Ss4DdFpX45/eQSy2QHgl08 8rGyNhC8ybi/fn9CugreBbMBWMWaP1WRRZmwb7nzjvEu5MhJAnkJnvKvLtCgZidBeJ YcaTTtVBfd0QUaPDp4XvdgIosArLEbZk+sCxMOvd5H/wxEu1aIAjNXOkrQZsQCwMt/ M3MFQeyisToiBHz/Bl//OQkYIFb3LX+kidtTh2uukorPCbRJIDqqyTuE0gCVqV9eHX ykNly/9UOBAr0UVl7M10j5OD9pxi/t//istE5Gk6ax3MGhOHn+kv5CtBz3G19AN6rI WpO4yKsNxEFJax5EzywrBYDay9q0uxTq6HraG0Ww3mf08rznvQaLl+cLRyb3Mxbmsy ap/GnwoeJSrdzdyMsvYi7ooDalPR5CJTmNOncljkRHFI44aheiOxFnh2Tlt+CN3kQi wIjvTVV+TUPg1lNX9BPkbcfjZAR04YhRC3Gs7lagcjabq7Zf/2ZQpkkzzTLeBFvQxw r2mQFqAFHz9DlMDhYKX7ErI0Nf+WwlIjYFdkgROQSIOmD7Lj/B+JpWo1RCUlnyrHB6 OvziwdRrxrDBTq4e6T3vDPX37wtJBeHK/DQaUavaG6ECB3MClvvE6dLiC72xFDoseh y0egbUjY03/5oa73sdMdlAJM= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id AE0342B79A; Mon, 16 Dec 2019 20:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1576529195; bh=287GbpEFfUYXQ7duoU92aDJxrYDVtnAu142Z5vBAHD8=; 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=RY1u8RSCDryH4hNvb3L9aO3vTG/otxF0oWccp/MHstMf/1rijyzcSLzX7LoEKY68D +zBcl7Plfu8InjTsT1Slo4hxSX/dQfwYasGw0dmI1vi8Jm6thRWfVlB6BSGYr8MUmD 0BRBlPRYuzlvmeKsgGZ0es/TmQNl0zlo4eCwMMKauMGYxAxRmUov2aPFmS3BKxj1+v vtlLxwVGi1q8j11Ki/XjoOBFvup5xogYhXJk/SmApv52mHPE6XjTqN9q4fdh4IcX5G rW/dF9J/HvPXlIYvGk3Qww/KpZ6fl8zLDUBte07mvbFkmYTZ5W73oQgb0OcPCY0W0I T8R96WfTuKWAlFtHDFxAhviBk9aWuXBKskmarn8jT5WemjQYlt3qkvmKPLcVyzrzMK 5jZogWv8N8/yOdI/iKAuyN5jTNxhKy9KwKaT0I3fS/a5ZcaIkp2aNKsoiKoUmf5GxN 7eeXFveOl3r6LO0kax3WsYfojrHqw7JfNVAE+Sq+9ELyxogDn+z5Prl1+Pq49DUB25 DFxfR+tiXyLihsb1yYTf1Gm/7r4pN/h/OUaI3kJ4UDSxFVqEwfctDb0upqmzp/GKg4 kmPHaU0anr9CGbByrnMEnmmNR2hVGHXIEPvCxO+35bwLoKtDplDHTNy5V7Iqkhlo67 i2JQGAJ6K1+Sx4ByCtUNYPw0= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id DDFD22B794 for ; Mon, 16 Dec 2019 20:46:31 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) 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 79CE517468DAC0; Mon, 16 Dec 2019 20:46:30 +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 EAE6917468DABE; Mon, 16 Dec 2019 20:46:29 +0000 (UTC) To: arch-projects@archlinux.org Date: Mon, 16 Dec 2019 15:46:09 -0500 Message-Id: <20191216204609.111647-4-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 3/3] makerepropkg: support checking multiple split packages 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" By specifying multiple package files, we assume they are all from the same PKGBUILD, and try to check them all against the produced artifacts. Since the buildinfo should be comparable for all of them, we simply use the first one passed on the command line. Signed-off-by: Eli Schwartz --- doc/makerepropkg.1.asciidoc | 8 ++++++-- makerepropkg.in | 40 +++++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/doc/makerepropkg.1.asciidoc b/doc/makerepropkg.1.asciidoc index 301b73e..0d7ddcb 100644 --- a/doc/makerepropkg.1.asciidoc +++ b/doc/makerepropkg.1.asciidoc @@ -7,12 +7,12 @@ makerepropkg - Rebuild a package to see if it is reproducible Synopsis -------- -makerepropkg [OPTIONS] +makerepropkg [OPTIONS] ... Description ----------- -Given the path to a built pacman package, attempt to rebuild it using the +Given the path to a built pacman package(s), attempt to rebuild it using the PKGBUILD in the current directory. The package will be built in an environment as closely matching the environment of the initial package as possible, by building up a chroot to match the information exposed in the package's @@ -20,6 +20,10 @@ linkman:BUILDINFO[5] manifest. On success, the resulting package will be compared to the input package, and makerepropkg will report whether the artifacts are identical. +When given multiple packages, additional package files are assumed to be split +packages and will be treated as additional artifacts to compare during the +verification step. + This implements a verifier for pacman/libalpm packages in accordance with the link:https://reproducible-builds.org/[Reproducible Builds] project. diff --git a/makerepropkg.in b/makerepropkg.in index 60fee95..51c2dd2 100755 --- a/makerepropkg.in +++ b/makerepropkg.in @@ -117,10 +117,13 @@ check_root if [[ -n $1 ]]; then pkgfile="$1" - if ! bsdtar -tqf "${pkgfile}" .BUILDINFO >/dev/null 2>&1; then - error "file is not a valid pacman package: '%s'" "${pkgfile}" - exit 1 - fi + splitpkgs=("$@") + for f in "${splitpkgs[@]}"; do + if ! bsdtar -tqf "${f}" .BUILDINFO >/dev/null 2>&1; then + error "file is not a valid pacman package: '%s'" "${f}" + exit 1 + fi + done else error "no package file specified. Try '${BASH_SOURCE[0]##*/} -h' for more information. " exit 1 @@ -176,23 +179,26 @@ arch-nspawn "${buildroot}/${chroot}" \ --bind="${PWD}:/startdir" \ --bind="${SRCDEST}:/srcdest" \ /chrootbuild -C --noconfirm --log --holdver --skipinteg +ret=$? -if (( $? == 0 )); then +if (( ${ret} == 0 )); then msg2 "built succeeded! built packages can be found in ${buildroot}/${chroot}/pkgdest" msg "comparing artifacts..." - comparefiles=("${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}") - if cmp -s "${comparefiles[@]}"; then - msg2 "Package successfully reproduced!" - exit 0 - else - warning "Package is not reproducible. :(" - sha256sum "${comparefiles[@]}" - if (( diffoscope )); then - diffoscope "${comparefiles[@]}" + for pkgfile in "${splitpkgs[@]}"; do + comparefiles=("${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}") + if cmp -s "${comparefiles[@]}"; then + msg2 "Package '%s' successfully reproduced!" "${pkgfile}" + else + ret=1 + warning "Package '%s' is not reproducible. :(" "${pkgfile}" + sha256sum "${comparefiles[@]}" + if (( diffoscope )); then + diffoscope "${comparefiles[@]}" + fi fi - fi + done fi -# the package either failed to build, or was unreproducible -exit 1 +# return failure from chrootbuild, or the reproducibility status +exit ${ret}