gitian-builder: enable apt cacher

This commit is contained in:
AbcSxyZ 2021-09-19 23:37:14 +02:00
parent de00a2cde8
commit 45801ec400
2 changed files with 32 additions and 3 deletions

View file

@ -29,6 +29,7 @@ build=false
buildSigned=false
commit=false
test=false
enableCache=false
# Other Basic variables
SIGNER=
@ -65,6 +66,8 @@ Options:
l for Linux, w for Windows, x for MacOS
-j proc Number of processes to use. Default $proc
-m n Memory to allocate in MiB. Default $mem
--enable-cache Use local apt-cacher server. If you need to specify host, use
MIRROR_HOST environment variable
-c|--commit Indicate that the version argument is for a commit or branch
-u|--url repo Specify the URL of the repository. Default is https://github.com/dogecoin/dogecoin
--test CI TEST. Uses Docker
@ -155,6 +158,10 @@ while :; do
--docker)
USE_DOCKER=1
;;
# apt cacher
--enable-cache)
enableCache=true
;;
# URL
-u)
if [ -n "$2" ]; then
@ -280,15 +287,20 @@ if [[ $setup == true ]]; then
popd
#Check if apt-cacher should be enabled
if [ -z "$MIRROR_HOST" ] && [[ $enableCache = false ]]; then
cacher_option="--disable-apt-cacher"
fi
#Prepare containers depending of virtualization solution: lxc, docker, kvm
if [ "$USE_LXC" -eq 1 ]
then
sudo apt-get install -y lxc
bin/make-base-vm --suite trusty --arch amd64 --lxc --disable-apt-cacher
bin/make-base-vm --suite trusty --arch amd64 --lxc $(echo $cacher_option)
elif [ "$USE_DOCKER" -eq 1 ]; then
bin/make-base-vm --suite trusty --arch amd64 --docker --disable-apt-cacher
bin/make-base-vm --suite trusty --arch amd64 --docker $(echo $cacher_option)
else
bin/make-base-vm --suite trusty --arch amd64 --disable-apt-cacher
bin/make-base-vm --suite trusty --arch amd64 $(echo $cacher_option)
fi
popd
fi

View file

@ -17,6 +17,7 @@ Participate and help to secure the process by following this guide.
* [Docker](#docker)
* [LXC](#lxc)
* [KVM](#kvm)
* [Apt-cacher](#apt-cacher)
2. [Usage](#usage)
* [Syntax](#syntax)
* [Example](#example)
@ -71,6 +72,19 @@ Then use `--lxc` option with `gitian-build.sh`.
[Documentation not available, help is welcome]
### Apt-cacher
Disabled by default, `apt-cacher` enable to cache locally downloaded dependencies to save resources.
You will need the following package :
```
apache2 apt-cacher-ng
```
You can use your local server by using `--enable-apt-cacher`, or define `MIRROR_HOST` if you need to specify the server address.
> **Be nice:** Please use cache for intensive ressource usage to save mirrors bandwith.
## Usage
`gitian-build.sh` is a standalone script, it can be downloaded and run outside of Dogecoin Core repository.
@ -102,6 +116,9 @@ Options:
l for Linux, w for Windows, x for MacOS
-j proc Number of processes to use. Default 2
-m n Memory to allocate in MiB. Default 2000
--enable-cache Use local apt-cacher server. If you need to specify host, use
MIRROR_HOST environment variable
-c|--commit Indicate that the version argument is for a commit or branch
-u|--url repo Specify the URL of the repository. Default is https://github.com/dogecoin/dogecoin
--test CI TEST. Uses Docker