Compare commits

...

180 Commits

Author SHA1 Message Date
Devrandom ad3f9cc4c2
Merge #135: Fixes Debian jessie lxc-init path issue
543e0d5 Check existence of lxc-init before cp to init.lxc (Kevin Gallagher)
8 years ago
Kevin Gallagher 543e0d5061 Check existence of lxc-init before cp to init.lxc 8 years ago
Devrandom bf390a7261
Merge #118: Add verify commits
e1a5744 devtools: Auto-set branch to merge to in github-merge (Wladimir J. van der Laan)
7d0542c devtools: make github-merge.py use py3 (Wladimir J. van der Laan)
31f53d8 [copyright] add MIT license headers to .sh scripts where missing (isle2983)
2862e18 Add README for verify-commits (Peter Todd)
c2d1d62 Remove pointless warning (Peter Todd)
befe6a5 Make verify-commits path-independent (Matt Corallo)
acb55dd Make verify-commits POSIX-compliant (Matt Corallo)
fe83a6d Allow to whitelist commits signed with a revoked key (Matt Corallo)
e1873f6 Adjust verify-commits to gitian-builder (MarcoFalke)
3be7a42 Fix pre-push-hook regexes (Matt Corallo)
73f6969 Add script to verify all merge commits are signed (Matt Corallo)
8 years ago
Wladimir J. van der Laan e1a57442fd devtools: Auto-set branch to merge to in github-merge
As we are already using the API to retrieve the pull request
title, also retrieve the base branch.

This makes sure that pull requests for 0.12 automatically end up in
0.12, and pull requests for master automatically end up in master,
and so on.

It is still possible to override the branch from the command line
or using the `githubmerge.branch` git option.
8 years ago
Wladimir J. van der Laan 7d0542cbc4 devtools: make github-merge.py use py3
This makes github-merge.py the first developer tool to go
all Python 3 (for context see #7717).

The changes are straightforward as the script already was
`from __future__ import division,print_function,unicode_literals`.

However urllib2 changed name, and json will only accept unicode data not
bytes.

This retains py2 compatibility for now: not strictly necessary
as it's not used by the build system - but it was easy.
8 years ago
isle2983 31f53d8bb8 [copyright] add MIT license headers to .sh scripts where missing
Years are set according to 'git log' history
8 years ago
Peter Todd 2862e189b0 Add README for verify-commits 8 years ago
Peter Todd c2d1d6225e Remove pointless warning
Any attacker who managed to make an evil commit that changed something in the
contrib/verify-commits/ directory could just as easily remove the warning
and/or modify it to not display the evil commits; telling the user to check
those commits specifically misleads them into checking just those commits
rather than the script itself.
8 years ago
Matt Corallo befe6a5368 Make verify-commits path-independent 8 years ago
Matt Corallo acb55ddd01 Make verify-commits POSIX-compliant 8 years ago
Matt Corallo fe83a6df80 Allow to whitelist commits signed with a revoked key
(cherry picked from commit 1d94b72019e31066b33947af5709383b8075e43a)
8 years ago
MarcoFalke e1873f6578 Adjust verify-commits to gitian-builder 8 years ago
Matt Corallo 3be7a42fe9 Fix pre-push-hook regexes 8 years ago
Matt Corallo 73f696920b Add script to verify all merge commits are signed 8 years ago
Devrandom 99bc6e832e
Merge #114: Add support for Debian guests using LXC
ad0a871 make-base-vm: fix init.lxc path (Nicolas Vigier)
e3c2e8d Add support for Debian guests using LXC (Joseph Bisch)
8 years ago
Nicolas Vigier ad0a871e07 make-base-vm: fix init.lxc path 8 years ago
Joseph Bisch e3c2e8d3da Add support for Debian guests using LXC 8 years ago
Devrandom 9794f0cfad
Merge #133: Switch to xenial for default suite
ddd3aed Switch to xenial for default suite (Joseph Bisch)
8 years ago
Devrandom 40fa54d383
Merge #119: [gverify] print result with bold formatting
44444eb [gverify] print result with bold formatting (MarcoFalke)
8 years ago
Joseph Bisch ddd3aed172 Switch to xenial for default suite
It can be confusing to new users for make-base-vm to create a lucid vm
by default, so switch to xenial, which is also a LTS release, but isn't
EOL yet. Using lucid with gitian-builder is broken anyway, because
lucid has been moved to old-releases.ubuntu.com since it is EOL and
gitian-builder doesn't support old-releases.ubuntu.com.
8 years ago
Devrandom 4e2c9cd7c4
Merge #130: Allow custom DEBOOTSTRAP_DIR, to give own template (v3)
0db6c05 Allow custom DEBOOTSTRAP_DIR, to give own template (v3) (Tigusoft Admin)
8 years ago
Devrandom 51a5ff9a35
Merge #126: doc: Remove GCC_ISSUES
9cbb3bf doc: Remove GCC_ISSUES (Wladimir J. van der Laan)
8 years ago
Tigusoft Admin 0db6c05200
Allow custom DEBOOTSTRAP_DIR, to give own template (v3)
So you can make local copy of /usr/share/debootstrap/ and
e.g. add there missing e.g. "xenial" or other script/template,
without mucking around in system directory managed by
package manager.
8 years ago
Wladimir J. van der Laan 9cbb3bf61b doc: Remove GCC_ISSUES
This file is outdated, the mentioned issue is no longer there for
newer gcc versions - for bitcoin we haven't had to specify any special
optimization flag overrides for a long time (we compile using -O2).
8 years ago
MarcoFalke 44444eb387 [gverify] print result with bold formatting 8 years ago
Devrandom ee1b69d694
Merge #122: Allow build to use sudo without a password, part deux
e4b4780 Allow build to use sudo without a password, part deux (Chris Kleeschulte)
8 years ago
Chris Kleeschulte e4b4780c74 Allow build to use sudo without a password, part deux
- apropos to a discussion about merge request #36, added a flag in the descriptor and command line flag.
- adding sudo: true in the yml file plus adding a command line flag --allow-sudo will allow script user to elevate permissions with no password.
8 years ago
Devrandom cc174d0447
Merge #117: Add github-merge.py
784d878 Adjust readme for gitian-builder (MarcoFalke)
ee6dee4 devtools: Fix utf-8 support in messages for github-merge (Wladimir J. van der Laan)
7d99dee [devtools] github-merge get toplevel dir without extra whitespace (Andrew C)
0ae5a18 devtools: show pull and commit information in github-merge (Wladimir J. van der Laan)
992efcf devtools: replace github-merge with python version (Wladimir J. van der Laan)
8 years ago
MarcoFalke 784d87896b Adjust readme for gitian-builder 8 years ago
Wladimir J. van der Laan ee6dee4a2a devtools: Fix utf-8 support in messages for github-merge
Use 'utf-8' instead of the Python 2 default of 'ascii' to encode/decode
commit messages.
This can be removed when switching to Python 3, as 'utf-8' is the
default there.
Necessary for merging #7422 due to the ฿ in ฿tcDrak.
8 years ago
Andrew C 7d99dee286 [devtools] github-merge get toplevel dir without extra whitespace
Fixes a bug in github merge when it runs the tests where the toplevel directory has an extra '\n' appended to the path string. Now it doesn't.
8 years ago
Wladimir J. van der Laan 0ae5a18069 devtools: show pull and commit information in github-merge
Print the number and title of the pull, as well as the commits to be
merged.
8 years ago
Wladimir J. van der Laan 992efcf3a5 devtools: replace github-merge with python version
This is meant to be a direct translation of the bash script,
with the difference that it retrieves the PR title from github,
thus creating pull messages like:

    Merge #12345: Expose transaction temperature over RPC
8 years ago
Dev Random bb4f92f6cb Merge pull request #113 from MarcoFalke/ref_datetime_default
reference_datetime: Default to git author date
9 years ago
MarcoFalke fa6f0b6301 raise "must supply reference_datetime or remotes" 9 years ago
MarcoFalke fa7840ea26 reference_datetime: Default to git author date 9 years ago
Dev Random e74cb913a0 Merge pull request #112 from luke-jr/rsync
Bugfix: copy-{to,from}-target: Strip trailing / from sources to avoid triggering special rsync behaviour
9 years ago
Luke Dashjr bf52af1377 Bugfix: copy-{to,from}-target: Strip trailing / from sources to avoid triggering special rsync behaviour
Without this, the caches end up in the wrong place (one level of directories gets removed)
9 years ago
Dev Random 84b32a6b00 Merge pull request #111 from luke-jr/rsync
Use rsync instead of scp for file transfers to save time on cache download from VM
9 years ago
Luke Dashjr dd2ba39d32 Use rsync instead of scp for file transfers to save time on cache download from VM 9 years ago
Dev Random f9ab5871bd Update RELEASE_NOTES 9 years ago
Dev Random 76e5bc186d Merge pull request #105 from laanwj/2015_11_auto_ipv4
Set up IPv4 gateway automatically
9 years ago
Dev Random 659b678c1a Merge pull request #108 from josephbisch/arch-instructions
Add instructions for using gitian-builder with an Arch host
9 years ago
Dev Random 0020642f7a Merge pull request #107 from MarcoFalke/master
ssh: Replace deprecated dsa with rsa
9 years ago
Joseph Bisch 2f0abd1001 Add instructions for using gitian-builder with an Arch host 9 years ago
MarcoFalke 7e4b665acb Replace deprecated dsa with rsa 9 years ago
Wladimir J. van der Laan cb718681e9 Set up IPv4 gateway automatically
I need this to get networking inside the LXC container in
a Debian 8.2 VM.
9 years ago
Dev Random 29c406e117 Merge pull request #104 from josephbisch/fix-tuser
Set TUSER to ubuntu by default and update README
9 years ago
Joseph Bisch 3edec91085 Set TUSER to ubuntu by default and update README
Now, if a user is using something like on-target directly, that user
doesn't need to set the DISTRO or TUSER variables if using Ubuntu guests
(so the scripts function the same as they did before Debian guest
support was added).
9 years ago
Dev Random ad77800219 Merge pull request #103 from josephbisch/fix-debian-i386
Fix debian i386
9 years ago
Joseph Bisch 23ccc3d1dd Use grub package instead of grub-pc unless distro is ubuntu
According to the Debian wiki, installing the package grub installs the
correct version of grub for your suite automatically. This fixes a "you
have held broken packages" error when creating the package manifest due
to a conflict between grub-pc and grub-legacy (at least with Wheezy).
9 years ago
Joseph Bisch 1aad9f4079 Expand on apt issue/workaround and correct affected Debian suites 9 years ago
Joseph Bisch 5b7c52b231 Swap Debian i386 flavour checks
Check for older suites with 686 flavour before checking for 686-pae
flavour suites, because the former should never change, but the latter
would have to be changed whenever a new suite was released if it wasn't
the last if statement.
9 years ago
Joseph Bisch 4f69707c4d Fix issue with apt in Debian <= Squeeze 9 years ago
Joseph Bisch fe1abd1153 Fix flavour for i386 arch
Wheezy on up has linux-image-686-pae. Squeeze on down has
linux-image-686.
9 years ago
Dev Random 1c1c17473e Merge pull request #101 from josephbisch/debian
Initial Debian guest support
9 years ago
Joseph Bisch 2d51b140d0 Add information about Debian guests to README.md 9 years ago
Joseph Bisch 86f31e89c6 Default to ubuntu as distro if not specified
This is so that old Gitian descriptors don't break.
9 years ago
Joseph Bisch c0c8392d49 Purge grub-legacy and bcron-run to work around Debian guest issue 9 years ago
Joseph Bisch 8b297cbcdf Initial Debian guest support 9 years ago
Dev Random b0aba0e1b3 Merge pull request #100 from josephbisch/lsb-release-fix
Use lsb_release to get codename rather than /etc/lsb-release
9 years ago
Joseph Bisch dbf04f4ece Use lsb_release to get codename rather than /etc/lsb-release
It seems like a lsb_release program should be available on any distro if
the appropriate package is installed. So it seems better to use
lsb_release instead of /etc/lsb-release, because Debian doesn't appear
to have /etc/lsb-release.
9 years ago
Dev Random f5717d2fa3 Merge pull request #99 from tuaris/patch-1
Missing wget
9 years ago
Daniel Morante aac596e346 Missing wget
The build process for [Bitcoin](https://github.com/bitcoin/bitcoin/blob/master/doc/gitian-building.md) was failing with the following error

```
./bin/gbuild:21:in `system!': failed to run on-target setarch x86_64 bash -x < var/build-script > var/build.log 2>&1 (RuntimeError)
        from ./bin/gbuild:137:in `build_one_configuration'
        from ./bin/gbuild:267:in `block (2 levels) in <main>'
        from ./bin/gbuild:262:in `each'
        from ./bin/gbuild:262:in `block in <main>'
        from ./bin/gbuild:260:in `each'
        from ./bin/gbuild:260:in `<main>'
```

Inside the log file `var/build.log` the entries towards the end show

```
/bin/sh: 1: wget: not found
```
9 years ago
Dev Random e12e9a1a37 Merge pull request #98 from xeddmc/master
Readme.md OSX Homebrew addition
9 years ago
Zach fead042618 Merge pull request #1 from xeddmc/xeddmc-readme-osx-homebrew
Updated README.md with OS X Homebrew instructions
9 years ago
Zach 21852dffc3 Updated README.md with OS X Homebrew instructions
Added info for OS X homebrew commands alongside the Macports as some people prefer to use Homebrew over MacPorts and it is a pain to switch over from the two.
9 years ago
Devrandom e3e67df408 eliminate uneeded verbosity from apt-get for Ubuntu
credit goes to @Michagogo
related to #44
9 years ago
Dev Random 823e807fd8 Merge pull request #89 from fanquake/ignore_vagrant
Ignore .vagrant hidden files
9 years ago
Devrandom 923016ec8d minor cleanup of previous 9 years ago
Dev Random 82ba171c71 Merge pull request #97 from luke-jr/cache_ro
gbuild: Allow disabling fetch of modified caches with `--cache-read-only` option
9 years ago
Luke Dashjr 9d46e26c2e gbuild: Allow disabling fetch of modified caches with `--cache-read-only` option 9 years ago
Devrandom ec56a82d4b full path to mkfs.ext4 9 years ago
Dev Random f8a3307bc8 Debian instructions 9 years ago
Miron b48730064a handle no lxc installed 9 years ago
Dev Random 1d882f8696 Merge pull request #93 from josephbisch/ecdsa
Add configurable signer to gsign
9 years ago
Joseph Bisch db712b254e Add back accidentally removed ! from gsign 9 years ago
Joseph Bisch ede6af7864 Switch ECDSA signing to generic --signing_program option
This should allow anyone to write any signing program and use it in
conjunction with gsign as long as it supports the same options/arguments
as gpg does (namely -u for the signer and an argument for the file to
sign).
9 years ago
Joseph Bisch da0276608e Add ECDSA signing to gsign
Relies on a script in the Armory source tree to handle the actual
signing.
9 years ago
Devrandom 7219c490cc make bootstrap-fixup idempotent 9 years ago
Dev Random 1913792091 Start using lxc-execute from LXC version 1.0.0 9 years ago
Devrandom 1ae746f68f LXC cleanup 9 years ago
Devrandom f4b72bbec4 hold packages for lucid 9 years ago
Devrandom af56f89a6a improved LXC support
fixes #86
9 years ago
Dev Random df8381baff Merge pull request #90 from gurnec/grub-pc
prevent upgrade of grub-pc which can fail in lxc
9 years ago
Michael Ford 2c091595c1 Ignore .vagrant hidden files 9 years ago
Christopher Gurnee 04ab7c1218 prevent upgrade of grub-pc which can fail in lxc
fixes #86
9 years ago
Devrandom 81bf5d7025 ensure guest upgrade occurs before attempting to get manifest
fixes #85
9 years ago
Devrandom 7d1e7c5419 trusty fixes, remove legacy grub
fixes #84
9 years ago
Dev Random b4201676d8 fix trusty kernel install 9 years ago
Devrandom 7b82201dd7 allow overwrite in copy-from-target
fixes #80
10 years ago
Dev Random 2bcc06e6b7 Merge pull request #79 from theuni/cache
fix copy-from-target when using lxc to copy a subdir
10 years ago
Cory Fields 037d17aff7 fix copy-from-target when using lxc to copy a subdir 10 years ago
Devrandom c834f371bb Revert "git: minimize uploaded git files"
This reverts commit dcf28c8b86.

due to issue #74 - branches don't work
10 years ago
Dev Random e9741525ca Merge pull request #73 from theuni/cache
cache: define cache paths and GBUILD_CACHE_ENABLED conditionally
10 years ago
Cory Fields b1e59cf0a1 cache: define cache paths and GBUILD_CACHE_ENABLED only if caching is enabled 10 years ago
Dev Random 02f4440473 Merge pull request #72 from theuni/git-minimize-upload
git: minimize uploaded git files
10 years ago
Dev Random b484557029 Merge pull request #71 from theuni/cache
cache: define variables for cache paths
10 years ago
Cory Fields 66015b9f14 cache: define variables for cache paths 10 years ago
Cory Fields dcf28c8b86 git: minimize uploaded git files
Rather than uploading every checked-out file of a repository and the
repository objects themselves, skip the checkout and instruct git to compact
before upload. The result is that only a handful of files are transferred,
rather than hundreds or thousands for large repositories.

The HEAD ref is updated before upload so that a hard reset works as before on
the target. The reflog is also disabled in order to avoid uploading useless log
files.

This change is backwards-compatible, but it will only have an effect on new
repositories.
10 years ago
Devrandom 300a2d6faa Merge branch 'virtio-kvm' 10 years ago
Lunar c4c8348dff Use virtio for disk in KVM instead of emulating real hardware
This should improve I/O performance.
10 years ago
Lunar 56bd00ea39 Copy target image as a sparse file in LXC mode
This will save us from writing a lot of zeros on disk.
10 years ago
Dev Random ace5bf3e58 Merge pull request #70 from theuni/cache
Enable cache option
10 years ago
Cory Fields 25fbf7d7a8 update docs for enable_cache option 10 years ago
Cory Fields 00d5b9849c cache: require the enable_cache key to be set to true in order to use cache functionality 10 years ago
Devrandom 07108c4eeb Default back to lxc-start, with option for lxc-execute 10 years ago
Devrandom 95362be81e Add warning in release notes about lxc-execute 10 years ago
Dev Random 27bd5b3869 Merge pull request #69 from gurnec/lxc-execute
Fix issue #63: use lxc-execute instead of lxc-start
10 years ago
Christopher Gurnee 63fe5d1de2 Fix issue #63: use lxc-execute instead of lxc-start 10 years ago
Dev Random 3a0e9024b8 Merge pull request #68 from theuni/cache
fix: use don't use methods that require new ruby version
10 years ago
Cory Fields 923ea1055d fix: use don't use methods that require new ruby version
This is a regression from ea24af10. Dir.exists isn't available in ruby 1.8
10 years ago
Dev Random 8e907adcc4 Merge pull request #58 from laanwj/master
Extend gverify comparison
10 years ago
Dev Random 611292cdcb Merge pull request #64 from theuni/cache
cache fixes
10 years ago
Cory Fields 00114ee98f fix: Separate cache from output files in yml report
Otherwise the output may look non-deterministic if there are stale files in
the cache.
10 years ago
Cory Fields 6a64b48d69 fix: create cache dirs to avoid file copy errors
This fixes builds that don't use caching.
10 years ago
Dev Random 9092f98825 Merge pull request #62 from theuni/cache
Add common cache and per-build cache
10 years ago
Cory Fields b57286ab91 doc: add quick cache readme 10 years ago
Cory Fields ea24af1043 Add common cache and per-build cache
Allow each builder to cache some files for re-use in the next build. This
allows for poor-man's dependency chaining.

Additionally, add a common cache pool for all builds. This can be used for
saving (for example) downloaded files to be shared between builds.
10 years ago
Dev Random 93b39496c4 Merge pull request #61 from brossi/master
Allow @ in URLs
10 years ago
Ben Rossi feef35616b Allow @ in URLs so Gitian-Builder works against source stored on BitBucket. 10 years ago
Dev Random ffd04a46a2 Merge pull request #60 from stefanha/readme-typo-fix
Fix typo in README.md setup instructions
10 years ago
Stefan Hajnoczi f51c4cbfdd Fix typo in README.md setup instructions
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
10 years ago
Dev Random ae83ac0c74 Merge pull request #59 from gdm85/master
Use a clean environment when building VMs
10 years ago
Giuseppe Mazzotta 25db707b34 Use a clean environment when building VMs 10 years ago
Wladimir J. van der Laan 449bc5b243 Extend gverify comparison
- Allow comparing to a sepcific 'golden' manifest with `--compare-to`
- By default pick the first manifest to compare to, instead of always
  comparing against the previous one, which is confusing
- Show line-by-line difference if `-v` given
10 years ago
Dev Random 7a01e8ac9c Merge pull request #57 from gdm85/master
Fix issue #56: clean up environment before gbuild'ing
10 years ago
gdm85 1504c76f11 Fix issue #56: clean up environment before gbuild'ing
Originally proposed by cfields
10 years ago
Dev Random e81f4145c2 Merge pull request #52 from laanwj/master
Un-hardcode host/guest IP
10 years ago
Wladimir J. van der Laan 4e90888bcf Make it possible to override bridge if for LXC
For example Ubuntu installs a bridge called `virbr0` by default for LXC.
Using this system-provided bridge avoids having to configure one
specifically before gitian building.

This commits makes it possible to override the bridge used by gitian
using the environment variable LXC_BRIDGE. The default is still to use
`br0` as before.
10 years ago
Wladimir J. van der Laan 5785dfc3ae Un-hardcode host/guest IP
I was running into trouble using gitian LXC INSIDE a VirtualBox VM, because
the 10.0.2.x IP range overlaps with the range that VirtualBox uses for
its internal NAT network.

This commit makes it possible to override the host and guest IP that
is used during LXC image creation and the build, using environment variables:

- `GITIAN_HOST_IP` (default=10.0.2.2, host IP from the viewpoint of the
   VM, can be used for both LXC and KVM)
- `LXC_GUEST_IP` (default=10.0.2.5, guest IP from the viewpoint of the
   host, effective for LXC only)

When these are not defined the behavior remains the same as before.
10 years ago
Dev Random c9e62adc21 Merge pull request #50 from simondlr/increase_time
Increase time for checking if a target has started.
10 years ago
Dev Random f0ec85e788 Merge pull request #51 from laanwj/master
Make it possible to override source URL
10 years ago
Wladimir J. van der Laan 534248d236 Make it possible to override source URL
To make test builds it can be useful to point gitian at an
alternative repository.

This commit makes this possible by adding a `--url PAIRS` command line
option, that allows to optionally specify where to fetch the code, for
example:

    gbuild --url bitcoin=https://github.com/laanwj/bitcoin.git --commit bitcoin=2014_03_...
10 years ago
Simon de la Rouviere d8d01f7bad Increase time for checking if a target has started. 10 years ago
Dev Random 69de033bf4 Merge pull request #46 from tlrobinson/master
Add VirtualBox support to make-base-vm via Vagrant
10 years ago
devrandom af10dad1fd Fix sanity checking in README 10 years ago
Tom Robinson a6fdc28839 Add VirtualBox support to make-base-vm via Vagrant 10 years ago
devrandom ac4f77bcd1 Initialize umask to a known value (002) 11 years ago
Dev Random bdcbce6a0d Merge pull request #37 from TheBlueMatt/master
Fix bug + increase disk size
11 years ago
Matt Corallo 4e8ea08ee3 Fix gitian_updater checksum matching. 11 years ago
Matt Corallo 95e09ae608 Increase disk size for things like Firefox that need it. 11 years ago
devrandom 54f74f9c23 qemu-utils are required 11 years ago
devrandom 79c1217cb1 make passing env vars work across guest OS suites 11 years ago
devrandom 6919e04de1 use sudo even for root lxc so that path is set 11 years ago
devrandom f7148de91b try again 11 years ago
devrandom c47e51af72 second try 11 years ago
devrandom af52ebf6cb use shell for lxc-start exec 11 years ago
devrandom 054a72167c update README some more 11 years ago
devrandom 84796af6ac make README.md Sanity Test section work as written 11 years ago
Dev Random 47ec544d6a Merge pull request #42 from mmlb/patch-1
Update the README.md file to work better with github.
11 years ago
Manuel Mendez acc07d281b Update the README.md file to work better with github. 11 years ago
devrandom 6b0117e623 Complete license 11 years ago
devrandom 84fe4405c0 License file 11 years ago
Dev Random 6a76dccf97 Merge pull request #41 from arlolra/probably
Don't warn in if LXC.
11 years ago
Arlo Breault d9cc3d14b9 Don't warn in if LXC. 11 years ago
Dev Random 4295ee2b47 Merge pull request #40 from wtogami/ontargetuserfix
Fix --user in --help to display how the command actually works
11 years ago
Warren Togami e51dbdc9e3 Fix --user in --help to display how the command actually works 11 years ago
Dev Random 3c6379e89e Merge pull request #38 from laanwj/master
Increase ssh timeout to 30 seconds
11 years ago
Wladimir J. van der Laan cdb3bb4d43 Increase ssh connection timeout to 30 seconds
The previous 5-second timeout causes random errors during compilation
here, increasing it to 30 seconds solves this problem.
11 years ago
Dev Random 5512bb3cec Merge pull request #35 from luke-jr/no_recommends
Don't install package recommends implicitly
11 years ago
Dev Random 41c3545e3b Merge pull request #34 from luke-jr/bugfix_noninteractive
Bugfix: Use noninteractive frontend for apt-get
11 years ago
Dev Random 6134fe03b9 Merge pull request #33 from luke-jr/bugfix_update_head_ok
Bugfix: Pass --update-head-ok to git fetch to avoid problems overwriting checked out branch
11 years ago
Luke Dashjr f43ff49fa7 Don't install package recommends implicitly (require yml to specify them) 11 years ago
Luke Dashjr ffe46ca40b Bugfix: Use noninteractive frontend for apt-get 11 years ago
Luke Dashjr 46b75df3d3 Bugfix: Pass --update-head-ok to git fetch to avoid problems overwriting checked out branch 11 years ago
Dev Random 2e9ffa0f54 Merge pull request #32 from sipa/enablekvm
Perhaps also actually enable KVM...
11 years ago
Pieter Wuille 9a198b32a7 Perhaps also actually enable KVM... 11 years ago
Dev Random 67c24197d2 Merge pull request #31 from sipa/qemusystem
Use qemu-system- instead of kvm -m
11 years ago
Pieter Wuille b7b24bd401 Use qemu-system- instead of kvm -m
As kvm -m doesn't work in Ubuntu 13.04 anymore.
11 years ago
Dev Random 1f8299b9a0 Merge pull request #28 from luke-jr/custom_kvm
Allow environment-configurable KVM binary name
11 years ago
Dev Random 7e846db55e Merge pull request #29 from luke-jr/bugfix_changing_remote_uri
Bugfix: git fetch directly from the remote URL, rather than only setting a default the first time
11 years ago
Dev Random 72e4410d33 Merge pull request #30 from luke-jr/gentoo
Update README to include Gentoo instructions as well
11 years ago
Luke Dashjr fa1de4aca0 Update README to include Gentoo instructions as well 11 years ago
Luke Dashjr 9512784622 Bugfix: git fetch directly from the remote URL, rather than only setting a default the first time
- Fixes problem where the gitian URL varies for different branches of the same repository
- Explicitly fetching tags using + allows repository to overwrite existing tags (changed tag)
- Fetching branch heads to local heads correctly makes branch names available for commit option
- Fetching both branches and tags at the same time optimizes things slightly
11 years ago
Luke Dashjr 54aeb2df27 Allow environment-configurable KVM binary name 11 years ago
Dev Random 11d8efec50 Merge pull request #27 from gavinandresen/virtualbox
Virtualbox support
11 years ago
Gavin Andresen 8d937f553b VirtualBox support 11 years ago
devrandom f0c9e68fed Do not hardcode suite in bootstrap fixup 12 years ago
devrandom 5746af15e0 setarch on guest for LXC
Some packages use uname -m, which is not set to i386 on LXC on a 64 bit
host.

fixes #24
12 years ago

2
.gitignore vendored

@ -9,3 +9,5 @@ inputs
base*
*.qcow2
sigs
target-bin/bootstrap-fixup
.vagrant

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

@ -0,0 +1,26 @@
Copyright 2009-2013 Gitian Developers
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Exception: for the sake of clarity, an exception is granted to all
outputs from Gitian tools. The license shall not apply to outputs,
and their individual licenses shall apply.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Developers include:
* Miron Cuperman
* Matt Corallo
* Gavin Andresen
* Luke Dashjr
* Pieter Wuille

@ -1,6 +1,6 @@
# Gitian
Read about the project goals at the "project home page":https://gitian.org/ .
Read about the project goals at the [project home page](https://gitian.org/).
This package can do a deterministic build of a package inside a VM.
@ -8,31 +8,158 @@ This package can do a deterministic build of a package inside a VM.
This performs a build inside a VM, with deterministic inputs and outputs. If the build script takes care of all sources of non-determinism (mostly caused by timestamps), the result will always be the same. This allows multiple independent verifiers to sign a binary with the assurance that it really came from the source they reviewed.
## Synopsis:
## Prerequisites:
Install prereqs:
### Arch:
sudo apt-get install apt-cacher-ng python-vm-builder ruby
sudo pacman -S python2-cheetah qemu rsync
sudo pacman -S lxc libvirt bridge-utils # for lxc mode
If you want to use kvm:
sudo apt-get install qemu-kvm
From AUR:
or alternatively, lxc (no need for hardware support):
sudo apt-get install debootstrap lxc
* [apt-cacher-ng](https://aur.archlinux.org/packages/apt-cacher-ng/) (you may have to play with permissions (chown to apt-cacher-ng) on files to get apt-cacher-ng to start)
* [debian-archive-keyring](https://aur.archlinux.org/packages/debian-archive-keyring/) (for making Debian guests)
* [debootstrap](https://aur.archlinux.org/packages/debootstrap/)
* [dpkg](https://aur.archlinux.org/packages/dpkg/)
* [gnupg1](https://aur.archlinux.org/packages/gnupg1/)
* [multipath-tools](https://aur.archlinux.org/packages/multipath-tools/) (for kpartx)
* [ubuntu-keyring](https://aur.archlinux.org/packages/ubuntu-keyring/) (for making Ubuntu guests)
Create the base VM for use in further builds (requires sudo, please review the script):
From Launchpad:
* [vmbuilder](https://launchpad.net/vmbuilder)
Also, I had to modify the default /etc/sudoers file to uncomment the `secure_path` line, because vmbuilder isn't found otherwise when the `env -i ... sudo vmbuilder ...` line is executed (because the i flag resets the environment variables including the PATH).
### Gentoo:
layman -a luke-jr # needed for vmbuilder
sudo emerge dev-vcs/git net-misc/apt-cacher-ng app-emulation/vmbuilder dev-lang/ruby
sudo emerge app-emulation/qemu
export KVM=qemu-system-x86_64
### Ubuntu:
This pulls in all pre-requisites for KVM building on Ubuntu:
sudo apt-get install git apache2 apt-cacher-ng python-vm-builder ruby qemu-utils
If you'd like to use LXC mode instead, install it as follows:
sudo apt-get install lxc
### Debian:
See Ubuntu, and also run the following on Debian Jessie or newer:
sudo apt-get install ubuntu-archive-keyring
On Debian Wheezy you run the same command, but you must first add backports to your system, because the package is only available in wheezy-backports.
### OSX with MacPorts:
sudo port install ruby coreutils
export PATH=$PATH:/opt/local/libexec/gnubin # Needed for sha256sum
### OSX with Homebrew:
brew install ruby coreutils
export PATH=$PATH:/opt/local/libexec/gnubin
#### VirtualBox:
Install virtualbox from http://www.virtualbox.org, and make sure `VBoxManage` is in your `$PATH`.
## Debian Guests
Gitian now supports Debian guests in addition to Ubuntu guests. Note that this doesn't mean you can allow the builders to choose to use either Debian or Ubuntu guests. The person creating the Gitian descriptor will need to choose a particular distro and suite for the guest and all builders must use that particular distro and suite, otherwise the software won't reproduce for everyone.
The official vmbuilder only includes support for Ubuntu guests, so you need to install [Joseph Bisch's fork of vmbuilder](https://github.com/josephbisch/vmbuilder), which adds a Debian plugin.
To create a Debian guest:
bin/make-base-vm --distro debian --suite jessie
There is currently no support for LXC Debian guests. There is just KVM support. LXC support for Debian guests is planned to be added soon.
Only Debian Jessie guests have been tested with Gitian. Debian Jessie is the current stable release of Debian at this time. If you have success (or trouble) with other versions of Debian, please let us know.
If you are creating a Gitian descriptor, you can now specify a distro. If no distro is provided, the default is to assume Ubuntu. Since Ubuntu is assumed, older Gitian descriptors that don't specify a distro will still work as they always have.
## Create the base VM for use in further builds
**NOTE:** requires `sudo`, please review the script
### KVM
bin/make-base-vm
bin/make-base-vm --arch i386
or for lxc:
### LXC
bin/make-base-vm --lxc
bin/make-base-vm --lxc --arch i386
Set the `USE_LXC` environment variable to use `LXC` instead of `KVM`:
export USE_LXC=1
### VirtualBox
Command-line `VBoxManage` must be in your `$PATH`.
#### Setup:
`make-base-vm` cannot yet make VirtualBox virtual machines ( _patches welcome_, it should be possible to use `VBoxManage`, boot-from-network Linux images and PXE booting to do it). So you must either get or manually create VirtualBox machines that:
1. Are named `Gitian-<suite>-<arch>` -- e.g. Gitian-xenial-i386 for a 32-bit, Ubuntu 16 machine.
2. Have a booted-up snapshot named `Gitian-Clean` . The build script resets the VM to that snapshot to get reproducible builds.
3. Has the VM's NAT networking setup to forward port `localhost:2223` on the host machine to port `22` of the VM; e.g.:
```
VBoxManage modifyvm Gitian-xenial-i386 --natpf1 "guestssh,tcp,,2223,,22"
```
The final setup needed is to create an `ssh` key that will be used to login to the virtual machine:
ssh-keygen -t rsa -f var/id_rsa -N ""
ssh -p 2223 ubuntu@localhost 'mkdir -p .ssh && chmod 700 .ssh && cat >> .ssh/authorized_keys' < var/id_rsa.pub
Then log into the vm and copy the `ssh` keys to root's `authorized_keys` file.
ssh -p 2223 ubuntu@localhost
# Now in the vm
sudo bash
mkdir -p .ssh && chmod 700 .ssh && cat ~ubuntu/.ssh/authorized_keys >> .ssh/authorized_keys
Set the `USE_VBOX` environment variable to use `VBOX` instead of `KVM`:
export USE_VBOX=1
## Sanity-testing
If you have everything set-up properly, you should be able to:
PATH=$PATH:$(pwd)/libexec
make-clean-vm --suite xenial --arch i386
# on-target needs $DISTRO to be set to debian if using a Debian guest
# (when running gbuild, $DISTRO is set based on the descriptor, so this line isn't needed)
DiSTRO=debian
# For LXC:
LXC_ARCH=i386 LXC_SUITE=xenial on-target ls -la
# For KVM:
start-target 32 xenial-i386 &
# wait a few seconds for VM to start
on-target ls -la
stop-target
## Building
Copy any additional build inputs into a directory named _inputs_.
Then execute the build using a YAML description file (can be run as non-root):
Then execute the build using a `YAML` description file (can be run as non-root):
export USE_LXC=1 # LXC only
bin/gbuild <package>.yml
@ -41,26 +168,27 @@ or if you need to specify a commit for one of the git remotes:
bin/gbuild --commit <dir>=<hash> <package>.yml
The resulting report will appear in result/\<package\>-res.yml
The resulting report will appear in `result/<package>-res.yml`
To sign the result, perform:
bin/gsign --signer <signer> --release <release-name> <package>.yml
Where <signer> is your signing PGP key ID and <release-name> is the name for the current release. This will put the result and signature in the sigs/<package>/<release-name>. The sigs/<package> directory can be managed through git to coordinate multiple signers.
Where `<signer>` is your signing PGP key ID and `<release-name>` is the name for the current release. This will put the result and signature in the `sigs/<package>/<release-name>`. The `sigs/<package>` directory can be managed through git to coordinate multiple signers.
After you've merged everybody's signatures, verify them:
bin/gverify --release <release-name> <package>.yml
## Poking around
* Log files are captured to the _var_ directory
* You can run the utilities in libexec by running `PATH="libexec:$PATH"`
* To start the target VM run `start-target 32 lucid-i386` or `start-target 64 lucid-amd64`
* To ssh into the target run `on-target` or `on-target -u root`
* To start the target VM run `start-target 32 xenial-i386` or `start-target 64 xenial-amd64`
* To ssh into the target run `on-target` (after setting $DISTRO to debian if using a Debian guest) or `on-target -u root`
* On the target, the _build_ directory contains the code as it is compiled and _install_ contains intermediate libraries
* By convention, the script in \<package\>.yml starts with any environment setup you would need to manually compile things on the target
* By convention, the script in `<package>.yml` starts with any environment setup you would need to manually compile things on the target
TODO:
- disable sudo in target, just in case of a hypervisor exploit
@ -68,15 +196,20 @@ TODO:
## LXC tips
`bin/gbuild` runs `lxc-start`, which may require root. If you are in the admin group, you can add the following sudoers line to prevent asking for the password every time:
`bin/gbuild` runs `lxc-execute` or `lxc-start`, which may require root. If you are in the admin group, you can add the following sudoers line to prevent asking for the password every time:
%admin ALL=NOPASSWD: /usr/bin/lxc-execute
%admin ALL=NOPASSWD: /usr/bin/lxc-start
Recent distributions allow lxc-start to be run by non-priviledged users, so you might be able to rip-out the `sudo` calls in `libexec/*`.
Right now `lxc-start` is the default, but you can force `lxc-execute` (useful for Ubuntu 14.04) with:
export LXC_EXECUTE=lxc-execute
Recent distributions allow lxc-execute / lxc-start to be run by non-priviledged users, so you might be able to rip-out the `sudo` calls in `libexec/*`.
If you have a runaway `lxc-start` command, just use `kill -9` on it.
The machine configuration requires access to br0 and assumes that the host address is 10.0.2.2:
The machine configuration requires access to br0 and assumes that the host address is `10.0.2.2`:
sudo brctl addbr br0
sudo ifconfig br0 10.0.2.2/24 up

@ -0,0 +1,35 @@
2015-12-12
----------
Since OpenSSH removed support for DSS, Gitian now uses RSA keys instead. Base images should be regenerated.
2015-05-16
----------
LXC support has been revamped:
* debootstrap is now used directly, so that no kernel or grub packages are installed
* an attempt has been made to eliminate cases where an update of a package can fail because the container is missing a real init/upstart process
2015-03-23
----------
Now ensuring that `apt-get dist-upgrade` occurs at least once before package manifest
is computed. This is because distributions usually don't store old versions of packages
in the repos, so we can't download the exact package version we have installed if it's
out of date.
gbuild now has a --upgrade flag that forces an upgrade after the first one.
Other Notes
===========
Important:
We are planning on switching from using lxc-start to using lxc-execute. lxc-execute requires lxc-init (or init.lxc) to be available on the guest at one of the expected places. You might have to manually install lxc on your base VM image or recreate the image.
To enable this now (required for Ubuntu 14.04), do:
export LXC_EXECUTE=lxc-execute
If your guest is more recent than the host, all bets are off, since lxc-execute may not be able to find the lxc init.

46
Vagrantfile vendored

@ -0,0 +1,46 @@
$script = <<SCRIPT
#!/bin/bash
set -eu
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install -y autoconf2.13 automake build-essential bsdmainutils faketime g++ g++-mingw-w64 git-core libqt4-dev libtool libz-dev mingw-w64 nsis pciutils pkg-config psmisc subversion unzip zip
echo "ok"
SCRIPT
archs = ["amd64", "i386"]
suites = ["precise", "quantal", "raring", "saucy", "trusty"]
if ARGV[0] == "up" and ARGV.length == 1
puts "Specify a name of the form 'suite-architecture'"
puts " suites: " + suites.join(', ')
puts " architectures: " + archs.join(', ')
Process.exit 1
end
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: $script
config.vm.network :forwarded_port, id: "ssh", guest: 22, host: 2223
suites.each do |suite|
archs.each do |arch|
name = "#{suite}-#{arch}"
config.vm.define name do |config|
config.vm.box = name
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/#{suite}/current/#{suite}-server-cloudimg-#{arch}-vagrant-disk1.box"
config.vm.provider :virtualbox do |vb|
vb.name = "Gitian-#{name}"
end
end
end
end
config.vm.provider :virtualbox do |vb|
vb.memory = 4096
end
end

@ -12,6 +12,11 @@ require 'pathname'
'amd64' => 64,
}
@arches = {
'i386' => 'i386',
'amd64' => 'x86_64',
}
def system!(cmd)
system(cmd) or raise "failed to run #{cmd}"
end
@ -22,7 +27,7 @@ def sanitize(str, where)
end
def sanitize_path(str, where)
raise "unsanitary string in #{where}" if (str =~ /[^\w\/.:+-]/)
raise "unsanitary string in #{where}" if (str =~ /[^@\w\/.:+-]/)
str
end
@ -30,7 +35,7 @@ def info(str)
puts str unless @options[:quiet]
end
def build_one_configuration(suite, arch, build_desc, reference_datetime)
def build_one_configuration(suite, arch, build_desc)
FileUtils.rm_f("var/build.log")
bits = @bitness[arch] or raise "unknown architecture ${arch}"
@ -57,7 +62,7 @@ def build_one_configuration(suite, arch, build_desc, reference_datetime)
$stdout.write "Checking if target is up"
(1..10).each do
(1..30).each do
system "on-target true 2> /dev/null" and break
sleep 2
$stdout.write '.'
@ -67,21 +72,39 @@ def build_one_configuration(suite, arch, build_desc, reference_datetime)
system! "on-target true"
system! "on-target -u root tee -a /etc/sudoers.d/#{ENV['DISTRO'] || 'ubuntu'} > /dev/null << EOF
%#{ENV['DISTRO'] || 'ubuntu'} ALL=(ALL) NOPASSWD: ALL
EOF" if build_desc["sudo"] and @options[:allow_sudo]
info "Preparing build environment"
system! "on-target bash < target-bin/init-build.sh"
system! "on-target setarch #{@arches[arch]} bash < target-bin/init-build.sh"
build_desc["files"].each do |filename|
filename = sanitize(filename, "files section")
system! "copy-to-target #{@quiet_flag} inputs/#{filename} build/"
end
if build_desc["enable_cache"]
if File.directory?("cache/#{build_desc["name"]}")
system! "copy-to-target #{@quiet_flag} cache/#{build_desc["name"]}/ cache/"
end
if File.directory?("cache/common")
system! "copy-to-target #{@quiet_flag} cache/common/ cache/"
end
end
info "Updating apt-get repository (log in var/install.log)"
system! "on-target -u root apt-get update > var/install.log 2>&1"
info "Installing additional packages (log in var/install.log)"
system! "on-target -u root apt-get -y install #{build_desc["packages"].join(" ")} > var/install.log 2>&1"
system! "on-target -u root -e DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install #{build_desc["packages"].join(" ")} > var/install.log 2>&1"
info "Grabbing package manifest"
if @options[:upgrade] || system("on-target -u root '[ ! -e /var/cache/gitian/initial-upgrade ]'")
info "Upgrading system, may take a while"
system! "on-target -u root bash < target-bin/upgrade-system.sh > var/install.log 2>&1"
end
info "Creating package manifest"
system! "on-target -u root bash < target-bin/grab-packages.sh > var/base-#{suitearch}.manifest"
info "Creating build script (var/build-script)"
@ -89,25 +112,41 @@ def build_one_configuration(suite, arch, build_desc, reference_datetime)
File.open("var/build-script", "w") do |script|
script.puts "#!/bin/bash"
script.puts "set -e"
script.puts "export LANG='en_US.UTF-8'"
script.puts "export LC_ALL='en_US.UTF-8'"
script.puts "umask 002"
script.puts "export OUTDIR=$HOME/out"
script.puts "GBUILD_BITS=#{bits}"
if build_desc["enable_cache"]
script.puts "GBUILD_CACHE_ENABLED=1"
script.puts "GBUILD_PACKAGE_CACHE=$HOME/cache/#{build_desc["name"]}"
script.puts "GBUILD_COMMON_CACHE=$HOME/cache/common"
end
script.puts "MAKEOPTS=(-j#{@options[:num_procs]})"
(ref_date, ref_time) = reference_datetime.split
script.puts "REFERENCE_DATETIME='#{reference_datetime}'"
script.puts "REFERENCE_DATE='#{ref_date}'"
script.puts "REFERENCE_TIME='#{ref_time}'"
script.puts
author_date = nil
build_desc["remotes"].each do |remote|
dir = sanitize(remote["dir"], remote["dir"])
author_date = `cd inputs/#{dir} && git log --format=@%at -1 | date +"%F %T" -u -f -`.strip
raise "error looking up author date in #{dir}" unless $?.exitstatus == 0
system! "copy-to-target #{@quiet_flag} inputs/#{dir} build/"
script.puts "(cd build/#{dir} && git reset -q --hard && git clean -q -f -d)"
end
script.puts
ref_datetime = build_desc["reference_datetime"] || author_date
(ref_date, ref_time) = ref_datetime.split
script.puts "REFERENCE_DATETIME='#{ref_datetime}'"
script.puts "REFERENCE_DATE='#{ref_date}'"
script.puts "REFERENCE_TIME='#{ref_time}'"
script.puts
script.puts "cd build"
script.puts build_desc["script"]
end
info "Running build script (log in var/build.log)"
system! "on-target bash -x < var/build-script > var/build.log 2>&1"
system! "on-target setarch #{@arches[arch]} bash -x < var/build-script > var/build.log 2>&1"
end
################################
@ -115,9 +154,15 @@ end
OptionParser.new do |opts|
opts.banner = "Usage: build [options] <build-description>.yml"
opts.on("--allow-sudo", "override SECURITY on the target VM and allow the use of sudo with no password for the default user") do |v|
@options[:allow_sudo] = v
end
opts.on("-i", "--skip-image", "reuse current target image") do |v|
@options[:skip_image] = v
end
opts.on("--upgrade", "upgrade guest with latest packages") do |v|
@options[:upgrade] = v
end
opts.on("-q", "--quiet", "be quiet") do |v|
@options[:quiet] = v
end
@ -130,9 +175,15 @@ OptionParser.new do |opts|
opts.on("-c PAIRS", "--commit PAIRS", "comma separated list of DIRECTORY=COMMIT pairs") do |v|
@options[:commit] = v
end
opts.on("-u PAIRS", "--url PAIRS", "comma separated list of DIRECTORY=URL pairs") do |v|
@options[:url] = v
end
opts.on("-o", "--cache-read-only", "only use existing cache files, do not update them") do |v|
@options[:cache_ro] = v
end
end.parse!
if !File.exist?("/dev/kvm")
if !ENV["USE_LXC"] and !File.exist?("/dev/kvm")
$stderr.puts "\n************* WARNING: kvm not loaded, this will probably not work out\n\n"
end
@ -153,6 +204,8 @@ in_sums = []
build_dir = 'build'
result_dir = 'result'
cache_dir = 'cache'
enable_cache = build_desc["enable_cache"]
FileUtils.rm_rf(build_dir)
FileUtils.mkdir(build_dir)
@ -161,9 +214,17 @@ FileUtils.mkdir_p(result_dir)
package_name = build_desc["name"] or raise "must supply name"
package_name = sanitize(package_name, "package name")
if enable_cache
FileUtils.mkdir_p(File.join(cache_dir, "common"))
FileUtils.mkdir_p(File.join(cache_dir, package_name))
end
distro = build_desc["distro"] || "ubuntu"
suites = build_desc["suites"] or raise "must supply suites"
archs = build_desc["architectures"] or raise "must supply architectures"
reference_datetime = build_desc["reference_datetime"] or raise "must supply reference_datetime"
build_desc["reference_datetime"] or build_desc["remotes"].size > 0 or raise "must supply `reference_datetime` or `remotes`"
ENV['DISTRO'] = distro
desc_sum = `sha256sum #{build_desc_file}`
desc_sum = desc_sum.sub(build_desc_file, "#{package_name}-desc.yml")
@ -183,17 +244,28 @@ if @options[:commit]
end
end
urls = {}
if @options[:url]
@options[:url].split(',').each do |pair|
(dir, url) = pair.split('=')
urls[dir] = url
end
end
build_desc["remotes"].each do |remote|
if !remote["commit"]
remote["commit"] = commits[remote["dir"]]
raise "must specify a commit for directory #{remote["dir"]}" unless remote["commit"]
end
if urls[remote["dir"]]
remote["url"] = urls[remote["dir"]]
end
dir = sanitize(remote["dir"], remote["dir"])
unless File.exist?("inputs/#{dir}")
system!("git init inputs/#{dir}")
system!("cd inputs/#{dir} && git remote add origin #{sanitize_path(remote["url"], remote["url"])}")
end
system!("cd inputs/#{dir} && git fetch && git fetch --tags")
system!("cd inputs/#{dir} && git fetch --update-head-ok #{sanitize_path(remote["url"], remote["url"])} +refs/tags/*:refs/tags/* +refs/heads/*:refs/heads/*")
commit = sanitize(remote["commit"], remote["commit"])
commit = `cd inputs/#{dir} && git log --format=%H -1 #{commit}`.strip
raise "error looking up commit for tag #{remote["commit"]}" unless $?.exitstatus == 0
@ -210,11 +282,16 @@ suites.each do |suite|
arch = sanitize(arch, "architecture")
# Build!
build_one_configuration(suite, arch, build_desc, reference_datetime)
build_one_configuration(suite, arch, build_desc)
info "Grabbing results"
info "Grabbing results from target"
system! "copy-from-target #{@quiet_flag} out #{build_dir}"
if enable_cache && !@options[:cache_ro]
info "Grabbing cache from target"
system! "copy-from-target #{@quiet_flag} cache/#{package_name}/ #{cache_dir}"
system! "copy-from-target #{@quiet_flag} cache/common/ #{cache_dir}"
end
base_manifest = File.read("var/base-#{suite}-#{arch}.manifest")
base_manifests["#{suite}-#{arch}"] = base_manifest
end
@ -222,6 +299,10 @@ end
out_dir = File.join(build_dir, "out")
out_sums = {}
cache_common_dir = File.join(cache_dir, "common")
cache_package_dir = File.join(cache_dir, "#{package_name}")
cache_common_sums = {}
cache_package_sums = {}
info "Generating report"
Dir.glob(File.join(out_dir, '**', '*'), File::FNM_DOTMATCH).sort.each do |file_in_out|
@ -233,15 +314,38 @@ Dir.glob(File.join(out_dir, '**', '*'), File::FNM_DOTMATCH).sort.each do |file_i
puts out_sums[file] unless @options[:quiet]
end
if enable_cache
Dir.glob(File.join(cache_common_dir, '**', '*'), File::FNM_DOTMATCH).sort.each do |file_in_out|
next if File.directory?(file_in_out)
file = file_in_out.sub(cache_common_dir + File::SEPARATOR, '')
file = sanitize_path(file, file_in_out)
cache_common_sums[file] = `cd #{cache_common_dir} && sha256sum #{file}`
raise "failed to sum #{file}" unless $? == 0
end
Dir.glob(File.join(cache_package_dir, '**', '*'), File::FNM_DOTMATCH).sort.each do |file_in_out|
next if File.directory?(file_in_out)
file = file_in_out.sub(cache_package_dir + File::SEPARATOR, '')
file = sanitize_path(file, file_in_out)
cache_package_sums[file] = `cd #{cache_package_dir} && sha256sum #{file}`
raise "failed to sum #{file}" unless $? == 0
end
end
out_manifest = out_sums.keys.sort.map { |key| out_sums[key] }.join('')
in_manifest = in_sums.join('')
cache_common_manifest = cache_common_sums.keys.sort.map { |key| cache_common_sums[key] }.join('')
cache_package_manifest = cache_package_sums.keys.sort.map { |key| cache_package_sums[key] }.join('')
# Use Omap to keep result deterministic
report = YAML::Omap[
'out_manifest', out_manifest,
'in_manifest', in_manifest,
'base_manifests', base_manifests,
'cache_common_manifest', cache_common_manifest,
'cache_package_manifest', cache_package_manifest,
]
result_file = "#{package_name}-res.yml"

@ -17,7 +17,7 @@ def sanitize(str, where)
end
def sanitize_path(str, where)
raise "unsanitary string in #{where}" if (str =~ /[^\w\/.-]/)
raise "unsanitary string in #{where}" if (str =~ /[^@\w\/.:+-]/)
str
end
@ -45,6 +45,10 @@ OptionParser.new do |opts|
opts.on("-d DEST", "--destination DEST", "directory to place signature in") do |v|
@options[:destination] = v
end
opts.on("-p PROG", "--signing_program PROG", "specify signing program to use") do |v|
@options[:program] = v
end
end.parse!
base_dir = Pathname.new(__FILE__).expand_path.dirname.parent
@ -76,6 +80,7 @@ result['type'] = 'build'
result['optionals'] = optionals
signer = @options[:signer] or raise "must supply signer with --signer"
program = @options[:program] || "gpg --detach-sign"
FileUtils.mkdir_p(destination)
@ -85,4 +90,4 @@ assert_path = File.join(release_path, "#{package_name}-build.assert")
File.open(assert_path, "w") do |io|
io.write result.to_yaml
end
system!("gpg --detach-sign -u \"#{signer}\" \"#{assert_path}\"")
system!("#{program} -u \"#{signer}\" \"#{assert_path}\"")

@ -5,6 +5,8 @@ require 'yaml'
require 'fileutils'
require 'pathname'
bold = ["\033[0m", "\033[1m"]
@options = {}
def system!(cmd)
@ -17,7 +19,7 @@ def sanitize(str, where)
end
def sanitize_path(str, where)
raise "unsanitary string in #{where}" if (str =~ /[^@\w\/. -]/)
raise "unsanitary string in #{where}" if (str =~ /[^@\w\/.:+-]/)
str
end
@ -33,6 +35,11 @@ OptionParser.new do |opts|
opts.on("-v", "--verbose", "be more verbose") do |v|
@options[:verbose] = v
end
@options[:markup] = true
opts.on("-m", "--[no-]markup", "markup the output using ANSI escape codes") do |m|
@options[:markup] = m
end
opts.on("-r REL", "--release REL", "release name") do |v|
@options[:release] = v
end
@ -40,6 +47,9 @@ OptionParser.new do |opts|
opts.on("-d DEST", "--destination DEST", "directory to place signature in") do |v|
@options[:destination] = v
end
opts.on("-c SIGNER", "--compare-to SIGNER", "compare other manifests to SIGNER's, if not given pick first") do |v|
@options[:compareto] = v
end
end.parse!
base_dir = Pathname.new(__FILE__).expand_path.dirname.parent
@ -58,6 +68,8 @@ package_name = sanitize(package_name, "package name")
destination = @options[:destination] || File.join(base_dir, "sigs", package_name)
release = @options[:release] || "current"
release = sanitize(release, "release")
verbose = @options[:verbose]
bold = ['', ''] unless @options[:markup]
release_path = File.join(destination, release)
@ -67,6 +79,13 @@ result_file = "#{package_name}-build.assert"
sig_file = "#{result_file}.sig"
current_manifest = nil
if @options[:compareto]
# Load a specific 'golden' manifest to compare to
compareto = @options[:compareto]
result_path = sanitize_path(File.join(release_path, compareto, result_file), "result path")
result = YAML.load_file(result_path)
current_manifest = result['out_manifest']
end
did_fail = false
@ -98,7 +117,8 @@ Dir.foreach(release_path) do |signer_dir|
puts line
end
end
puts "#{signer_dir}: BAD SIGNATURE"
puts "#{bold[1]}#{signer_dir}: BAD SIGNATURE#{bold[0]}"
puts
did_fail = true
elsif current_manifest and (result['out_manifest'] != current_manifest or result['release'] != release or result['name'] != package_name)
out.each_line do |line|
@ -112,7 +132,18 @@ Dir.foreach(release_path) do |signer_dir|
puts line
end
end
puts "#{signer_dir}: MISMATCH"
puts "#{bold[1]}#{signer_dir}: MISMATCH#{bold[0]}"
puts
if verbose
lines1 = current_manifest.each_line
lines2 = result['out_manifest'].each_line
lines1.zip(lines2) do |line|
if line[0] != line[1]
puts "- "+line[0]
puts "+ "+line[1]
end
end
end
did_fail = true
else
out.each_line do |line|
@ -126,9 +157,13 @@ Dir.foreach(release_path) do |signer_dir|
puts line
end
end
puts "#{signer_dir}: OK"
puts "#{bold[1]}#{signer_dir}: OK#{bold[0]}"
puts
end
if !current_manifest
# take first manifest as 'current' to compare against
current_manifest = result['out_manifest']
end
current_manifest = result['out_manifest']
end
exit 1 if did_fail

@ -1,27 +1,45 @@
#!/bin/sh
set -e
SUITE=lucid
DISTRO=ubuntu
SUITE=xenial
ARCH=amd64
MIRROR=http://${MIRROR_HOST:-127.0.0.1}:3142/archive.ubuntu.com/ubuntu
SECURITY_MIRROR=http://${MIRROR_HOST:-127.0.0.1}:3142/security.ubuntu.com/ubuntu
MIRROR_BASE=http://${MIRROR_HOST:-127.0.0.1}:3142
LXC=0
VBOX=0
usage() {
echo "Usage: ${0##*/} [OPTION]..."
echo "Make a base client."
echo
cat << EOF
--help display this help and exit
--suite U build suite U instead of lucid
--arch A build architecture A (e.g. i386) instead of amd64
--lxc use lxc instead of kvm
--help display this help and exit
--distro D build distro D (e.g. debian) instead of ubuntu
--suite U build suite U instead of xenial
--arch A build architecture A (e.g. i386) instead of amd64
--lxc use lxc instead of kvm
--vbox use VirtualBox instead of kvm
The MIRROR_HOST environment variable can be used to change the
apt-cacher host. It should be something that the target VM can
resolve. It may be set to 127.0.0.1, in which case it will be
changed to 10.0.2.2 on the guest. 10.0.2.2 is the host IP as visible
from the guest under qemu networking.
apt-cacher host. It should be something that both the host and the
target VM can reach. It may be set to 127.0.0.1, in which case it will be
changed to 10.0.2.2 on the guest (or GITIAN_HOST_IP if it is defined)
10.0.2.2 is the host IP as visible from the guest under qemu networking.
The DEBOOTSTRAP_DIR (but also GITIAN_SUDO_USE_DEBOOTSTRAP_DIR, see below!)
environment variable can be set to select a directory
that will contain data like in "/usr/share/debootstrap/". This allows user to
make a copy of this files to some local dir and modify them locally:
e.g. set env variable "DEBOOTSTRAP_DIR=./mydeboot/", then copy or link
system's version of files there, and modify them there
(e.g. copy your debootstrap-script file "xenial" to "./mydeboot/scripts/").
Set env GITIAN_SUDO_USE_DEBOOTSTRAP_DIR="yes" to allow sudo for debootstrap
to use flags like --preserve-env that are required for DEBOOTSTRAP_DIR to work.
It must be equal string "yes".
This is done as separate variable to make it clear that we modify sudo
behaviour here regarding security (though anyway env is cleared with
whitelist so should be perfectly safe).
EOF
}
@ -32,6 +50,10 @@ if [ $# != 0 ] ; then
usage
exit 0
;;
--distro|-d)
DISTRO="$2"
shift 2
;;
--suite|-s)
SUITE="$2"
shift 2
@ -44,6 +66,10 @@ if [ $# != 0 ] ; then
LXC=1
shift 1
;;
--vbox)
VBOX=1
shift 1
;;
--*)
echo "unrecognized option $1"
exit 1
@ -55,10 +81,20 @@ if [ $# != 0 ] ; then
done
fi
if [ $DISTRO = "ubuntu" ]; then
MIRROR=$MIRROR_BASE/archive.ubuntu.com/ubuntu
SECURITY_MIRROR=$MIRROR_BASE/security.ubuntu.com/ubuntu
components=main,universe
elif [ $DISTRO = "debian" ]; then
MIRROR=$MIRROR_BASE/ftp.debian.org/debian
SECURITY_MIRROR=$MIRROR_BASE/security.debian.org/
components=main,contrib
fi
mkdir -p var
if [ ! -e var/id_dsa ]; then
ssh-keygen -t dsa -f var/id_dsa -N ""
if [ ! -e var/id_rsa ]; then
ssh-keygen -t rsa -f var/id_rsa -N ""
fi
OUT=base-$SUITE-$ARCH
@ -68,30 +104,128 @@ if [ $ARCH = "amd64" -a $SUITE = "hardy" ]; then
FLAVOUR=server
fi
addpkg=openssh-server,pciutils,build-essential,git-core,subversion
if [ $DISTRO = "debian" -a $ARCH = "amd64" ]; then
FLAVOUR=amd64
elif [ $DISTRO = "debian" -a $ARCH = "i386" -a \($SUITE = "squeeze" -o $SUITE = "lenny" -o $SUITE = "etch" -o $SUITE = "sarge" -o $SUITE = "woody" -o $SUITE = "potato" -o $SUITE = "slink" -o $SUITE = "hamm" -o $SUITE = "bo" -o $SUITE = "rex" -o $SUITE = "buzz"\) ]; then
FLAVOUR=686
elif [ $DISTRO = "debian" ]; then
FLAVOUR=686-pae
fi
LOCALE_PKG=language-pack-en
if [ $DISTRO = "debian" ]; then
LOCALE_PKG=locales
fi
addpkg=pciutils,build-essential,git-core,subversion,$LOCALE_PKG,wget,lsb-release
if [ $DISTRO = "ubuntu" ]; then
# Need comma at end to work around an issue with apt for Debian <= Wheezy regarding empty strings
#
# If we left the comma down below when adding KERNEL_PKG to addpkg, the fact that KERNEL_PKG is undefined
# if DISTRO is debian would result in two commas in a row (,,), which is interpreted by apt-get as the
# package with the name empty string (""). This triggers a bug with apt versions < 1.0.3. So by adding the
# comma to the end of KERNEL_PKG, we are including that comma if the distro is ubuntu (and therefore we do
# have a kernel package that needs to be installed). If KERNEL_PKG is not set (i.e. we have Debian as the
# distro), then we don't add that extra comma and therefore, we don't end up with two commas in a row.
#
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744940
# http://anonscm.debian.org/cgit/apt/apt.git/commit/?h=1.0.3&id=d99854cac4065bc7b337815fb2116269d58dab73
KERNEL_PKG=linux-image-generic,
fi
GRUB_PKG=grub
if [ $DISTRO = "ubuntu" ]; then
GRUB_PKG=grub-pc
fi
if [ $LXC = "1" ]; then
addpkg=$addpkg,lxc
if [ $DISTRO = "debian" ]; then
addpkg=$addpkg,sudo
fi
else
# Lack of comma after KERNEL_PKG is not a typo
addpkg=$addpkg,${KERNEL_PKG}${GRUB_PKG},openssh-server
fi
# Remove cron to work around vmbuilder issue when umounting /dev on target
removepkg=cron
if [ -e $OUT.qcow2 ]; then
echo $OUT.qcow2 already exists, please remove it first
exit 1
fi
if [ $VBOX = "1" ]; then
NAME="$SUITE-$ARCH"
if ! vagrant status | grep "$NAME" | grep "not created" > /dev/null; then
echo "Vagrant machine "$NAME" already exists, please remove it first (vagrant destroy "$NAME")"
exit 1
fi
vagrant up "$NAME"
rm -rf $OUT
sudo vmbuilder kvm ubuntu --arch=$ARCH --suite=$SUITE --addpkg=$addpkg --removepkg=$removepkg --ssh-key=var/id_dsa.pub --ssh-user-key=var/id_dsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=$FLAVOUR --firstboot=`pwd`/target-bin/bootstrap-fixup
mv $OUT/*.qcow2 $OUT.qcow2
rm -rf $OUT
vagrant ssh "$NAME" -c "sudo mkdir -p /root/.ssh && sudo chmod 700 /root/.ssh"
vagrant ssh "$NAME" -c "sudo sh -c 'cat >> /root/.ssh/authorized_keys'" < var/id_rsa.pub
vagrant ssh "$NAME" -c "sudo -u $DISTRO mkdir -p /home/$DISTRO/.ssh && sudo -u $DISTRO chmod 700 /home/$DISTRO/.ssh"
vagrant ssh "$NAME" -c "sudo sh -c 'cat >> /home/$DISTRO/.ssh/authorized_keys'" < var/id_rsa.pub
VBoxManage snapshot "Gitian-$NAME" take "Gitian-Clean"
vagrant suspend "$NAME"
exit 0
fi
if [ $LXC = "1" ]; then
#sudo debootstrap --include=$addpkg --arch=$ARCH $SUITE $OUT-root $MIRROR
echo Extracting partition for lxc
qemu-img convert $OUT.qcow2 $OUT.raw
loop=`sudo kpartx -av $OUT.raw|sed -n '/loop.p1/{s/.*loop\(.\)p1.*/\1/;p}'`
sudo cp --sparse=always /dev/mapper/loop${loop}p1 $OUT
sudo chown $USER $OUT
sudo kpartx -d /dev/loop$loop
rm -f $OUT.raw
# bootstrap-fixup is done in libexec/make-clean-vm
if [ -e $OUT ]; then
echo $OUT already exists, please remove it first
exit 1
fi
sudo rm -rf $OUT-bootstrap
# Need universe for lxc in lucid
unset preserve_env
if [ "$GITIAN_SUDO_USE_DEBOOTSTRAP_DIR" = "yes" ]; then
echo "sudo will preserve (some) env flags"
preserve_env=yes # if you would want to set false then unset this variable
fi
env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 DEBOOTSTRAP_DIR="$DEBOOTSTRAP_DIR" sudo ${preserve_env+--preserve-env} debootstrap --arch=$ARCH --include=$addpkg --exclude=$removepkg --components=$components $SUITE $OUT-bootstrap $MIRROR
# Fix lxc issue
if [ -f $OUT-bootstrap/usr/lib/lxc/lxc-init ]
then
sudo cp $OUT-bootstrap/usr/lib/lxc/lxc-init $OUT-bootstrap/usr/sbin/init.lxc
else
if [ $ARCH = "amd64" ]
then
if [ -f $OUT-bootstrap/usr/lib/x86_64-linux-gnu/lxc/lxc-init ]
then
sudo cp $OUT-bootstrap/usr/lib/x86_64-linux-gnu/lxc/lxc-init $OUT-bootstrap/usr/sbin/init.lxc
fi
else
if [ -f $OUT-bootstrap/usr/lib/i386-linux-gnu/lxc/lxc-init ]
then
sudo cp $OUT-bootstrap/usr/lib/i386-linux-gnu/lxc/lxc-init $OUT-bootstrap/usr/sbin/init.lxc
fi
fi
fi
dd if=/dev/zero of=$OUT-lxc bs=1M count=1 seek=10240
/sbin/mkfs.ext4 -F $OUT-lxc
t=`mktemp -d gitian.XXXXXXXX`
sudo mount $OUT-lxc $t
sudo cp -a $OUT-bootstrap/* $t
sudo umount $t
rmdir $t
sudo rm -rf $OUT-bootstrap
mv $OUT-lxc $OUT
# bootstrap-fixup is done in libexec/make-clean-vm
else
if [ -e $OUT.qcow2 ]; then
echo $OUT.qcow2 already exists, please remove it first
exit 1
fi
libexec/config-bootstrap-fixup
rm -rf $OUT
env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 sudo vmbuilder kvm $DISTRO --rootsize 10240 --arch=$ARCH --suite=$SUITE --addpkg=$addpkg --removepkg=$removepkg --ssh-key=var/id_rsa.pub --ssh-user-key=var/id_rsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=$FLAVOUR --firstboot=`pwd`/target-bin/bootstrap-fixup
mv $OUT/*.qcow2 $OUT.qcow2
rm -rf $OUT
# bootstrap-fixup is done on first boot
fi

@ -0,0 +1,9 @@
Repository Tools
---------------------
### [Developer tools](/contrib/devtools) ###
Specific tools for developers working on this repository.
Contains the script `github-merge.py` for merging github pull requests securely and signing them using GPG.
### [Verify-Commits](/contrib/verify-commits) ###
Tool to verify that every merge commit was signed by a developer using the above `github-merge.py` script.

@ -0,0 +1,37 @@
Contents
========
This directory contains tools for developers working on this repository.
github-merge.py
===============
A small script to automate merging pull-requests securely and sign them with GPG.
For example:
./github-merge.py 3077
(in any git repository) will help you merge pull request #3077 for the
devrandom/gitian-builder repository.
What it does:
* Fetch master and the pull request.
* Locally construct a merge commit.
* Show the diff that merge results in.
* Ask you to verify the resulting source tree (so you can do a make
check or whatever).
* Ask you whether to GPG sign the merge commit.
* Ask you whether to push the result upstream.
This means that there are no potential race conditions (where a
pullreq gets updated while you're reviewing it, but before you click
merge), and when using GPG signatures, that even a compromised github
couldn't mess with the sources.
Setup
---------
Configuring the github-merge tool for this repository is done in the following way:
git config githubmerge.repository devrandom/gitian-builder
git config githubmerge.testcmd "make -j4 check" (adapt to whatever you want to use for testing)
git config --global user.signingkey mykeyid (if you want to GPG sign)

@ -0,0 +1,251 @@
#!/usr/bin/env python3
# Copyright (c) 2016 Bitcoin Core Developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# This script will locally construct a merge commit for a pull request on a
# github repository, inspect it, sign it and optionally push it.
# The following temporary branches are created/overwritten and deleted:
# * pull/$PULL/base (the current master we're merging onto)
# * pull/$PULL/head (the current state of the remote pull request)
# * pull/$PULL/merge (github's merge)
# * pull/$PULL/local-merge (our merge)
# In case of a clean merge that is accepted by the user, the local branch with
# name $BRANCH is overwritten with the merged result, and optionally pushed.
from __future__ import division,print_function,unicode_literals
import os,sys
from sys import stdin,stdout,stderr
import argparse
import subprocess
import json,codecs
try:
from urllib.request import Request,urlopen
except:
from urllib2 import Request,urlopen
# External tools (can be overridden using environment)
GIT = os.getenv('GIT','git')
BASH = os.getenv('BASH','bash')
# OS specific configuration for terminal attributes
ATTR_RESET = ''
ATTR_PR = ''
COMMIT_FORMAT = '%h %s (%an)%d'
if os.name == 'posix': # if posix, assume we can use basic terminal escapes
ATTR_RESET = '\033[0m'
ATTR_PR = '\033[1;36m'
COMMIT_FORMAT = '%C(bold blue)%h%Creset %s %C(cyan)(%an)%Creset%C(green)%d%Creset'
def git_config_get(option, default=None):
'''
Get named configuration option from git repository.
'''
try:
return subprocess.check_output([GIT,'config','--get',option]).rstrip().decode('utf-8')
except subprocess.CalledProcessError as e:
return default
def retrieve_pr_info(repo,pull):
'''
Retrieve pull request information from github.
Return None if no title can be found, or an error happens.
'''
try:
req = Request("https://api.github.com/repos/"+repo+"/pulls/"+pull)
result = urlopen(req)
reader = codecs.getreader('utf-8')
obj = json.load(reader(result))
return obj
except Exception as e:
print('Warning: unable to retrieve pull information from github: %s' % e)
return None
def ask_prompt(text):
print(text,end=" ",file=stderr)
stderr.flush()
reply = stdin.readline().rstrip()
print("",file=stderr)
return reply
def parse_arguments():
epilog = '''
In addition, you can set the following git configuration variables:
githubmerge.repository (mandatory),
user.signingkey (mandatory),
githubmerge.host (default: git@github.com),
githubmerge.branch (no default),
githubmerge.testcmd (default: none).
'''
parser = argparse.ArgumentParser(description='Utility to merge, sign and push github pull requests',
epilog=epilog)
parser.add_argument('pull', metavar='PULL', type=int, nargs=1,
help='Pull request ID to merge')
parser.add_argument('branch', metavar='BRANCH', type=str, nargs='?',
default=None, help='Branch to merge against (default: githubmerge.branch setting, or base branch for pull, or \'master\')')
return parser.parse_args()
def main():
# Extract settings from git repo
repo = git_config_get('githubmerge.repository')
host = git_config_get('githubmerge.host','git@github.com')
opt_branch = git_config_get('githubmerge.branch',None)
testcmd = git_config_get('githubmerge.testcmd')
signingkey = git_config_get('user.signingkey')
if repo is None:
print("ERROR: No repository configured. Use this command to set:", file=stderr)
print("git config githubmerge.repository <owner>/<repo>", file=stderr)
exit(1)
if signingkey is None:
print("ERROR: No GPG signing key set. Set one using:",file=stderr)
print("git config --global user.signingkey <key>",file=stderr)
exit(1)
host_repo = host+":"+repo # shortcut for push/pull target
# Extract settings from command line
args = parse_arguments()
pull = str(args.pull[0])
# Receive pull information from github
info = retrieve_pr_info(repo,pull)
if info is None:
exit(1)
title = info['title']
# precedence order for destination branch argument:
# - command line argument
# - githubmerge.branch setting
# - base branch for pull (as retrieved from github)
# - 'master'
branch = args.branch or opt_branch or info['base']['ref'] or 'master'
# Initialize source branches
head_branch = 'pull/'+pull+'/head'
base_branch = 'pull/'+pull+'/base'
merge_branch = 'pull/'+pull+'/merge'
local_merge_branch = 'pull/'+pull+'/local-merge'
devnull = open(os.devnull,'w')
try:
subprocess.check_call([GIT,'checkout','-q',branch])
except subprocess.CalledProcessError as e:
print("ERROR: Cannot check out branch %s." % (branch), file=stderr)
exit(3)
try:
subprocess.check_call([GIT,'fetch','-q',host_repo,'+refs/pull/'+pull+'/*:refs/heads/pull/'+pull+'/*'])
except subprocess.CalledProcessError as e:
print("ERROR: Cannot find pull request #%s on %s." % (pull,host_repo), file=stderr)
exit(3)
try:
subprocess.check_call([GIT,'log','-q','-1','refs/heads/'+head_branch], stdout=devnull, stderr=stdout)
except subprocess.CalledProcessError as e:
print("ERROR: Cannot find head of pull request #%s on %s." % (pull,host_repo), file=stderr)
exit(3)
try:
subprocess.check_call([GIT,'log','-q','-1','refs/heads/'+merge_branch], stdout=devnull, stderr=stdout)
except subprocess.CalledProcessError as e:
print("ERROR: Cannot find merge of pull request #%s on %s." % (pull,host_repo), file=stderr)
exit(3)
try:
subprocess.check_call([GIT,'fetch','-q',host_repo,'+refs/heads/'+branch+':refs/heads/'+base_branch])
except subprocess.CalledProcessError as e:
print("ERROR: Cannot find branch %s on %s." % (branch,host_repo), file=stderr)
exit(3)
subprocess.check_call([GIT,'checkout','-q',base_branch])
subprocess.call([GIT,'branch','-q','-D',local_merge_branch], stderr=devnull)
subprocess.check_call([GIT,'checkout','-q','-b',local_merge_branch])
try:
# Create unsigned merge commit.
if title:
firstline = 'Merge #%s: %s' % (pull,title)
else:
firstline = 'Merge #%s' % (pull,)
message = firstline + '\n\n'
message += subprocess.check_output([GIT,'log','--no-merges','--topo-order','--pretty=format:%h %s (%an)',base_branch+'..'+head_branch]).decode('utf-8')
try:
subprocess.check_call([GIT,'merge','-q','--commit','--no-edit','--no-ff','-m',message.encode('utf-8'),head_branch])
except subprocess.CalledProcessError as e:
print("ERROR: Cannot be merged cleanly.",file=stderr)
subprocess.check_call([GIT,'merge','--abort'])
exit(4)
logmsg = subprocess.check_output([GIT,'log','--pretty=format:%s','-n','1']).decode('utf-8')
if logmsg.rstrip() != firstline.rstrip():
print("ERROR: Creating merge failed (already merged?).",file=stderr)
exit(4)
print('%s#%s%s %s %sinto %s%s' % (ATTR_RESET+ATTR_PR,pull,ATTR_RESET,title,ATTR_RESET+ATTR_PR,branch,ATTR_RESET))
subprocess.check_call([GIT,'log','--graph','--topo-order','--pretty=format:'+COMMIT_FORMAT,base_branch+'..'+head_branch])
print()
# Run test command if configured.
if testcmd:
# Go up to the repository's root.
toplevel = subprocess.check_output([GIT,'rev-parse','--show-toplevel']).strip()
os.chdir(toplevel)
if subprocess.call(testcmd,shell=True):
print("ERROR: Running %s failed." % testcmd,file=stderr)
exit(5)
# Show the created merge.
diff = subprocess.check_output([GIT,'diff',merge_branch+'..'+local_merge_branch])
subprocess.check_call([GIT,'diff',base_branch+'..'+local_merge_branch])
if diff:
print("WARNING: merge differs from github!",file=stderr)
reply = ask_prompt("Type 'ignore' to continue.")
if reply.lower() == 'ignore':
print("Difference with github ignored.",file=stderr)
else:
exit(6)
reply = ask_prompt("Press 'd' to accept the diff.")
if reply.lower() == 'd':
print("Diff accepted.",file=stderr)
else:
print("ERROR: Diff rejected.",file=stderr)
exit(6)
else:
# Verify the result manually.
print("Dropping you on a shell so you can try building/testing the merged source.",file=stderr)
print("Run 'git diff HEAD~' to show the changes being merged.",file=stderr)
print("Type 'exit' when done.",file=stderr)
if os.path.isfile('/etc/debian_version'): # Show pull number on Debian default prompt
os.putenv('debian_chroot',pull)
subprocess.call([BASH,'-i'])
reply = ask_prompt("Type 'm' to accept the merge.")
if reply.lower() == 'm':
print("Merge accepted.",file=stderr)
else:
print("ERROR: Merge rejected.",file=stderr)
exit(7)
# Sign the merge commit.
reply = ask_prompt("Type 's' to sign off on the merge.")
if reply == 's':
try:
subprocess.check_call([GIT,'commit','-q','--gpg-sign','--amend','--no-edit'])
except subprocess.CalledProcessError as e:
print("Error signing, exiting.",file=stderr)
exit(1)
else:
print("Not signing off on merge, exiting.",file=stderr)
exit(1)
# Put the result in branch.
subprocess.check_call([GIT,'checkout','-q',branch])
subprocess.check_call([GIT,'reset','-q','--hard',local_merge_branch])
finally:
# Clean up temporary branches.
subprocess.call([GIT,'checkout','-q',branch])
subprocess.call([GIT,'branch','-q','-D',head_branch],stderr=devnull)
subprocess.call([GIT,'branch','-q','-D',base_branch],stderr=devnull)
subprocess.call([GIT,'branch','-q','-D',merge_branch],stderr=devnull)
subprocess.call([GIT,'branch','-q','-D',local_merge_branch],stderr=devnull)
# Push the result.
reply = ask_prompt("Type 'push' to push the result to %s, branch %s." % (host_repo,branch))
if reply.lower() == 'push':
subprocess.check_call([GIT,'push',host_repo,'refs/heads/'+branch])
if __name__ == '__main__':
main()

@ -0,0 +1,26 @@
Tooling for verification of PGP signed commits
----------------------------------------------
This is an incomplete work in progress, but currently includes a pre-push hook
script (`pre-push-hook.sh`) for maintainers to ensure that their own commits
are PGP signed (nearly always merge commits), as well as a script to verify
commits against a trusted keys list.
Using verify-commits.sh safely
------------------------------
Remember that you can't use an untrusted script to verify itself. This means
that checking out code, then running `verify-commits.sh` against `HEAD` is
_not_ safe, because the version of `verify-commits.sh` that you just ran could
be backdoored. Instead, you need to use a trusted version of verify-commits
prior to checkout to make sure you're checking out only code signed by trusted
keys:
git fetch origin && \
./contrib/verify-commits/verify-commits.sh origin/master && \
git checkout origin/master
Note that the above isn't a good UI/UX yet, and needs significant improvements
to make it more convenient and reduce the chance of errors; pull-reqs
improving this process would be much appreciated.

@ -0,0 +1,37 @@
#!/bin/sh
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
INPUT=$(cat /dev/stdin)
VALID=false
REVSIG=false
IFS='
'
for LINE in $(echo "$INPUT" | gpg --trust-model always "$@" 2>/dev/null); do
case "$LINE" in
"[GNUPG:] VALIDSIG "*)
while read KEY; do
case "$LINE" in "[GNUPG:] VALIDSIG $KEY "*) VALID=true;; esac
done < ./contrib/verify-commits/trusted-keys
;;
"[GNUPG:] REVKEYSIG "*)
[ "$BITCOIN_VERIFY_COMMITS_ALLOW_REVSIG" != 1 ] && exit 1
while read KEY; do
case "$LINE" in "[GNUPG:] REVKEYSIG ${KEY#????????????????????????} "*)
REVSIG=true
GOODREVSIG="[GNUPG:] GOODSIG ${KEY#????????????????????????} "
esac
done < ./contrib/verify-commits/trusted-keys
;;
esac
done
if ! $VALID; then
exit 1
fi
if $VALID && $REVSIG; then
echo "$INPUT" | gpg --trust-model always "$@" | grep "\[GNUPG:\] \(NEWSIG\|SIG_ID\|VALIDSIG\)" 2>/dev/null
echo "$GOODREVSIG"
else
echo "$INPUT" | gpg --trust-model always "$@" 2>/dev/null
fi

@ -0,0 +1,20 @@
#!/bin/bash
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
if ! [[ "$2" =~ ^(git@)?(www.)?github.com(:|/)devrandom/gitian-builder(.git)?$ ]]; then
exit 0
fi
while read LINE; do
set -- A $LINE
if [ "$4" != "refs/heads/master" ]; then
continue
fi
if ! ./contrib/verify-commits/verify-commits.sh $3 > /dev/null 2>&1; then
echo "ERROR: A commit is not signed, can't push"
./contrib/verify-commits/verify-commits.sh
exit 1
fi
done < /dev/stdin

@ -0,0 +1 @@
bb4f92f6cbde6ee78e39ae35b0934da3b55e154d

@ -0,0 +1 @@
498FA3769A88C4AD1B187A7428EB4B0FB7AAF6B0

@ -0,0 +1,62 @@
#!/bin/sh
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Not technically POSIX-compliant due to use of "local", but almost every
# shell anyone uses today supports it, so its probably fine
DIR=$(dirname "$0")
[ "/${DIR#/}" != "$DIR" ] && DIR=$(dirname "$(pwd)/$0")
VERIFIED_ROOT=$(cat "${DIR}/trusted-git-root")
REVSIG_ALLOWED=$(cat "${DIR}/allow-revsig-commits")
HAVE_FAILED=false
IS_SIGNED () {
if [ $1 = $VERIFIED_ROOT ]; then
return 0;
fi
if [ "${REVSIG_ALLOWED#*$1}" != "$REVSIG_ALLOWED" ]; then
export BITCOIN_VERIFY_COMMITS_ALLOW_REVSIG=1
else
export BITCOIN_VERIFY_COMMITS_ALLOW_REVSIG=0
fi
if ! git -c "gpg.program=${DIR}/gpg.sh" verify-commit $1 > /dev/null 2>&1; then
return 1;
fi
local PARENTS
PARENTS=$(git show -s --format=format:%P $1)
for PARENT in $PARENTS; do
if IS_SIGNED $PARENT > /dev/null; then
return 0;
fi
done
if ! "$HAVE_FAILED"; then
echo "No parent of $1 was signed with a trusted key!" > /dev/stderr
echo "Parents are:" > /dev/stderr
for PARENT in $PARENTS; do
git show -s $PARENT > /dev/stderr
done
HAVE_FAILED=true
fi
return 1;
}
if [ x"$1" = "x" ]; then
TEST_COMMIT="HEAD"
else
TEST_COMMIT="$1"
fi
IS_SIGNED "$TEST_COMMIT"
RES=$?
if [ "$RES" = 1 ]; then
if ! "$HAVE_FAILED"; then
echo "$TEST_COMMIT was not signed with a trusted key!"
fi
else
echo "There is a valid path from $TEST_COMMIT to $VERIFIED_ROOT where all commits are signed!"
fi
exit $RES

@ -0,0 +1,27 @@
Gitian includes two caches where build-assets may be saved for use with
subsequent builds. These caches are only enabled if the "enable_cache" key
is enabled in the build descriptor.
Common cache:
All descriptors share this cache. It can be useful for storing fetched sources,
sharing build assets between descriptors, etc.
Per-descriptor cache
Files installed to this cache can only be seen by this descriptor. Use this to
store assets created as part of the build process, to avoid having to rebuild
them in future builds.
If caching is enabled, GBUILD_CACHE_ENABLED will be set to 1 in the build
script. In addition, GBUILD_PACKAGE_CACHE and GBUILD_COMMON_CACHE will be set
to their respective paths. GBUILD_PACKAGE_CACHE contains the descriptor's
"name" key as a means of separating caches. To add or update the cached files,
copy them to these paths.
Before each build, all files and folders in the cache directories will be
transferred to the VM. After each successful build, the caches will be
transferred back to the builder (overwriting existing files as necessary).
It is entirely up to the user and the descriptors to verify that cached files
are actually suitable for re-use. Overwriting existing cached files is _highly_
discouraged, as that would likely lead to non-deterministic results. Unique
filenames should always be used.

@ -1,39 +0,0 @@
# The Problem
gcc sometimes generates slightly different code with the same semantics.
## Optimizations
The following optimizer flags reduce non-determinism when compiling wxWidgets:
-fno-tree-loop-optimize
-fno-trapping-math
-fno-tree-reassoc
## Left Over
Even with the above flags, the compiler still generates this difference in one out of 100 builds of wxWidgets:
monolib_property.o: elf64-elf_x86_64
aef7: 00
aef8: 45 31 f6 xor %r14d,%r14d
aefb: 48 8d 84 24 50 06 00 00 lea 0x650(%rsp),%rax
- af03: c6 44 24 67 00 movb $0x0,0x67(%rsp)
- af08: 48 83 c2 10 add $0x10,%rdx
- af0c: 48 83 c1 10 add $0x10,%rcx
- af10: 48 81 7c 24 08 ff ff ff cmpq $0xffffff,0x8(%rsp)
- af18: 00
- af19: c6 44 24 47 00 movb $0x0,0x47(%rsp)
- af1e: c7 44 24 24 00 00 00 00 movl $0x0,0x24(%rsp)
+ af03: c7 44 24 24 00 00 00 00 movl $0x0,0x24(%rsp)
+ af0b: 48 83 c2 10 add $0x10,%rdx
+ af0f: 48 83 c1 10 add $0x10,%rcx
+ af13: 48 81 7c 24 08 ff ff ff cmpq $0xffffff,0x8(%rsp)
+ af1b: 00
+ af1c: c6 44 24 47 00 movb $0x0,0x47(%rsp)
+ af21: c6 44 24 67 00 movb $0x0,0x67(%rsp)
af26: 4c 8d bc 24 28 03 00 00 lea 0x328(%rsp),%r15
af2e: 48 89 44 24 10 mov %rax,0x10(%rsp)
af33: 48 89 54 24 78 mov %rdx,0x78(%rsp)

@ -26,7 +26,12 @@ lxc.mount.entry=sysfs ROOTFS/sys sysfs defaults 0 0
# Container with network virtualized using a pre-configured bridge named br0 and
# veth pair virtual network devices
# On the host, run: ifconfig br0 up 10.0.2.2
# Alternatively, you can use another IP range for the bridge interface, in this case set
# the environment variables GITIAN_HOST_IP and LXC_GUEST_IP appropriately.
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.ipv4 = 10.0.2.5/24
lxc.network.link = GUESTLINK
lxc.network.ipv4 = GUESTIP/24
lxc.network.ipv4.gateway = auto
lxc.utsname = gitian

@ -0,0 +1,15 @@
#!/bin/bash
wd=`pwd`
# Default host IP is 10.0.2.2
if [ -z "$GITIAN_HOST_IP" ]; then
GITIAN_HOST_IP=10.0.2.2
fi
# Default to host IP if the MIRROR_HOST is not set, or set to 127.0.0.1
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

@ -1,4 +1,13 @@
#!/bin/bash
wd=`pwd`
sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH;;s;ARCH;$LXC_ARCH;g" < etc/lxc.config.in > var/lxc.config
if [ -z "$LXC_GUEST_IP" ]; then
LXC_GUEST_IP=10.0.2.5
fi
if [ -z "$LXC_BRIDGE" ]; then
LXC_BRIDGE=br0
fi
sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH;;s;ARCH;$LXC_ARCH;g;;s;GUESTIP;$LXC_GUEST_IP;g;s;GUESTLINK;$LXC_BRIDGE;g" < etc/lxc.config.in > var/lxc.config

@ -2,8 +2,8 @@
. gconfig
TUSER=ubuntu
QUIET_FLAG=
TUSER=${DISTRO:-ubuntu}
QUIET_FLAG="-vP"
usage() {
echo "Usage: ${0##*/} [OPTION]... <command>"
@ -47,8 +47,9 @@ if [ $# = 0 ] ; then
fi
if [ -z "$USE_LXC" ]; then
scp $QUIET_FLAG -oConnectTimeout=5 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -P $VM_SSH_PORT -r $TUSER@localhost:$1 $2
src="${1%/}" # remove trailing / which triggers special rsync behaviour
rsync --checksum -a $QUIET_FLAG -e "ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT" "$TUSER@localhost:${src}" "$2"
else
config-lxc
sudo lxc-start -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -cf - "$1" | tar -C "$2" -xkf -
sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C `dirname "$1"` -cf - `basename "$1"` | tar -C "$2" -xf -
fi

@ -2,8 +2,8 @@
. gconfig
TUSER=ubuntu
QUIET_FLAG=
TUSER=${DISTRO:-ubuntu}
QUIET_FLAG="-vP"
usage() {
echo "Usage: ${0##*/} [OPTION]... <command>"
@ -47,8 +47,9 @@ if [ $# = 0 ] ; then
fi
if [ -z "$USE_LXC" ]; then
scp $QUIET_FLAG -r -oConnectTimeout=5 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -P $VM_SSH_PORT $1 $TUSER@localhost:$2
src="${1%/}" # remove trailing / which triggers special rsync behaviour
rsync --checksum -a $QUIET_FLAG -e "ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT" "${src}" "$TUSER@localhost:$2"
else
config-lxc
tar -C `dirname "$1"` -cf - `basename "$1"` | sudo lxc-start -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C "$2" -xf -
tar -C `dirname "$1"` -cf - `basename "$1"` | sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C "$2" -xf -
fi

@ -1 +1,11 @@
VM_SSH_PORT=2223
if [ -n "$USE_LXC" ]; then
if [ -z "$LXC_EXECUTE" ]; then
ver=`lxc-start --version`
if dpkg --compare-versions $ver ge 1.0.0 ; then
LXC_EXECUTE=lxc-execute
else
LXC_EXECUTE=lxc-start
fi
fi
fi

@ -1,16 +1,23 @@
#!/bin/sh
set -e
SUITE=lucid
SUITE=xenial
ARCH=amd64
VMSW=KVM
if [ -n "$USE_LXC" ]; then
VMSW=LXC
elif [ -n "$USE_VBOX" ]; then
VMSW=VBOX
fi
usage() {
echo "Usage: ${0##*/} [OPTION]..."
echo "Make a clean copy of the base client."
echo
cat << EOF
--help display this help and exit
--suite U build suite U instead of lucid
--suite U build suite U instead of xenial
--arch A build architecture A (e.g. i386) instead of amd64
EOF
}
@ -41,12 +48,22 @@ if [ $# != 0 ] ; then
done
fi
export LXC_SUITE=$SUITE
export LXC_ARCH=$ARCH
BASE=base-$SUITE-$ARCH
OUT=target-$SUITE-$ARCH
if [ -z "$USE_LXC" ]; then
case $VMSW in
KVM)
qemu-img create -f qcow2 -o backing_file="$BASE.qcow2" "$OUT.qcow2"
else
cp -a $BASE $OUT
;;
LXC)
cp -a --sparse=always $BASE $OUT
libexec/config-bootstrap-fixup
on-target -u root bash < target-bin/bootstrap-fixup
fi
;;
VBOX)
VBoxManage snapshot "Gitian-${SUITE}-${ARCH}" restore "Gitian-Clean"
;;
esac

@ -2,15 +2,16 @@
. gconfig
TUSER=ubuntu
TUSER=${DISTRO:-ubuntu}
usage() {
echo "Usage: ${0##*/} [OPTION]... <command>"
echo "Run command on build target."
echo
cat << EOF
--help display this help and exit
--user=U run as U instead of ubuntu
--help display this help and exit
--user|-u <username> run as <username> instead of ubuntu
--env|-e "NAME=VALUE ..." modify the environment
EOF
}
@ -25,6 +26,10 @@ if [ $# != 0 ] ; then
TUSER="$2"
shift 2
;;
--env|-e)
ENV="$2"
shift 2
;;
--*)
echo "unrecognized option $1"
exit 1
@ -42,12 +47,8 @@ fi
#fi
if [ -z "$USE_LXC" ]; then
ssh -oConnectTimeout=5 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_dsa -p $VM_SSH_PORT $TUSER@localhost $*
ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT $TUSER@localhost $*
else
config-lxc
if [ $TUSER = "root" ]; then
sudo lxc-start -n gitian -f var/lxc.config -- $*
else
sudo lxc-start -n gitian -f var/lxc.config -- sudo -i -u $TUSER $*
fi
sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -u $TUSER $ENV -i -- $*
fi

@ -5,11 +5,33 @@
ARCH=qemu$1
SUFFIX=$2
if [ -z "$USE_LXC" ]; then
kvm -cpu $ARCH -m ${VMEM:-2000} -smp ${NPROCS:-2} -drive file=target-$SUFFIX.qcow2,cache=writeback -net nic,model=virtio -net user,hostfwd=tcp:127.0.0.1:$VM_SSH_PORT-:22 -vnc 127.0.0.1:16 > var/target.log 2>&1 &
VMSW=KVM
if [ -n "$USE_LXC" ]; then
VMSW=LXC
elif [ -n "$USE_VBOX" ]; then
VMSW=VBOX
fi
case $VMSW in
KVM)
case $ARCH in
qemu32)
[ -n "$KVM" ] || KVM=qemu-system-i386
;;
qemu64)
[ -n "$KVM" ] || KVM=qemu-system-x86_64
;;
esac
$KVM -enable-kvm -m ${VMEM:-2000} -smp ${NPROCS:-2} -drive file=target-$SUFFIX.qcow2,cache=writeback,if=virtio -net nic,model=virtio -net user,hostfwd=tcp:127.0.0.1:$VM_SSH_PORT-:22 -vnc 127.0.0.1:16 > var/target.log 2>&1 &
echo $! > var/target.pid
wait
rm var/target.pid
else
;;
LXC)
true #sudo lxc-start -n gitian -c var/target.log -f lxc.config
fi
;;
VBOX)
VBoxManage startvm "Gitian-${2}" # --type headless
echo "Gitian-${2}" > var/target.vmname
;;
esac

@ -1,6 +1,14 @@
#!/bin/sh
if [ -z "$USE_LXC" ]; then
VMSW=KVM
if [ -n "$USE_LXC" ]; then
VMSW=LXC
elif [ -n "$USE_VBOX" ]; then
VMSW=VBOX
fi
case $VMSW in
KVM)
if [ ! -e var/target.pid ]; then exit; fi
on-target -u root halt
@ -13,6 +21,13 @@ if [ -z "$USE_LXC" ]; then
echo Killing target since it did not shutdown within 10 seconds
kill `cat var/target.pid`
else
;;
LXC)
true
fi
;;
VBOX)
if [ ! -e var/target.vmname ]; then exit; fi
VBoxManage controlvm `cat var/target.vmname` savestate
rm var/target.vmname
;;
esac

@ -208,6 +208,7 @@ def get_assertions(gpg_path, temp_dir, unpack_dir, file_names):
elif sums[summed_file] != shasum:
print>>sys.stderr, "sha256sum mismatch on %s" %(summed_file)
error = True
else:
del to_check[summed_file]
if len(to_check) > 0 and quiet == 0:
print>>sys.stderr, "Some of the files were not checksummed:"

@ -1,6 +0,0 @@
#!/bin/sh
set -e
echo 'deb http://10.0.2.2:3142/archive.ubuntu.com/ubuntu lucid main universe' > $1/etc/apt/sources.list
echo 'deb http://10.0.2.2:3142/archive.ubuntu.com/ubuntu lucid-updates main universe' >> $1/etc/apt/sources.list

@ -0,0 +1,40 @@
#!/bin/sh
set -e
DISTRIB_NAME=`lsb_release -is`
DISTRIB_CODENAME=`lsb_release -cs`
if [ $DISTRIB_NAME = "Ubuntu" ]; then
echo "deb http://HOSTIP:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME main universe" > $1/etc/apt/sources.list
echo "deb http://HOSTIP:3142/security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security main universe" >> $1/etc/apt/sources.list
echo "deb http://HOSTIP:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME-updates main universe" >> $1/etc/apt/sources.list
elif [ $DISTRIB_NAME = "Debian" ]; then
echo "deb http://HOSTIP:3142/ftp.debian.org/debian $DISTRIB_CODENAME main" > $1/etc/apt/sources.list
echo "deb http://HOSTIP:3142/security.debian.org/ $DISTRIB_CODENAME/updates main" >> $1/etc/apt/sources.list
echo "deb http://HOSTIP:3142/ftp.debian.org/debian $DISTRIB_CODENAME-updates main" >> $1/etc/apt/sources.list
# grub-legacy conflicts grub-pc dependencies
# No grub-legacy on Ubuntu, just on Debian
# Work around bcron-run conflict due to cron being removed
# Needed for KVM, but apparently errors out for LXC, so the true ignores the error
apt-get purge -y grub-legacy bcron-run &> /dev/null || true
fi
echo '127.0.1.1 gitian' >> /etc/hosts
# If LXC
if grep /lxc/gitian /proc/1/cgroup > /dev/null; then
adduser --disabled-password --gecos ${DISTRIB_NAME,,} --quiet ${DISTRIB_NAME,,} || true
apt-get remove -y rsyslog || true
dpkg-divert --local --rename --add /sbin/initctl
ln -sf /bin/true /sbin/initctl
dpkg-divert --local --rename --add /usr/bin/ischroot
ln -sf /bin/true /usr/bin/ischroot
# Prevent interaction with init during upgrades
dpkg-divert --local --rename --add /usr/sbin/policy-rc.d
echo 'exit 101' > /usr/sbin/policy-rc.d
chmod +x /usr/sbin/policy-rc.d
## These are superceded by the policy-rc.d fix above
# for pkg in lxc cgmanager udev plymouth dmsetup upstart; do
# echo $pkg hold | dpkg --set-selections || true
# done
fi

@ -6,7 +6,8 @@ set -e
cd /var/cache/apt/archives
#apt-get clean
dpkg-query -W -f '${Package}\n' | xargs -n 50 apt-get install --reinstall -y -d > /dev/null
# make sure all packages with installed versions are downloaded
# (except for held packages, which may not be available for download)
dpkg-query -W -f '${Status}\t${Package}=${Version}\n' | grep -v ^hold | cut -f2- | xargs -n 50 apt-get install -q --reinstall -y -d > /tmp/download.log
grep "cannot be downloaded" /tmp/download.log && { echo Could not download some packages, please run gbuild --upgrade 1>&2 ; exit 1 ; }
sha256sum *.deb | sort --key 2

@ -1,6 +1,7 @@
#!/bin/sh
rm -rf install out build
rm -rf install out build cache
mkdir build
mkdir out
mkdir install
mkdir -p cache/common

@ -0,0 +1,15 @@
#!/bin/sh
# Upgrade system
set -e
mkdir -p /var/cache/gitian
# remove obsolete grub, it causes package dependency issues
apt-get -q -y purge grub > /dev/null 2>&1 || true
# upgrade packages
DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade > /dev/null > /var/cache/gitian/upgrade.log 2>&1
touch /var/cache/gitian/initial-upgrade
Loading…
Cancel
Save