From nobody Mon Aug 21 13:33:24 2023 X-Original-To: freebsd-pkgbase@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RTtjG2CnRz4qnTL for ; Mon, 21 Aug 2023 13:33:38 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RTtjF2qLnz3Pkk for ; Mon, 21 Aug 2023 13:33:37 +0000 (UTC) (envelope-from dfr@rabson.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=rabson-org.20221208.gappssmtp.com header.s=20221208 header.b=p5mxCJnX; spf=pass (mx1.freebsd.org: domain of dfr@rabson.org designates 2607:f8b0:4864:20::1133 as permitted sender) smtp.mailfrom=dfr@rabson.org; dmarc=none Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-584034c706dso36110657b3.1 for ; Mon, 21 Aug 2023 06:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rabson-org.20221208.gappssmtp.com; s=20221208; t=1692624816; x=1693229616; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=2ssmFQQpXNhinWiLoihDPBvrJ3wC+okK6lvUYMbORnk=; b=p5mxCJnX+tXxGNLfN06vO2/7nHbME3oCcyCyH83t8qlyiFndFJIey73NsaZkVt0KYW nkS/kLYbeati4mLNT4fEjKPWa/wm7I9PoU2Exa6FWNsRP6PmBawCUicLCUS0ymVWDO0m JhE1QpC2iocPzyLYgXzR0F+93GpawZ7lfv8n5QS45RO8MtaUhYy3yJsLtaEFVYGBIqAQ 0ApufsM89AgEKT9mcs+JB6gYQ2wQ+xIFnN1bZ4ax9jEEcuch5fHRA/PlW+KelWI2dXMc qYTFD1y+owAF3pw+espdrC2OMuWyUevW4WsRfLDl05XzHLc51NAqUHLFGBzDtUS0u81H hqgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692624816; x=1693229616; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2ssmFQQpXNhinWiLoihDPBvrJ3wC+okK6lvUYMbORnk=; b=GLtsl3/ekV97ubXKdxw7pBaA8XG7YL7MAyBsnr6Fs0Co+n9aanIl9AdyWuX9h0opJa 32JdsEVET8ARek6eYj93xAlR/Qk3TDUKPGTzoDid8XjoLUk8qh6Wn0aBSryVM2CEtde3 bEaDbJxB0xzfsvmEft8QV15lqwYPWlai624mnFgZ0p78C0OqjzUXbutjwCR4yma8uL7m 2oNG7x4TzY+k2znHAbe6zwjFeGfMZvLvkF9agGL3w8WfS59AfdNJBnNqIDvZcMuAO6fJ +bkJ18JmceiiO9rXF9yeP/ldsAE+JTjm1iVssXrwuHgFYrjdjjUMiAtRrX3BaUWYzqhS Mr3g== X-Gm-Message-State: AOJu0YwCwMnGYWZvlxy0SsBp859ivOLyX20a68nmWvi2PS4e6q53BSYR IdCvHNiR+Ctr9s022Ap0ofzcwRnrT8fNxvDUL4F7KKmefqxyHwQK6ioUhA== X-Google-Smtp-Source: AGHT+IEsnPEvp6kVa+50CqRiNUZkRPs96ORHLtPqmrgG5Fm43U09vEe/yBvWKNFrVk33WMbDxNTYL6tPg4Svfxu/xio= X-Received: by 2002:a25:804f:0:b0:d0c:b780:4c13 with SMTP id a15-20020a25804f000000b00d0cb7804c13mr6644520ybn.25.1692624815780; Mon, 21 Aug 2023 06:33:35 -0700 (PDT) List-Id: Packaging the FreeBSD base system List-Archive: https://lists.freebsd.org/archives/freebsd-pkgbase List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-pkgbase@freebsd.org MIME-Version: 1.0 From: Doug Rabson Date: Mon, 21 Aug 2023 14:33:24 +0100 Message-ID: Subject: Repeatable builds using pkgbase To: freebsd-pkgbase@freebsd.org Content-Type: multipart/alternative; boundary="000000000000e221ac06036eec4e" X-Spamd-Result: default: False [-3.50 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[rabson-org.20221208.gappssmtp.com:s=20221208]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; MLMMJ_DEST(0.00)[freebsd-pkgbase@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::1133:from]; ARC_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+,1:+,2:~]; DKIM_TRACE(0.00)[rabson-org.20221208.gappssmtp.com:+]; RCPT_COUNT_ONE(0.00)[1]; RCVD_TLS_LAST(0.00)[]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[dfr]; DMARC_NA(0.00)[rabson.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-pkgbase@freebsd.org]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Spamd-Bar: --- X-Rspamd-Queue-Id: 4RTtjF2qLnz3Pkk --000000000000e221ac06036eec4e Content-Type: text/plain; charset="UTF-8" While working on build scripts for FreeBSD container images, I wanted to get to the point where my builds are repeatable, i.e. if I create two images with the same set of packages installed in the same order, they should be identical. The main stumbling block is timestamps. I can force all the file timestamps to a fixed value with buildah using the '--timestamp' argument to either 'buildah commit' or 'buildah build' but even then, the two images have different hashes. Looking deeper, the difference is in /var/db/pkg/local.sqlite. If I compare SQL dumps of the databases from each image, I can see a timestamp embedded in the sqlite file: diff dump1 dump2 4c4 < INSERT INTO packages VALUES(1,'base','FreeBSD-zoneinfo','13.2p2','zoneinfo package','zoneinfo package',NULL,NULL,'FreeBSD:13:amd64','re@FreeBSD.org',' https://www.FreeBSD.org ','/',731014,0,0,1,1692446701,'2$2$c9w95oqai9bwhny1k4pcg8mji77xgk43zjxxb69j1duzq5jao18wak4deer85epmfpc8ngyysyt9wu74pg7sczkqc3ekyawkfgwzi8d',NULL,NULL,0); --- > INSERT INTO packages VALUES(1,'base','FreeBSD-zoneinfo','13.2p2','zoneinfo package','zoneinfo package',NULL,NULL,'FreeBSD:13:amd64','re@FreeBSD.org',' https://www.FreeBSD.org ','/',731014,0,0,1,1692622924,'2$2$c9w95oqai9bwhny1k4pcg8mji77xgk43zjxxb69j1duzq5jao18wak4deer85epmfpc8ngyysyt9wu74pg7sczkqc3ekyawkfgwzi8d',NULL,NULL,0); Looking at the pkg source, I can see that the prepared statement for inserting into the packages table explicitly uses NOW() for this column. Would it be reasonable to allow changing this, e.g. by adding a command line argument to pkg to override the default? I haven't tried this to see if that makes the two databases identical - if not, I guess I'll just remove pkg metadata altogether. --000000000000e221ac06036eec4e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
While working on build scripts for FreeBSD container image= s, I wanted to get to the point where my builds are repeatable, i.e. if I c= reate=C2=A0two images with the same set of packages installed in the same o= rder, they should be identical.

The main stumbling block= is timestamps. I can force all the file timestamps to a fixed value with b= uildah using the '--timestamp' argument to either 'buildah comm= it' or 'buildah build' but even then, the two images have diffe= rent hashes. Looking deeper, the difference is in /var/db/pkg/local.sqlite.= If I compare SQL dumps of the databases from each image, I can see a times= tamp embedded in the sqlite file:

diff dump1 dump2 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
4c4
< INSERT INTO packages VALUES(= 1,'base','FreeBSD-zoneinfo','13.2p2','zoneinfo = package','zoneinfo package',NULL,NULL,'FreeBSD:13:amd64'= ;,'re@FreeBSD.org','https:/= /www.FreeBSD.org','/',731014,0,0,1,1692446701,'2$2$c9w9= 5oqai9bwhny1k4pcg8mji77xgk43zjxxb69j1duzq5jao18wak4deer85epmfpc8ngyysyt9wu7= 4pg7sczkqc3ekyawkfgwzi8d',NULL,NULL,0);
---
> INSERT INTO pack= ages VALUES(1,'base','FreeBSD-zoneinfo','13.2p2',&#= 39;zoneinfo package','zoneinfo package',NULL,NULL,'FreeBSD:= 13:amd64','re@FreeBSD.org','https://www.FreeBSD.org','/',731014,0,0,1,1692622924,&= #39;2$2$c9w95oqai9bwhny1k4pcg8mji77xgk43zjxxb69j1duzq5jao18wak4deer85epmfpc= 8ngyysyt9wu74pg7sczkqc3ekyawkfgwzi8d',NULL,NULL,0);

Looking at the pkg source, I can see that the prepared st= atement for inserting into the packages table explicitly uses NOW() for thi= s column. Would it be reasonable to allow changing this, e.g. by adding a c= ommand line argument to pkg to override the default? I haven't tried th= is to see if that makes the two databases identical - if not, I guess I'= ;ll just remove pkg metadata altogether.



<= /div> --000000000000e221ac06036eec4e--