Documentation ¶
Overview ¶
Package pkg implements binary packages.
Download specification ¶
Downloading binary packages works as follows:
- Parse the `config.binpkg` file.
- Determine the `$GOOS` and `$GOARCH` we are currently running on.
- Read the corresponding `$GOOS_$GOARCH.binpkg` file and hash it to `treehash`. Abort, if `$GOOS_$GOARCH.binpkg` does not exist.
- Pick a random URL from the `config.binpkg` file and try to download `URL/$GOOS_$GOARCH/treehash.tar.gz` to `.codechain/binpkg/archives`.
- If download (or verification, see below) failed, try next URL. Abort, if all downloads fail permanently.
- Remove directory `.codechain/binpkg/$GOOS_$GOARCH`.
- Create directory `.codechain/binpkg/$GOOS_$GOARCH`.
- Extract `treehash.tar.gz` to `.codechain/binpkg/$GOOS_$GOARCH` and calculate tree hash. If the calculated tree hash does not equal `treehash` goto 5.
- The binary package to install for the current `$GOOS` and `$GOARCH` is now contained in the directory hierarchy under `.codechain/binpkg/$GOOS_$GOARCH`.
Install specification ¶
Installing binary packages works as follows:
- If `$prefix` is not set, set `$prefix=/usr/local`.
- Determine the `$GOOS` and `$GOARCH` we are currently running on.
- Read the corresponding `$GOOS_$GOARCH.binpkg` file and hash it to `treehash`. Abort, if `$GOOS_$GOARCH.binpkg` does not exist.
- Calculate tree hash of `.codechain/binpkg/$GOOS_GOARCH`. Abort, if the calculated tree hash does not equal `treehash`.
- Install: `cp -rf .codechain/binpkg/$GOOS_$GOARCH/* $prefix`
Uninstall specification ¶
Uninstalling binary packages works as follows:
- If `$prefix` is not set, set `$prefix=/usr/local`.
- Determine the `$GOOS` and `$GOARCH` we are currently running on.
- Read corresponding `$GOOS_$GOARCH.binpkg` file and hash it to `treehash`. Abort, if `$GOOS_$GOARCH.binpkg` does not exist.
- Calculate tree hash of `.codechain/binpkg/$GOOS_GOARCH`. Abort, if the calculated tree hash does not equal `treehash`.
- Delete all files contained in `.codechain/binpkg/$GOOS_$GOARCH` from the directory hierarchy rooted at `$prefix`.
Generate specification ¶
Generating binary packages works as follows:
- Parse the `config.binpkg` file.
- Ensure that the base name of `$bindir` is a valid `$GOOS_$GOARCH` combination.
- Ensure that the file `$GOOS_$GOARCH.binpkg` does not exist.
- Calculate the tree list of `$bindir`, write it to `$GOOS_$GOARCH.binpkg`, and hash it to `treehash`.
- Write the directory hierarchy below `$bindir` as as archive to `.codechain/binpkg/archives/treehash.tar.gz`.
- Display all paths `URL/$GOOS_$GOARCH/treehash.tar.gz` where `.codechain/binpkg/archives/treehash.tar.gz` needs to be uploaded to.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.