Skip to content

Feature: add option --disable-apt-cacher (following #249) #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed

Feature: add option --disable-apt-cacher (following #249) #253

wants to merge 9 commits into from

Conversation

AbcSxyZ
Copy link
Contributor

@AbcSxyZ AbcSxyZ commented Sep 16, 2021

Following #249 from @micaelmalta, this PR creates the option --disable-apt-cacher,
to disable the use of apt cacher for dependencies cache.

It also adds some documentation on the README about the option. Documentation would need at least an update for none ubuntu/debian distros.

@AbcSxyZ AbcSxyZ requested a review from devrandom as a code owner September 16, 2021 21:34
@AbcSxyZ AbcSxyZ changed the title Feature: disable apt cacher default (following #249) Feature: add option --disable-apt-cacher (following #249) Sep 17, 2021
@AbcSxyZ
Copy link
Contributor Author

AbcSxyZ commented Sep 18, 2021

Do not work on lxc, within the container, source.list is done between following lines :

on-target -u root bash < target-bin/bootstrap-fixup

The file bootstrap-fixup.in contain source.list configuration, and expect to use a mirror.

Fix needed

@AbcSxyZ
Copy link
Contributor Author

AbcSxyZ commented Sep 18, 2021

Just added some code to configure lxc container apt/source.list to avoid using mirror.

Within a running container, I ended up with :

deb http://archive.ubuntu.com/ubuntu trusty main universe
deb http://security.ubuntu.com/ubuntu trusty-security main universe
deb http://archive.ubuntu.com/ubuntu trusty-updates main universe

instead of :

deb http://$MIRROR_HOST:PORT/archive.ubuntu.com/ubuntu trusty main universe
deb http://$MIRROR_HOST:PORT/security.ubuntu.com/ubuntu trusty-security main universe
deb http://$MIRROR_HOST:PORT/archive.ubuntu.com/ubuntu trusty-updates main universe

Actually, it's removing references to apt cacher server, but I'm unable to test it. It looks like having lxc container connected to Internet is a bit tricky, I crash because of the internet connection on apt commands.

I'm not sure if lxc containers are more used without internet, or packages installed when building base, I don't know the software and ignore how a configuration like that should work...
I'm trying to use lxc, not necessary need it but would be great, but I'm unable to do it for now

@AbcSxyZ
Copy link
Contributor Author

AbcSxyZ commented Sep 19, 2021

Add bug fix for apt cacher configuration within the Dockerfile, see following comment for details.

Comment on lines +15 to +19
if [ $APT_CACHER = "1" ]; then
sed "s;HOSTIP;$MIRROR_HOST;g" < target-bin/bootstrap-fixup.in > target-bin/bootstrap-fixup
else
sed "s;HOSTIP:3142/;;g" < target-bin/bootstrap-fixup.in > target-bin/bootstrap-fixup
fi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually not working.

config-boostrap-fixup is called with bin/make-base-vm, which have APT_CACHER variable through --disable-apt-cacher.
It is called also with bin/gbuild, who use it with make-clean-vm. At this moment, they do not have APT_CACHER variable anymore.

Creating the following error :

bash: [: =: unary operator expected

APT_CACHER will be replaced by an unquoted empty value.

Copy link
Contributor Author

@AbcSxyZ AbcSxyZ Sep 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a possible solution, would it be possible to configure bootstrap-fixup.in only when using make-base-vm ? And then reuse generated bootstrap-fixup file instead of recreating one in make-clean-vm.

The feature was implemented by commit 5785dfc, I suppose we can do it as I suggest in the case GITIAN_HOST_IP doesn't change between make-base-vm & gbuild.
Actually, without this situation, it looks like it's creating twice the same file.

It can make sure configuration is more done through make-base-vm.
Maybe deleting the following line can do the job (?) :

libexec/config-bootstrap-fixup

Copy link
Contributor Author

@AbcSxyZ AbcSxyZ Sep 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's the right solution, but if it is I just added the commit d8d370d to implement this fix.

@@ -193,12 +199,19 @@ if [ $DOCKER = "1" ]; then
base_image="$DISTRO:$SUITE"
fi

apt_cacher=""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable declaration useless

@AbcSxyZ
Copy link
Contributor Author

AbcSxyZ commented Oct 23, 2021

Hi 👋,

I wanted to know if you are planning to review this PR ? You were really reactive for the feature, but I do not have any reply since September.

Actually, the PR need tests for LXC & KVM, both with and without --disable-apt-cacher + I had a question in a previous comment about the implementation. If anyone can test it with his build, I wasn't able to install/use lxc & kvm...

We did it while working on Dogecoin, there is a pending PR reworking the gitian process and it uses this feature, would be great to know what you want to do 🙃

@devrandom
Copy link
Owner

I do intend to review, but have to allocate some time for testing with the different configurations...

Copy link
Owner

@devrandom devrandom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a couple of issues right away.

@@ -12,4 +12,8 @@ if [ -z "$MIRROR_HOST" ] || [ "$MIRROR_HOST" == "127.0.0.1" ]; then
MIRROR_HOST=$GITIAN_HOST_IP
fi

sed "s;HOSTIP;$MIRROR_HOST;g" < target-bin/bootstrap-fixup.in > target-bin/bootstrap-fixup
if [ $APT_CACHER = "1" ]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two issues:

  • missing quotes around $APT_CACHER
  • APT_CACHER is not actually exported as an environment variable

@devrandom
Copy link
Owner

Thinking about this further, and given that Bitcoin is moving to a different build system, I am planning to move this repo to maintenance mode. Only serious bugs and security issues will be considered going forward.

@devrandom devrandom closed this Nov 22, 2021
@AbcSxyZ
Copy link
Contributor Author

AbcSxyZ commented Nov 22, 2021

Can you tell me what is this new build system, please ? I do not find information related to this change, in the current gitian docs from bitcoin-core repo is still related to your repo, and it's redirecting to a gitian-build.py on bitcoin/bitcoin which do not exists anymore.

EDIT: saw your readme indicating guix, thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants