Repository navigation
Conversation
303d97b to
b01b0a4
Compare
b01b0a4 to
efcef39
Compare
|
Looks good overall. Nothing blocks merging, but notes 1 and 2 are worth addressing. This branch includes #638 and #639, so it has to merge after them. Checks run on e22ffc0:
What holds up
Notes
|
dbc install left the private temporary directory of each registry download behind. Pass the archive with how to release what fetching it created, and remove that directory once the install returns. A local archive is the user's file and is never removed. Test stubs that handed out testdata files directly now return private copies, as downloads must.
dbc install now accepts the URL of a driver archive, such as a release asset, as well as a local path. The driver name comes from the file name, which must contain the host platform, and the version from the archive's manifest. The URL must not hold credentials, a query or a fragment; it is downloaded without registry credentials and within the download size limit, and plain HTTP prints a warning. --registry and --pre are rejected for a URL. Also print no preamble in JSON mode, where the local archive preamble used to precede the JSON output.
dbc install --signing-key NAME verifies a local or URL archive with a key from [signing_keys] in the user config, instead of the built-in Columnar key, and --no-signing-key treats such an archive as unsigned. The key is resolved, and its key file read, before anything is fetched. A key in a project's dbc.toml is not used, and "columnar" names the built-in key, which is already the default. At most one of --signing-key, --no-signing-key and --skip-package-signature-check may be given, and neither key flag applies to a registry install. go-arg would take the next argument as the value of an empty --signing-key= and keep only the last --no-signing-key, so dbc checks those on the command line itself. The local archive docs now use --no-signing-key for an unsigned archive.
The checksumFormatHint constant sat between the comment and the function, so the comment documented the constant instead.
The browser build rejects public_key_file when the signing policy is built, so TestGlobalConfigSigningPolicy now expects that error there. Also use strings.SplitSeq as the linter asks.
The Node build of js/wasm reads key files, so only the browser build expects public_key_file to fail.
The check for an empty --signing-key= and a repeated or valued --no-signing-key only knew the exact spellings -q, --quiet and a leading install, so "--quiet=true install --no-signing-key=" or "-no-signing-key=false" got past it. It now reads every argument as go-arg does: any number of leading dashes, an optional =value, values of options that take one, and nothing after --.
The install model kept what the argument named in isLocal, archiveURL and a second archive name check in Init, and how the signature is checked in skipSignature and the named and unsigned fields of directSigning. The argument is now classified once into a registry, local or URL input, and the options into one signature check: the registry's key, the Columnar key, a named key, unsigned or skipped. Drop the command line re-scan that rejected an empty --signing-key= and a repeated or valued --no-signing-key. It copied go-arg's parsing and kept drifting from it, so the signing options now mean what go-arg makes of them, like every other option. An empty --no-signing-key= is true, as --skip-package-signature-check= already is, and an empty --signing-key= takes the next argument as the key name, which must still be a key of the user config.
startInstalling checked a package with the Columnar key when the signer had no key, so a key that was never resolved would quietly be replaced by another one. It now uses signatureVerifier, as sync does, which fails the verification without a key. Also show no progress bar while an archive URL downloads, since that download reports no progress, and say that only one of the signing options can be active, since --no-signing-key=false is not.
Every boolean flag treats an empty value as true, so a note on this one flag suggested the others behave differently.
The signing flag tests record that an empty --no-signing-key= skips signature verification and an empty --signing-key= takes the next argument. Say why they are tested, and that these cases should expect errors once go-arg keeps an explicit empty value.
A URL or local archive named mysql_darwin_aarch64_v1.0.0.tar.gz on an arm64 Mac now installs the driver mysql, as registry builds already treat the spellings alike. The platform is the shortest one that ends before the version and denotes the host, so a driver ID may contain underscores.
Like a URL, a local archive gets its driver ID when the input is classified, so every JSON progress event names the ID instead of the file path, and an invalid ID fails before the file is opened.
A URL or local archive may also be named <driver>_<platform>-<version>, as registries name archives by default. In both forms the version must be SemVer, so a libc or variant after the platform, as in mysql_linux_amd64_musl-1.0.0, is never read as part of the version. A local archive still accepts any version without a hyphen after the underscore.
A + in the version may also be escaped as %2B in a URL; tests cover both.
|
Thanks for the review.
|
|
Re-reviewed at 7c1f9ab. Notes 1–3 are fixed, and nothing blocks merging. Checks run:
One thing to check: the |
Part of #394.
#621 added HTTP sources to driver lists.
dbc installnow accepts direct archive URLs and lets you choose the signing key for local and URL archives.<driver>_<platform>_<version>or the registry default<driver>_<platform>-<version>, with a.tar.gzor.tgzextension. Both forms accept host platform aliases and require a SemVer suffix with an optional leadingv. The installed version comes from the manifest. URLs cannot contain user info, a query, or a fragment. Plain HTTP emits a warning. URL installs reject--registryand--pre.--signing-key NAMEselects a key from the user config's[signing_keys]before the archive is opened or downloaded.--no-signing-keytreats the archive as unsigned. Only one of these options and--skip-package-signature-checkcan be active._<host platform>_or used the file name without its extension. Host platform aliases and registry-default names can now yield the shorter driver name. After_<platform>_, a non-SemVer suffix must be nonempty and contain neither_nor-. For example,_lateststill yields the short ID, while_dev-buildand_custom_buildnow yield the file name without its extension. dbc determines the ID before opening the file and uses it in JSON progress events.go-arg treats
--no-signing-key=as enabled, skipping signature verification, and takes the next argument as the key name after--signing-key=. The maintainer confirmed that omitting support for explicit empty strings was intentional, and upstream issue alexflint/go-arg#280 was closed without a change. Fixing this in go-arg would let dbc reject both without parsing the command line a second time.