Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Jan 23, 2019

This PR allows a user to run:

./gitian-build.py --setup

without unused signer and version options.

In master the signer and version options are mandatory. This implies the following code is dead:

# Signer and version shouldn't be empty
if args.signer == '':
print(script_name+': Missing signer.')
print('Try '+script_name+' --help for more information')
exit(1)
if args.version == '':
print(script_name+': Missing version.')
print('Try '+script_name+' --help for more information')
exit(1)

This PR fixes those lines of code.

Also this PR has a nice side effect: there is no more warnings about macOS build during processing --setup command. Ref: #13998 (comment)

Note: https://github.com/bitcoin-core/docs/blob/master/gitian-building.md will be updated when this PR is merged.

@laanwj
Copy link
Member

laanwj commented Jan 23, 2019

I think this breaks the functionality of using --setup together with other options?

@hebasto
Copy link
Member Author

hebasto commented Jan 23, 2019

@laanwj

I think this breaks the functionality of using --setup together with other options?

Yes. This was made intended.

Currently, the script can stop regardless of other options ( --build, --sign etc):

if args.is_bionic and not args.kvm and not args.docker:
subprocess.check_call(['sudo', 'sed', '-i', 's/lxcbr0/br0/', '/etc/default/lxc-net'])
print('Reboot is required')
exit(0)

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 23, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #13998 (Scripts and tools: gitian-build.py improvements and corrections by hebasto)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@@ -184,6 +177,16 @@ def main():
if not 'LXC_GUEST_IP' in os.environ.keys():
os.environ['LXC_GUEST_IP'] = '10.0.3.5'

if args.setup:
setup()
exit(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be sys.exit(0) :-)

Surprised that flake8 didn't complain about that!

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed all occurrences in the script.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@hebasto hebasto force-pushed the 20190123-gitian-build-setup branch from 42f4604 to 1950540 Compare January 23, 2019 12:26
@laanwj
Copy link
Member

laanwj commented Jan 23, 2019

Currently, the script will stop regardless of other options ( --build, --sign etc):

It should because a reboot is intended in those specific cases, not always!

@hebasto
Copy link
Member Author

hebasto commented Jan 23, 2019

@laanwj

You are right. I mean "can stop", not "will stop".

It will stop while using LXC on Bionic.

@hebasto
Copy link
Member Author

hebasto commented Jan 23, 2019

@laanwj

I think this breaks the functionality of using --setup together with other options?

Usually, --setup command is used only once at the first time.
With this PR a user still able to run:

./gitian-build.py --setup && ./gitian-build.py --build ${SIGNER} ${VERSION}

@hebasto
Copy link
Member Author

hebasto commented Jan 23, 2019

Also, a user do not want to run --setup together with other commands because after --setup they usually want to copy MacOSX10.11.sdk.tar.gz to gitian-builder/inputs directory before --build.

@laanwj
Copy link
Member

laanwj commented Jan 24, 2019

@ken2812221 you mostly wrote this code, can you take a look please?

@ken2812221
Copy link
Contributor

utACK 1950540

@maflcko
Copy link
Member

maflcko commented Jan 25, 2019

utACk 1950540

@hebasto
Copy link
Member Author

hebasto commented Apr 24, 2019

@practicalswift would you mind re-reviewing this PR?

@hebasto hebasto changed the title scripts and tools: Make --setup command independent [WIP] scripts and tools: Make --setup command independent May 18, 2019
@hebasto hebasto force-pushed the 20190123-gitian-build-setup branch from 1950540 to 416baac Compare May 18, 2019 21:53
@hebasto
Copy link
Member Author

hebasto commented May 18, 2019

@laanwj

I think this breaks the functionality of using --setup together with other options?

After reconsidering your words, I believe you are right.
Fixed. No breaking changes now.
It is possible to run:

./gitian-build.py --setup --build ${SIGNER} ${VERSION}

or

./gitian-build.py --setup

@hebasto
Copy link
Member Author

hebasto commented May 18, 2019

PR description updated.

@hebasto hebasto changed the title [WIP] scripts and tools: Make --setup command independent scripts and tools: Make --setup command independent May 18, 2019
A user can run 'gitian-build.py --setup' ignoring signer
and version options.
Get rid of warning about macOS build during setup for free.
@hebasto hebasto force-pushed the 20190123-gitian-build-setup branch from 416baac to e0eae1b Compare May 20, 2019 18:05
@hebasto
Copy link
Member Author

hebasto commented May 20, 2019

Rebased.

@maflcko maflcko merged commit e0eae1b into bitcoin:master May 20, 2019
maflcko pushed a commit that referenced this pull request May 20, 2019
e0eae1b Make --setup command independent (Hennadii Stepanov)

Pull request description:

  This PR allows a user to run:
  ```sh
  ./gitian-build.py --setup
  ```
  without unused `signer` and `version` options.

  In master the `signer` and `version` options are mandatory. This implies the following code is dead:
  https://github.com/bitcoin/bitcoin/blob/387eb5b34307448f16d3769ac0245c4e3d996a38/contrib/gitian-build.py#L192-L200
  This PR fixes those lines of code.

  Also this PR has a nice side effect: there is no more warnings about macOS build during processing `--setup` command. Ref: #13998 (comment)

  Note: https://github.com/bitcoin-core/docs/blob/master/gitian-building.md will be updated when this PR is merged.

ACKs for commit e0eae1:

Tree-SHA512: df851fe461e402229c57b410f30f1d8bc816e8a2600ece4249aa39c763566de5b661e7aa0af171d484727eb463a6d0e10cfcf459aa60ae1a5d4e12974a8615c6
@hebasto hebasto deleted the 20190123-gitian-build-setup branch May 20, 2019 19:20
maflcko pushed a commit to bitcoin-core/docs that referenced this pull request Sep 8, 2019
a20bf24 Make --setup command simpler (Hennadii Stepanov)

Pull request description:

  After merging bitcoin/bitcoin#15236, the [`gitian-build.py`](https://github.com/bitcoin/bitcoin/blob/master/contrib/gitian-build.py) script allows to run `--setup` command ignoring `signer` and `version` options.

  Also my text editor is set to remove trailing spaces before saving. So, they are removed as well.

Top commit has no ACKs.

Tree-SHA512: 38d9418a977cac0ff8d322a030d5602aab4b16ef81ef388a7200a934c86300e2932e16cec536381d57102d3dd26454321206789c8644bcfbe33cb279f5cfc6db
kwvg added a commit to kwvg/dash that referenced this pull request Jul 15, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 15, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 20, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 20, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 20, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 20, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 1, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 24, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 24, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 26, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 26, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 26, 2021
…dependent

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
kwvg added a commit to kwvg/dash that referenced this pull request Aug 27, 2021
…dependent

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
kwvg added a commit to kwvg/dash that referenced this pull request Aug 27, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 30, 2021
…dependent

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
kwvg added a commit to kwvg/dash that referenced this pull request Aug 31, 2021
…dependent

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
kwvg added a commit to kwvg/dash that referenced this pull request Sep 1, 2021
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Nov 21, 2021
…and docs

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

This adds a new streamlined Gitian setup guide tailored for Ubuntu/Debian
users with Docker: doc/gitian-building/gitian-building-docker.md

Included are some improvements to the build system itself:
 - A backport from Core simplifying `gitian-build.py --setup` calls such that the
   signer and version parameters are no longer required, as they are not used
   during setup.
 - Fixed the base VM automatically generated by `gitian-build.py` to Debian
   Buster. This seems to have been accidentally left as Ubuntu Bionic, which
   results in superfluous Bionic VMs being created.

And some related documentation improvements:
 - Removed documentation about the old, currently unused build signing
   mechanism and updated it to point people to
   [Gitian signing](doc/gitian-signing.md) instead.
 - Added a link to the new Gitian on Docker setup document in the main
   [Gitian building](doc/gitian-building.md) guide.

## Ported PRs
 - bitcoin/bitcoin#15236

## Test Plan
 - Run the Gitian builds by following the
   new guide (doc/gitian-building/gitian-building-docker.md), ideally on various
   different versions of Debian and Ubuntu.  Make sure to use my fork/branch instead of the main repo in a couple places, though:
   1. Instead of the instruction here: https://gitlab.com/andrew-128/bitcoin-cash-node/-/blob/gitian-docker-setup/doc/gitian-building/gitian-building-docker.md#L19, instead, do: `git clone https://gitlab.com/andrew-128/bitcoin-cash-node.git`
   2. Instead of the instruction here: https://gitlab.com/andrew-128/bitcoin-cash-node/-/blob/gitian-docker-setup/doc/gitian-building/gitian-building-docker.md#L39, instead, do (replacing satoshi with your GitLab username): `./gitian-build.py --docker --detach-sign --no-commit --url https://gitlab.com/andrew-128/bitcoin-cash-node.git -b -c "satoshi" gitian-docker-setup`
 - Check that `gitian-build.py` still works as normal in other contexts.
 - `ninja check-lint`.
 - Review the updated documentation.
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants