Date: Sun, 21 Dec 2014 10:48:53 +0000 From: Matthew Seaman <matthew@FreeBSD.org> To: freebsd-questions@freebsd.org Subject: Re: pkg versions don't match Message-ID: <5496A595.8090702@FreeBSD.org> In-Reply-To: <CAHieY7RZ2X9Nn5E4Fx7nfRq7HsLkmb8AgYaSRs-rsBAxXVUS4Q@mail.gmail.com> References: <CAHieY7TwrW6y7dO1mFCEJgmt923_0ci1s5VJbo0XzDG5H0e7pQ@mail.gmail.com> <CAGZBXN_1P=eHm8FKsCyzT%2BtY8cF05Fi4O5-6FOcAxi3ckZp1Mw@mail.gmail.com> <CAHieY7Sct5KOycXwY5zV=DQkOHQ79Q2tRPYWQjn2XhsLpdQfWw@mail.gmail.com> <54941E41.3040807@hiwaay.net> <CAHieY7RRwX8a9kOHuyboOPH2ZYmHFuK6xLa9MSd-TAT15Zey4w@mail.gmail.com> <CA%2BtpaK0Z4WhXdz5ZhAEo=5ea-Q157h22c11y=2UGpKeaqX9z6w@mail.gmail.com> <CAHieY7RZ2X9Nn5E4Fx7nfRq7HsLkmb8AgYaSRs-rsBAxXVUS4Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --SUTfFuQmc76uTNaiaR55QvtLdmHHOCSmo Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 21/12/2014 02:25, Alejandro Imass wrote: > Yeah but something doesn't seem quite right here. The option -f "force"= to > check origin versions seems a bit obscure. If -f is needed for update t= o > actually check remote for update then it should be more prominent. >=20 > The manual clearly states: >=20 > pkg update is used for updating the local copy of the repository catalo= gues > from the remote package repository databases. Updates to catalogues ar= e > normally downloaded only when the master copy on the remote package > repository is newer than the local copy. >=20 > So it _seems_ that update does not actually check remote pkg repository= > without the use of -f >=20 > Assuming -f is needed to go and actually fetch the new versions then wh= en a > package is not found on remote, it should be prominent in handbook page= , > the main man page, or at least hint the user to try -f when "not found= ". pkg(8) will "update the repo" automatically as part of many different operations. 'pkg update' essentially runs this bit of code alone, without doing any other operations. However, the only way to force the repo to be updated is via 'pkg update' -- everything else just runs the normal update algorithm. When pkg(8) updates the repo, it does a series of things. Firstly it downloads a copy of the repo catalogue -- that's a compressed file of JSON data with selected bits of package metadata for all of the packages in the repo. In order to avoid this resulting in a lot of unnecessary work, pkg(8) basically checks to ensure that the timestamp on the repository catalogue is unchanged using the standard HTTP 304 'Not modified' status code mechanism. If it finds the catalogue hasn't changed since the last time it downloaded it, then it stops there. (The slow step here is downloading the repo catalogue which can be of significant size over a network link of unknown bandwidth -- the 'out of date' check requires minimal network IO and is much faster, while the local processing to load the catalogue into slite is orders of magnitude faster still.) Otherwise, if the catalogue has changed, or there isn't already a local copy, then pkg(8) decompresses the catalogue and processes it into a Sqlite database, which is what all subsequent pkg(8) operations query. What force does is override the 'is the catalogue unchanged from last time' test, so pkg(8) will always download and reprocess the catalogue. Usually this is unnecessary, as there's no point in redownloading exactly the same thing and reprocessing it to produce exactly the same. There is one circumstance when this is not true however: when pkg(8) itself is updated, the schema of the sqlite database may change. The format of the catalogue may similarly change, but it is carefully done to remain backwards compatible with both older and newer versions of pkg(8). Changes to the catalogue format and to the sqlite schemas are mostly handled completely transparently to the user, but occasionally, as in this case, forcing the update is required to populate the new-style repo catalogue. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. PGP: http://www.infracaninophile.co.uk/pgpkey --SUTfFuQmc76uTNaiaR55QvtLdmHHOCSmo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.20 (Darwin) iQJ8BAEBCgBmBQJUlqWkXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NTNBNjhCOTEzQTRFNkNGM0UxRTEzMjZC QjIzQUY1MThFMUE0MDEzAAoJELsjr1GOGkAT+VMQAJEc5rYUCXP0IVCCEP9Hbd5I q/dI3bCIj7QdRBvhYJsKp5ZZaohc3UrgY2SLt8RwdWeQppDO/401uG5N9X+c6BSN v7+3EODYMMk5Wipjy5wAdAVbp3NDKj6o+OvHPd+Qe7XCF+eD3/S4ZTUynRAtGSkB fN8UNU9XSOg+F06wU0BfmSohCUAgksfgzFw/ff5btg7z5PgNDaDoF3RW23ssDlkk V4/ZDZNCfMZCdQv0lUQzDFoYHMKIKrM1HPhx+/boBIKXxtpPj5I9Qj0h8jGrlFZs 9prd5b6HRiUt3bN8udGyD2YiWmpnduo4Hmy7/ovo++MEGs5vD6CJ0zC9CcQB6btH bM9Ne2QVG7xtnzTRjSma1j+8SlXM8jXlGkuKqit73BOmMv2g2zxqRQiPOOiCmj1d R1NXWAcWK6X1ClQ3oTPPl/pJAYl++f1QYTOMa34UMCUPgDQUOezQrU26InXRQD9h EabekcEt4ijdlvKFgMcPsVWd2+5Do1ibZ0oEeYDmV4sl/Sx/Xx9COzOYNc4BliDI PBx+ZEMnUnpBIUDjGRCfN25Zwcehd4l+9gNncAljyqXAqdsVwxG0nJAAcoh0sg0Z 1gZ+Pfi9eCnwMe24/QoVdP7+erNPCF1nlTbJdancZ459cQ/c46Nu65V+whF7nZwr /KiUP+Iu78DwlVwVdCFi =9rHv -----END PGP SIGNATURE----- --SUTfFuQmc76uTNaiaR55QvtLdmHHOCSmo--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5496A595.8090702>