commit d1159b3ee060be1aef550bbdb0af23b8c4284795 Author: Hugo Landau Date: Fri Jan 11 20:34:05 2019 +0000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3612e77 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +out/ +tmp/ +*.swp diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2c1c6e6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "rbm"] + path = rbm + url = https://git.torproject.org/builders/rbm.git diff --git a/ENTER b/ENTER new file mode 100755 index 0000000..2b9e0a1 --- /dev/null +++ b/ENTER @@ -0,0 +1,2 @@ +#!/bin/sh +exec nix-shell -p perl perlPackages.PathTiny perlPackages.YAMLLibYAML perlPackages.TemplateToolkit perlPackages.IOCaptureOutput perlPackages.FileCopyRecursive perlPackages.StringShellQuote perlPackages.SortVersions perlPackages.DataUUID perlPackages.DataDump perlPackages.DigestSHA perlPackages.FileTemp perlPackages.JSON debootstrap runc diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dbf6bf5 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +RBM=./rbm/rbm + +all: release + +release: + $(RBM) build ncdns --target ncdns-linux-x86_64 + +submodule-update: + git submodule update --init + +fetch: submodule-update + $(RBM) fetch diff --git a/README.md b/README.md new file mode 100644 index 0000000..f2ba272 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# ncdns-repro + +ncdns reproducible build harnesses for RBM. + +MIT License. diff --git a/hashlist b/hashlist new file mode 100644 index 0000000..aad316f --- /dev/null +++ b/hashlist @@ -0,0 +1,25 @@ +git github.com/alecthomas/template b867cc6ab45cece8143cfcc6fc9c77cf3f2c23c0 heads/master +git github.com/alecthomas/units 2efee857e7cfd4f3d0138cc3cbb1b4966962b93a heads/master +git github.com/BurntSushi/toml 056c9bc7be7190eaa7715723883caffa5f8fa3e4 heads/master +git github.com/coreos/go-systemd a831f36d09de8f095c28eeee839df52e9de5031f heads/master +git github.com/golang/groupcache 604ed5785183e59ae2789449d89e73f3a2a77987 heads/master +git github.com/hlandau/buildinfo 337a29b5499734e584d4630ce535af64c5fe7813 heads/master +git github.com/hlandau/degoutils 8fa2440b63444dad556d76366f1c3ee070c8a577 heads/master+ +git github.com/hlandau/dexlogconfig 244f29bd260884993b176cd14ef2f7631f6f3c18 heads/master +git github.com/hlandauf/btcjson e204653fd7386803f14e4ec744ab63dde15002dc heads/master +git github.com/hlandau/ncbtcjsontypes 02ea7272dd11bb6153a3cd06899a0999ac6a16e0 heads/master +git github.com/hlandau/xlog 197ef798aed28e08ed3e176e678fda81be993a31 tags/v1.0.0 +git github.com/kr/pretty e6ac2fc51e89a3249e82157fa0bb7a18ef9dd5bb heads/master +git github.com/kr/text bb797dc4fb8320488f47bf11de07a733d7233e1f heads/master +git github.com/mattn/go-isatty 7fcbc72f853b92b5720db4a6b8482be612daef24 heads/master +git github.com/miekg/dns c144371d31e35dc0588755ada496462c102c90a6 heads/master +git github.com/namecoin/ncdns 19534f1dcfd1151bd9c072459caac12f6fb384df tags/v0.0.6 +git github.com/ogier/pflag 6f7159c3154e7cd4ab30f6cc9c58fa3fd0f22325 heads/master +git github.com/shiena/ansicolor a5e2b567a4dd6cc74545b8a4f27c9d63b9e7735b heads/master +git golang.org/x/net e0c57d8f86c17f0724497efcb3bc617e82834821 heads/master +git gopkg.in/alecthomas/kingpin.v2 7f0871f2e17818990e4eed73f9b5c2f429501228 tags/v2.2.4 +git gopkg.in/hlandau/configurable.v1 34642c4c8cbf56801d0e34f0e82187305983ac26 heads/master +git gopkg.in/hlandau/easyconfig.v1 c31249162931b4963bbe6e501cccb60d23271a3f tags/v1.0.17 +git gopkg.in/hlandau/madns.v1 b82ebc776bd8a13824350c7c108180d601e38352 tags/v1.0.7+ +git gopkg.in/hlandau/service.v2 b64b3467ebd16f64faec1640c25e318efc0c0d7b tags/v2.0.16 +git gopkg.in/hlandau/svcutils.v1 c25dac49e50cbbcbef8c81b089f56156f4067729 tags/v1.0.10 diff --git a/listrepo b/listrepo new file mode 100755 index 0000000..66456ad --- /dev/null +++ b/listrepo @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +go list -f '{{range $imp := .Deps}}{{printf "%s\n" $imp}}{{end}}' 'github.com/namecoin/ncdns'|sort -u|xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | awk "{print \"$GOPATH/src/\" \$0}" | (while read line; do x="$line"; while [ ! -e "$x/.git" -a ! -e "$x/.hg" ]; do x=${x%/*}; if [ "$x" = "" ]; then break; fi; done; echo "$x"; done) | sort -u | (while read line; do echo ${line#$GOPATH/src/}; done) diff --git a/projects/common/runc-config.json b/projects/common/runc-config.json new file mode 100644 index 0000000..a3b5a08 --- /dev/null +++ b/projects/common/runc-config.json @@ -0,0 +1,268 @@ +{ + "ociVersion": "1.0.0[% IF !c("var_p/runc_spec100") %]-rc1[% END %]", + "platform": { + "os": "linux", + "arch": "amd64" + }, + "process": { + "terminal": [% IF c("interactive") %]true[% ELSE %]false[% END %], + "user": { + "uid": 0, + "gid": 0 + }, + "args": [ + "/rbm/run" + ], + "env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + "TERM=xterm" + ], + "cwd": "/", +[% IF c("var_p/runc_spec100") -%] + "capabilities": { + "bounding": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_SETGID", + "CAP_SETUID", + "CAP_MKNOD", + "CAP_SYS_CHROOT", +[% IF c("var/container/CAP_SYS_ADMIN") -%] + "CAP_SYS_ADMIN", +[% END -%] + "CAP_FSETID", + "CAP_FOWNER", + "CAP_DAC_OVERRIDE", + "CAP_CHOWN" + ], + "effective": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_SETGID", + "CAP_SETUID", + "CAP_MKNOD", + "CAP_SYS_CHROOT", +[% IF c("var/container/CAP_SYS_ADMIN") -%] + "CAP_SYS_ADMIN", +[% END -%] + "CAP_FSETID", + "CAP_FOWNER", + "CAP_DAC_OVERRIDE", + "CAP_CHOWN" + ], + "inheritable": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_SETGID", + "CAP_SETUID", + "CAP_MKNOD", + "CAP_SYS_CHROOT", +[% IF c("var/container/CAP_SYS_ADMIN") -%] + "CAP_SYS_ADMIN", +[% END -%] + "CAP_FSETID", + "CAP_FOWNER", + "CAP_DAC_OVERRIDE", + "CAP_CHOWN" + ], + "permitted": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_SETGID", + "CAP_SETUID", + "CAP_MKNOD", + "CAP_SYS_CHROOT", +[% IF c("var/container/CAP_SYS_ADMIN") -%] + "CAP_SYS_ADMIN", +[% END -%] + "CAP_FSETID", + "CAP_FOWNER", + "CAP_DAC_OVERRIDE", + "CAP_CHOWN" + ], + "ambient": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_SETGID", + "CAP_SETUID", + "CAP_MKNOD", + "CAP_SYS_CHROOT", +[% IF c("var/container/CAP_SYS_ADMIN") -%] + "CAP_SYS_ADMIN", +[% END -%] + "CAP_FSETID", + "CAP_FOWNER", + "CAP_DAC_OVERRIDE", + "CAP_CHOWN" + ] + }, +[% ELSE -%] + "capabilities": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_SETGID", + "CAP_SETUID", + "CAP_MKNOD", + "CAP_SYS_CHROOT", +[% IF c("var/container/CAP_SYS_ADMIN") -%] + "CAP_SYS_ADMIN", +[% END -%] + "CAP_FSETID", + "CAP_FOWNER", + "CAP_DAC_OVERRIDE", + "CAP_CHOWN" + ], +[% END -%] + "rlimits": [ + { + "type": "RLIMIT_NOFILE", + "hard": 1024, + "soft": 1024 + } + ], + "noNewPrivileges": true + }, + "root": { + "path": "rootfs", + "readonly": false + }, + "hostname": "runc", + "mounts": [ + { + "destination": "/proc", + "type": "proc", + "source": "proc" + }, + { + "type": "bind", + "source": "/etc/resolv.conf", + "destination": "/etc/resolv.conf", + "options": [ + "rbind", + "ro" + ] + }, + { + "destination": "/dev", + "type": "tmpfs", + "source": "tmpfs", + "options": [ + "nosuid", + "strictatime", + "mode=755", + "size=65536k" + ] + }, + { + "destination": "/dev/pts", + "type": "devpts", + "source": "devpts", + "options": [ + "nosuid", + "noexec", + "newinstance", + "ptmxmode=0666", + "mode=0620", + "gid=5" + ] + }, + { + "destination": "/dev/shm", + "type": "tmpfs", + "source": "shm", + "options": [ + "nosuid", + "noexec", + "nodev", + "mode=1777", + "size=65536k" + ] + }, + { + "destination": "/dev/mqueue", + "type": "mqueue", + "source": "mqueue", + "options": [ + "nosuid", + "noexec", + "nodev" + ] + }, + { + "destination": "/sys", + "type": "sysfs", + "source": "sysfs", + "options": [ + "nosuid", + "noexec", + "nodev", + "ro" + ] + }, + { + "destination": "/sys/fs/cgroup", + "type": "cgroup", + "source": "cgroup", + "options": [ + "nosuid", + "noexec", + "nodev", + "relatime", + "ro" + ] + } + ], + "hooks": {}, + "linux": { + "resources": { + "devices": [ + { + "allow": false, + "access": "rwm" + } + ] + }, + "namespaces": [ + { + "type": "pid" + }, + { + "type": "ipc" + }, + { + "type": "uts" + }, + { + "type": "mount" + } + ], + "maskedPaths": [ + "/proc/kcore", + "/proc/latency_stats", + "/proc/timer_stats", +[% IF c("var_p/runc_spec100") -%] + "/proc/timer_list", + "/sys/firmware", +[% END -%] + "/proc/sched_debug" + ], + "readonlyPaths": [ + "/proc/asound", + "/proc/bus", + "/proc/fs", + "/proc/irq", + "/proc/sys", + "/proc/sysrq-trigger" + ] + }, + "solaris": { + "cappedCPU": {}, + "cappedMemory": {} + } +} diff --git a/projects/container-image/build b/projects/container-image/build new file mode 100755 index 0000000..d37118b --- /dev/null +++ b/projects/container-image/build @@ -0,0 +1,2 @@ +#!/bin/sh +set -e diff --git a/projects/container-image/config b/projects/container-image/config new file mode 100644 index 0000000..1f85ade --- /dev/null +++ b/projects/container-image/config @@ -0,0 +1,62 @@ +filename: 'container-image_[% c("var/container/suite") %]-[% c("var/container/arch") %]-[% sha256(c("pre")).substr(0,12) %].tar.gz' +pkg_type: build + +var: + container: + use_container: 1 + suite: '[% pc(c("origin_project"), "var/container/suite") %]' + arch: '[% pc(c("origin_project"), "var/container/arch") %]' + +lsb_release: + id: Debian + codename: wheezy + release: 7.11 + +pre: | + #!/bin/sh + # [% c('var/container/suite') %] + set -e + [% IF pc(c('origin_project'), 'var/pre_pkginst') -%] + [% pc(c('origin_project'), 'var/pre_pkginst') %] + [% END -%] + apt-get update -y + apt-get upgrade -y + [% + deps = []; + IF pc(c('origin_project'), 'var/deps'); + CALL deps.import(pc(c('origin_project'), 'var/deps')); + END; + IF pc(c('origin_project'), 'var/arch_deps'); + CALL deps.import(pc(c('origin_project'), 'var/arch_deps')); + END; + IF deps.size; + IF pc(c('origin_project'), 'var/sort_deps'); + deps = deps.sort; + END; + FOREACH pkg IN deps; + SET p = tmpl(pkg); + IF p; + GET c('install_package', { pkg_name => p }); + GET "\n"; + END; + END; + END; + -%] + [% IF pc(c('origin_project'), 'var/post_pkginst') -%] + [% pc(c('origin_project'), 'var/post_pkginst') %] + [% END -%] + +remote_get: | + #!/bin/sh + set -e + [% + SET src = shell_quote(c('get_src', { error_if_undef => 1 })); + SET dst = shell_quote(c('get_dst', { error_if_undef => 1 })); + -%] + mkdir -p "[% dst %]" + sudo tar -C "[% c("var/container/dir") %]/rootfs" -czf "[% dst %]/[% c("filename") %]" . + +input_files: + - project: debootstrap-image + target: + - '[% c("var/container/suite") %]-[% c("var/container/arch") %]' diff --git a/projects/debootstrap-image/build b/projects/debootstrap-image/build new file mode 100755 index 0000000..d37118b --- /dev/null +++ b/projects/debootstrap-image/build @@ -0,0 +1,2 @@ +#!/bin/sh +set -e diff --git a/projects/debootstrap-image/config b/projects/debootstrap-image/config new file mode 100644 index 0000000..9481a0e --- /dev/null +++ b/projects/debootstrap-image/config @@ -0,0 +1,55 @@ +filename: 'container-image_[% c("var/container/suite") %]-[% c("var/container/arch") %].tar.gz' +pkg_type: build + +var: + ubuntu_version: 18.04.1 + + container: + use_container: 1 + # We need CAP_SYS_ADMIN for debootstrap to work + CAP_SYS_ADMIN: 1 + +pre: | + #!/bin/sh + set -e + apt-get update -y + apt-get install -y debian-archive-keyring ubuntu-keyring debootstrap + container=systemd-nspawn debootstrap --arch=[% c("var/container/arch") %] [% c("var/container/debootstrap_opt") %] [% c("var/container/suite") %] base-image [% c("var/container/debootstrap_mirror") %] + tar -C ./base-image -czf [% dest_dir %]/[% c("filename") %] . + +targets: + wheezy-amd64: + var: + container: + suite: wheezy + arch: amd64 + wheezy-i386: + var: + container: + suite: wheezy + arch: i386 + jessie-amd64: + var: + container: + suite: jessie + arch: amd64 + jessie-i386: + var: + container: + suite: jessie + arch: i386 + buster-amd64: + var: + container: + suite: buster + arch: amd64 + stretch-amd64: + var: + container: + suite: stretch + arch: amd64 + +input_files: + - URL: 'http://cdimage.ubuntu.com/ubuntu-base/releases/[% c("var/ubuntu_version") %]/release/ubuntu-base-[% c("var/ubuntu_version") %]-base-amd64.tar.gz' + filename: 'container-image_ubuntu-base-[% c("var/ubuntu_version") %]-base-amd64.tar.gz' + sha256sum: ed76e649f65548a80b361b68011085ec4dde7bb762d667657acbef87765e1a12 diff --git a/projects/github.com,BurntSushi,toml/config b/projects/github.com,BurntSushi,toml/config new file mode 100644 index 0000000..caad070 --- /dev/null +++ b/projects/github.com,BurntSushi,toml/config @@ -0,0 +1,17 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/BurntSushi/toml.git +git_hash: '[% config.var_p.id.${"github.com/BurntSushi/toml"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/BurntSushi/toml + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,alecthomas,template/config b/projects/github.com,alecthomas,template/config new file mode 100644 index 0000000..8de3c89 --- /dev/null +++ b/projects/github.com,alecthomas,template/config @@ -0,0 +1,17 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/alecthomas/template.git +git_hash: '[% config.var_p.id.${"github.com/alecthomas/template"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/alecthomas/template + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,alecthomas,units/config b/projects/github.com,alecthomas,units/config new file mode 100644 index 0000000..c850ec9 --- /dev/null +++ b/projects/github.com,alecthomas,units/config @@ -0,0 +1,17 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/alecthomas/units.git +git_hash: '[% config.var_p.id.${"github.com/alecthomas/units"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/alecthomas/units + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,coreos,go-systemd/config b/projects/github.com,coreos,go-systemd/config new file mode 100644 index 0000000..2bf71f6 --- /dev/null +++ b/projects/github.com,coreos,go-systemd/config @@ -0,0 +1,19 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/coreos/go-systemd.git +git_hash: '[% config.var_p.id.${"github.com/coreos/go-systemd"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/coreos/go-systemd + go_lib_install: + - github.com/coreos/go-systemd/journal + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,golang,groupcache/config b/projects/github.com,golang,groupcache/config new file mode 100644 index 0000000..e7e90f9 --- /dev/null +++ b/projects/github.com,golang,groupcache/config @@ -0,0 +1,19 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/golang/groupcache.git +git_hash: '[% config.var_p.id.${"github.com/golang/groupcache"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/golang/groupcache + go_lib_install: + - github.com/golang/groupcache/lru + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,hlandau,buildinfo/config b/projects/github.com,hlandau,buildinfo/config new file mode 100644 index 0000000..003375b --- /dev/null +++ b/projects/github.com,hlandau,buildinfo/config @@ -0,0 +1,20 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/buildinfo.git +git_hash: '[% config.var_p.id.${"github.com/hlandau/buildinfo"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/hlandau/buildinfo + go_lib_deps: + - gopkg.in,hlandau,easyconfig.v1 + +input_files: + - project: container-image + - name: go + project: go + - name: gopkg.in,hlandau,easyconfig.v1 + project: gopkg.in,hlandau,easyconfig.v1 diff --git a/projects/github.com,hlandau,degoutils/config b/projects/github.com,hlandau,degoutils/config new file mode 100644 index 0000000..2e84354 --- /dev/null +++ b/projects/github.com,hlandau,degoutils/config @@ -0,0 +1,22 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/degoutils.git +git_hash: '[% config.var_p.id.${"github.com/hlandau/degoutils"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/hlandau/degoutils + go_lib_install: + - github.com/hlandau/degoutils/net + go_lib_deps: + - golang.org,x,net + +input_files: + - project: container-image + - name: go + project: go + - name: golang.org,x,net + project: golang.org,x,net diff --git a/projects/github.com,hlandau,dexlogconfig/config b/projects/github.com,hlandau,dexlogconfig/config new file mode 100644 index 0000000..31f5442 --- /dev/null +++ b/projects/github.com,hlandau,dexlogconfig/config @@ -0,0 +1,29 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/dexlogconfig.git +git_hash: '[% config.var_p.id.${"github.com/hlandau/dexlogconfig"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/hlandau/dexlogconfig + go_lib_deps: + - github.com,hlandau,xlog + - gopkg.in,hlandau,easyconfig.v1 + - github.com,coreos,go-systemd + - github.com,hlandau,buildinfo + +input_files: + - project: container-image + - name: go + project: go + - name: github.com,hlandau,xlog + project: github.com,hlandau,xlog + - name: gopkg.in,hlandau,easyconfig.v1 + project: gopkg.in,hlandau,easyconfig.v1 + - name: github.com,coreos,go-systemd + project: github.com,coreos,go-systemd + - name: github.com,hlandau,buildinfo + project: github.com,hlandau,buildinfo diff --git a/projects/github.com,hlandau,ncbtcjsontypes/config b/projects/github.com,hlandau,ncbtcjsontypes/config new file mode 100644 index 0000000..1ac8366 --- /dev/null +++ b/projects/github.com,hlandau,ncbtcjsontypes/config @@ -0,0 +1,20 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/ncbtcjsontypes.git +git_hash: '[% config.var_p.id.${"github.com/hlandau/ncbtcjsontypes"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/hlandau/ncbtcjsontypes + go_lib_deps: + - github.com,hlandauf,btcjson + +input_files: + - project: container-image + - name: go + project: go + - name: github.com,hlandauf,btcjson + project: github.com,hlandauf,btcjson diff --git a/projects/github.com,hlandau,xlog/config b/projects/github.com,hlandau,xlog/config new file mode 100644 index 0000000..d33f570 --- /dev/null +++ b/projects/github.com,hlandau,xlog/config @@ -0,0 +1,23 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/xlog.git +git_hash: '[% config.var_p.id.${"github.com/hlandau/xlog"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/hlandau/xlog + go_lib_deps: + - github.com,mattn,go-isatty + - github.com,shiena,ansicolor + +input_files: + - project: container-image + - name: go + project: go + - name: github.com,mattn,go-isatty + project: github.com,mattn,go-isatty + - name: github.com,shiena,ansicolor + project: github.com,shiena,ansicolor diff --git a/projects/github.com,hlandauf,btcjson/config b/projects/github.com,hlandauf,btcjson/config new file mode 100644 index 0000000..398e070 --- /dev/null +++ b/projects/github.com,hlandauf,btcjson/config @@ -0,0 +1,17 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandauf/btcjson.git +git_hash: '[% config.var_p.id.${"github.com/hlandauf/btcjson"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/hlandauf/btcjson + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,kr,pretty/config b/projects/github.com,kr,pretty/config new file mode 100644 index 0000000..957b657 --- /dev/null +++ b/projects/github.com,kr,pretty/config @@ -0,0 +1,20 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/kr/pretty.git +git_hash: '[% config.var_p.id.${"github.com/kr/pretty"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/kr/pretty + go_lib_deps: + - github.com,kr,text + +input_files: + - project: container-image + - name: go + project: go + - name: github.com,kr,text + project: github.com,kr,text diff --git a/projects/github.com,kr,text/config b/projects/github.com,kr,text/config new file mode 100644 index 0000000..b1a8145 --- /dev/null +++ b/projects/github.com,kr,text/config @@ -0,0 +1,17 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/kr/text.git +git_hash: '[% config.var_p.id.${"github.com/kr/text"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/kr/text + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,mattn,go-isatty/config b/projects/github.com,mattn,go-isatty/config new file mode 100644 index 0000000..d276e7c --- /dev/null +++ b/projects/github.com,mattn,go-isatty/config @@ -0,0 +1,16 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/mattn/go-isatty.git +git_hash: '[% config.var_p.id.${"github.com/mattn/go-isatty"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/mattn/go-isatty + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,miekg,dns/config b/projects/github.com,miekg,dns/config new file mode 100644 index 0000000..8de5d33 --- /dev/null +++ b/projects/github.com,miekg,dns/config @@ -0,0 +1,17 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/miekg/dns.git +git_hash: '[% config.var_p.id.${"github.com/miekg/dns"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/miekg/dns + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,ogier,pflag/config b/projects/github.com,ogier,pflag/config new file mode 100644 index 0000000..ad735b1 --- /dev/null +++ b/projects/github.com,ogier,pflag/config @@ -0,0 +1,17 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/ogier/pflag.git +git_hash: '[% config.var_p.id.${"github.com/ogier/pflag"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/ogier/pflag + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/github.com,shiena,ansicolor/config b/projects/github.com,shiena,ansicolor/config new file mode 100644 index 0000000..bfe67af --- /dev/null +++ b/projects/github.com,shiena,ansicolor/config @@ -0,0 +1,16 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/shiena/ansicolor.git +git_hash: '[% config.var_p.id.${"github.com/shiena/ansicolor"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: github.com/shiena/ansicolor + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/go/build b/projects/go/build new file mode 100755 index 0000000..5a114f4 --- /dev/null +++ b/projects/go/build @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +[% c("var/set_default_env") -%] +[% c("var/setarch") -%] +distdir=/var/tmp/dist/[% project %] +mkdir -p /var/tmp/dist + +[% IF c("var/linux") %] + # Config options for hardening-wrapper + export DEB_BUILD_HARDENING=1 + export DEB_BUILD_HARDENING_STACKPROTECTOR=1 + export DEB_BUILD_HARDENING_FORTIFY=1 + export DEB_BUILD_HARDENING_FORMAT=1 + export DEB_BUILD_HARDENING_PIE=1 +[% END %] + +mkdir -p /var/tmp/build + +# Building go 1.4.x +# This is needed to bootstrap the go that we actually use +# https://golang.org/doc/install/source#go14 +tar -C /var/tmp/build --transform='s,^go\>,go1.4,' -xf $rootdir/[% c('input_files_by_name/go14') %] +cd /var/tmp/build/go1.4/src +# Disable cgo to avoid conflicts with newer GCC. cgo is not needed for the bootstrap go. +# https://github.com/golang/go/issues/13114#issuecomment-186922245 +# Disable CC etc. that are set up for cross builds. +CGO_ENABLED=0 CC= CFLAGS= LDFLAGS= ./make.bash +export GOROOT_BOOTSTRAP="/var/tmp/build/go1.4" + +cd $rootdir +[% IF ! c("var/linux") %] + [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %] +[% END %] + +# Building go +# http://golang.org/doc/install/source#environment +tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/go') %] +export GOROOT="$distdir" +cd /var/tmp/dist/go/src +[% IF c("var/linux") %] + ./make.bash +[% ELSIF c("var/osx") %] + # TODO +[% ELSIF c("var/windows") %] + # TODO +[% END -%] + +cd /var/tmp/dist +[% c('tar', { + tar_src => [ project ], + tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'), + }) %] diff --git a/projects/go/config b/projects/go/config new file mode 100644 index 0000000..d5eed7e --- /dev/null +++ b/projects/go/config @@ -0,0 +1,90 @@ +version: 1.11.1 +filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz' + +var: + go14_version: 1.4.3 + container: + use_container: 1 + + setup: | + [% c("var/setarch") -%] + mkdir -p /var/tmp/dist + tar -C /var/tmp/dist -xf $rootdir/[% c("go_tarfile") %] + export GOOS=[% c("var/GOOS") %] + export GOARCH=[% c("var/GOARCH") %] + export GOPATH=/var/tmp/dist/gopath + export PATH=/var/tmp/dist/go/bin:/var/tmp/dist/gopath/bin:"$PATH" + + # Template build script for building a go library. + # This can be called as projects/go/var/build_go_lib. + # You need to define /var/go_lib, and optionally var/go_lib_install as a list + # of install targets. + build_go_lib: | + #!/bin/sh + [% c("var/set_default_env") -%] + [% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %] + distdir=/var/tmp/dist/[% project %] + mkdir -p /var/tmp/build + tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz + [% FOREACH dep = c("var/go_lib_deps") -%] + tar -C /var/tmp/dist -xf [% c('input_files_by_name/' _ dep) %] + [% END -%] + mkdir -p $(dirname "$GOPATH/src/[% c("var/go_lib") %]") + mv /var/tmp/build/[% project %]-[% c('version') %] "$GOPATH/src/[% c("var/go_lib") %]" + cd "$GOPATH/src/[% c("var/go_lib") %]" + for p in $(ls -1 $rootdir/*.patch 2> /dev/null | sort) + do + patch -p1 < $p + done + [% IF c("var/build_go_lib_pre"); GET c("var/build_go_lib_pre"); END; -%] + [% IF c("var/go_lib_install") -%] + [% FOREACH inst IN c("var/go_lib_install") %] + go install [% inst %] + [% END %] + [% ELSE %] + go install [% c("var/go_lib") %] + [% END %] + cd /var/tmp/dist + [% c('tar', { + tar_src => [ 'gopath' ], + tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'), + }) %] + +targets: + windows: + var: + GOOS: windows + windows-i686: + var: + GOARCH: 386 + windows-x86_64: + var: + GOARCH: amd64 + osx-x86_64: + var: + GOOS: darwin + GOARCH: amd64 + arch_deps: + - faketime + linux: + var: + GOOS: linux + linux-x86_64: + var: + GOARCH: amd64 + linux-i686: + var: + GOARCH: 386 + +input_files: + - project: container-image + - name: '[% c("var/compiler") %]' + project: '[% c("var/compiler") %]' + enable: '[% c("var/windows") || c("var/osx") %]' + - URL: 'https://golang.org/dl/go[% c("version") %].src.tar.gz' + name: go + sha256sum: 558f8c169ae215e25b81421596e8de7572bd3ba824b79add22fba6e284db1117 + - URL: 'https://golang.org/dl/go[% c("var/go14_version") %].src.tar.gz' + name: go14 + sha256sum: 9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959 + diff --git a/projects/golang.org,x,net/config b/projects/golang.org,x,net/config new file mode 100644 index 0000000..bd930d3 --- /dev/null +++ b/projects/golang.org,x,net/config @@ -0,0 +1,19 @@ +version: '[% c("abbrev") %]' +git_url: https://go.googlesource.com/net +git_hash: '[% config.var_p.id.${"golang.org/x/net"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: golang.org/x/net + go_lib_install: + - golang.org/x/net/context + go_lib_deps: [] + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/gopkg.in,alecthomas,kingpin.v2/config b/projects/gopkg.in,alecthomas,kingpin.v2/config new file mode 100644 index 0000000..83164d7 --- /dev/null +++ b/projects/gopkg.in,alecthomas,kingpin.v2/config @@ -0,0 +1,23 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/alecthomas/kingpin.git +git_hash: '[% config.var_p.id.${"gopkg.in/alecthomas/kingpin.v2"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: gopkg.in/alecthomas/kingpin.v2 + go_lib_deps: + - github.com,alecthomas,template + - github.com,alecthomas,units + +input_files: + - project: container-image + - name: go + project: go + - name: github.com,alecthomas,template + project: github.com,alecthomas,template + - name: github.com,alecthomas,units + project: github.com,alecthomas,units diff --git a/projects/gopkg.in,hlandau,configurable.v1/config b/projects/gopkg.in,hlandau,configurable.v1/config new file mode 100644 index 0000000..1cad373 --- /dev/null +++ b/projects/gopkg.in,hlandau,configurable.v1/config @@ -0,0 +1,16 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/configurable.git +git_hash: '[% config.var_p.id.${"gopkg.in/hlandau/configurable.v1"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: gopkg.in/hlandau/configurable.v1 + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/gopkg.in,hlandau,easyconfig.v1/config b/projects/gopkg.in,hlandau,easyconfig.v1/config new file mode 100644 index 0000000..0d6145c --- /dev/null +++ b/projects/gopkg.in,hlandau,easyconfig.v1/config @@ -0,0 +1,35 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/easyconfig.git +git_hash: '[% config.var_p.id.${"gopkg.in/hlandau/easyconfig.v1"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: gopkg.in/hlandau/easyconfig.v1 + go_lib_deps: + - gopkg.in,hlandau,configurable.v1 + - gopkg.in,hlandau,svcutils.v1 + - github.com,BurntSushi,toml + - github.com,ogier,pflag + - gopkg.in,alecthomas,kingpin.v2 + go_lib_install: + - gopkg.in/hlandau/easyconfig.v1 + - gopkg.in/hlandau/easyconfig.v1/cflag + +input_files: + - project: container-image + - name: go + project: go + - name: gopkg.in,hlandau,configurable.v1 + project: gopkg.in,hlandau,configurable.v1 + - name: gopkg.in,hlandau,svcutils.v1 + project: gopkg.in,hlandau,svcutils.v1 + - name: github.com,BurntSushi,toml + project: github.com,BurntSushi,toml + - name: github.com,ogier,pflag + project: github.com,ogier,pflag + - name: gopkg.in,alecthomas,kingpin.v2 + project: gopkg.in,alecthomas,kingpin.v2 diff --git a/projects/gopkg.in,hlandau,madns.v1/config b/projects/gopkg.in,hlandau,madns.v1/config new file mode 100644 index 0000000..512f22a --- /dev/null +++ b/projects/gopkg.in,hlandau,madns.v1/config @@ -0,0 +1,29 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/madns.git +git_hash: '[% config.var_p.id.${"gopkg.in/hlandau/madns.v1"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: gopkg.in/hlandau/madns.v1 + go_lib_deps: + - github.com,miekg,dns + - github.com,hlandau,buildinfo + - github.com,hlandau,xlog + go_lib_install: + - gopkg.in/hlandau/madns.v1 + - gopkg.in/hlandau/madns.v1/merr + +input_files: + - project: container-image + - name: go + project: go + - name: github.com,miekg,dns + project: github.com,miekg,dns + - name: github.com,hlandau,buildinfo + project: github.com,hlandau,buildinfo + - name: github.com,hlandau,xlog + project: github.com,hlandau,xlog diff --git a/projects/gopkg.in,hlandau,service.v2/config b/projects/gopkg.in,hlandau,service.v2/config new file mode 100644 index 0000000..cbbacfe --- /dev/null +++ b/projects/gopkg.in,hlandau,service.v2/config @@ -0,0 +1,29 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/service.git +git_hash: '[% config.var_p.id.${"gopkg.in/hlandau/service.v2"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: gopkg.in/hlandau/service.v2 + go_lib_deps: + - gopkg.in,hlandau,svcutils.v1 + - gopkg.in,hlandau,easyconfig.v1 + +targets: + linux: + var: + arch_deps: + - libcap-dev + +input_files: + - project: container-image + - name: go + project: go + - name: gopkg.in,hlandau,svcutils.v1 + project: gopkg.in,hlandau,svcutils.v1 + - name: gopkg.in,hlandau,easyconfig.v1 + project: gopkg.in,hlandau,easyconfig.v1 diff --git a/projects/gopkg.in,hlandau,svcutils.v1/config b/projects/gopkg.in,hlandau,svcutils.v1/config new file mode 100644 index 0000000..6ff5c92 --- /dev/null +++ b/projects/gopkg.in,hlandau,svcutils.v1/config @@ -0,0 +1,22 @@ +version: '[% c("abbrev") %]' +git_url: https://github.com/hlandau/svcutils.git +git_hash: '[% config.var_p.id.${"gopkg.in/hlandau/svcutils.v1"} %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +build: '[% c("projects/go/var/build_go_lib") %]' + +var: + container: + use_container: 1 + go_lib: gopkg.in/hlandau/svcutils.v1 + +targets: + linux: + var: + arch_deps: + - libcap-dev + +input_files: + - project: container-image + - name: go + project: go diff --git a/projects/ncdns/build b/projects/ncdns/build new file mode 100644 index 0000000..bc90758 --- /dev/null +++ b/projects/ncdns/build @@ -0,0 +1,41 @@ +#!/bin/sh +[% c("var/set_default_env") -%] +[% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %] +distdir=/var/tmp/dist/[% project %] +mkdir -p $distdir + +[% FOREACH dep = c("var/go_lib_deps") -%] + tar -C /var/tmp/dist -xf [% c('input_files_by_name/' _ dep) %] +[% END -%] + +mkdir -p $GOPATH/src/github.com/namecoin +tar -C $GOPATH/src/github.com/namecoin -xf [% project %]-[% c('version') %].tar.gz +mv $GOPATH/src/github.com/namecoin/ncdns-[% c('version') %] $GOPATH/src/github.com/namecoin/ncdns + +go generate github.com/namecoin/ncdns/x509 +go install -ldflags '-s' github.com/namecoin/ncdns/... + +#mkdir -p /var/tmp/build +#tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz +#cd /var/tmp/build/[% project %]-[% c('version') %] + +#mkdir -p "$GOPATH/src/github.com/namecoin" +#ln -sf "$PWD" "$GOPATH/src/github.com/namecoin/ncdns" + +#mkdir -p out +#cd out +#for x in .. ../ncdumpzone ../generate_nmc_cert; do +# go build -ldflags '-s' "$x" +#done + +ls $GOPATH/bin + +for x in ncdns ncdumpzone ncdt generate_nmc_cert tlsrestrict_chromium_tool; do + cp -a $GOPATH/bin/"$x"[% IF c("var/windows") %].exe[% END %] $distdir/ +done + +cd $distdir +[% c('tar', { + tar_src => [ '.' ], + tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'), + }) %] diff --git a/projects/ncdns/config b/projects/ncdns/config new file mode 100644 index 0000000..908ad6c --- /dev/null +++ b/projects/ncdns/config @@ -0,0 +1,55 @@ +version: 0.0.8 +git_url: https://github.com/namecoin/ncdns.git +git_hash: 'v[% c("version") %]' +filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' + +var: + container: + use_container: 1 + go_lib_deps: + - github.com,golang,groupcache + - github.com,hlandau,degoutils + - github.com,hlandau,dexlogconfig + - github.com,hlandau,ncbtcjsontypes + - github.com,hlandauf,btcjson + - github.com,kr,pretty + - github.com,miekg,dns + - gopkg.in,hlandau,madns.v1 + - gopkg.in,hlandau,easyconfig.v1 + - gopkg.in,hlandau,service.v2 + - golang.org,x,net + +targets: + linux: + var: + arch_deps: + - libcap-dev + +input_files: + - project: container-image + - name: go + project: go + - name: github.com,hlandau,xlog + project: github.com,hlandau,xlog + - name: github.com,hlandau,dexlogconfig + project: github.com,hlandau,dexlogconfig + - name: gopkg.in,hlandau,easyconfig.v1 + project: gopkg.in,hlandau,easyconfig.v1 + - name: gopkg.in,hlandau,service.v2 + project: gopkg.in,hlandau,service.v2 + - name: github.com,golang,groupcache + project: github.com,golang,groupcache + - name: github.com,hlandau,ncbtcjsontypes + project: github.com,hlandau,ncbtcjsontypes + - name: github.com,hlandauf,btcjson + project: github.com,hlandauf,btcjson + - name: github.com,miekg,dns + project: github.com,miekg,dns + - name: gopkg.in,hlandau,madns.v1 + project: gopkg.in,hlandau,madns.v1 + - name: github.com,kr,pretty + project: github.com,kr,pretty + - name: github.com,hlandau,degoutils + project: github.com,hlandau,degoutils + - name: golang.org,x,net + project: golang.org,x,net diff --git a/rbm b/rbm new file mode 160000 index 0000000..eb500fa --- /dev/null +++ b/rbm @@ -0,0 +1 @@ +Subproject commit eb500fa9467fb4d7229c9ca87f202ef18603d023 diff --git a/rbm.conf b/rbm.conf new file mode 100644 index 0000000..40ec3a6 --- /dev/null +++ b/rbm.conf @@ -0,0 +1,180 @@ +debug: '[% GET ! ENV.RBM_NO_DEBUG %]' +compress_tar: gz +output_dir: 'out/[% project %]' +tmp_dir: '[% c("basedir") %]/tmp' +_build_log: 'logs/[% project %][% IF c("var/osname") %]-[% c("var/osname") %][% END %].log' +pkg_type: build + +var: + sort_deps: 1 + build_id: '[% sha256(c("var/build_id_txt", { buildconf => { num_procs => 4 } })).substr(0, 6) %]' + build_id_txt: | + [% c("version") %] + [% IF c("git_hash") || c("hg_hash"); GET c("abbrev"); END; %] + [% IF c("var/container/use_container") -%] + [% c("var/container/suite") %] + [% c("var/container/arch") %] + [% END -%] + input_files: [% c("input_files_id") %] + build: + [% c("build", { filename => 'f', output_dir => '/out' }) %] + container: + dir: '[% c("rbm_tmp_dir") %]/rbm-containers/[% sha256(c("build_id")) %]' + user: rbm + input_files_list: | + [% FOREACH file IN c("input_files_by_name").keys.sort -%] + [% c("input_files_by_name/" _ file) %] + [% END -%] + set_default_env: | + set -e + [% FOREACH env = c('ENV') -%] + export [% env.key %]="[% env.value %]" + [% END -%] + rootdir=$(pwd) + export SHELL=/bin/sh + export HOME=$rootdir + umask 0022 + +targets: + notarget: linux-x86_64 + noint: + debug: 0 + + ncdns-linux-x86_64: + - linux-x86_64 + - linux + linux-x86_64: + arch: x86_64 + var: + linux-x86_64: 1 + osname: linux-x86_64 + container: + arch: amd64 + linux: + var: + linux: 1 + compiler: gcc + container: + suite: wheezy + deps: + - build-essential + - zip + - unzip + +remote_start: '[% IF c("var/container/use_container") %][% c("runc/remote_start") %][% END %]' +remote_exec: '[% IF c("var/container/use_container") %][% c("runc/remote_exec") %][% END %]' +remote_put: '[% IF c("var/container/use_container") %][% c("runc/remote_put") %][% END %]' +remote_get: '[% IF c("var/container/use_container") %][% c("runc/remote_get") %][% END %]' +remote_finish: '[% IF c("var/container/use_container") %][% c("runc/remote_finish") %][% END %]' + +runc: + remote_start: | + #!/bin/sh + set -e + if [ $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'* | wc -l) -ne 1 ] + then + echo "Can't find container image in input files" >&2 + ls -l '[% c("remote_srcdir") %]' >&2 + exit 1 + fi + mkdir -p '[% c("var/container/dir") %]'/rootfs/rbm + sudo tar -C '[% c("var/container/dir") %]'/rootfs -xf $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'*) + [% SET user = c("var/container/user") -%] + [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'id ' _ user + _ ' >/dev/null 2>&1 || adduser -m ' _ user _ ' || useradd -m ' _ user }) %] + + remote_exec: | + #!/bin/sh + set -e + [% IF c("interactive") -%] + echo Container directory: [% shell_quote(c("var/container/dir")) %] + [% END -%] + mkdir -p '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/rbm + echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/cmd + echo [% shell_quote(c('exec_cmd')) %] >> '[% c("var/container/dir") %]'/rootfs/rbm/cmd + echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/run + [% IF c('exec_as_root'); SET user = 'root'; ELSE; SET user = c("var/container/user", { error_if_undef => 1 }); END; %] + echo 'su - [% user %] -c /rbm/cmd' >> '[% c("var/container/dir") %]'/rootfs/rbm/run + chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/cmd + chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/run + cat > '[% c("var/container/dir") %]'/config.json < 1 })) %] [% IF c("runc_hide_stderr") %]2>/dev/null[% END %] + + remote_put: | + #!/bin/sh + set -e + [% + SET src = shell_quote(c('put_src', { error_if_undef => 1 })); + SET dst = shell_quote(c('put_dst', { error_if_undef => 1 })); + -%] + sudo mkdir -p '[% c("var/container/dir") %]'/rootfs/[% dst %] + sudo cp -aP [% src %] '[% c("var/container/dir") %]'/rootfs/[% dst %] + # On Ubuntu, the /root/.profile file contains a `mesg n` line which is + # producing some `stdin: is not a tty` messages. To hide them, we hide + # stderr from this part by setting runc_hide_stderr. + [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'chown -R ' _ c("var/container/user") _ ' ' _ dst, runc_hide_stderr => 1 }) %] + + remote_get: | + #!/bin/sh + set -e + [% + SET src = shell_quote(c('get_src', { error_if_undef => 1 })); + SET dst = shell_quote(c('get_dst', { error_if_undef => 1 })); + -%] + mkdir -p [% dst %] + srcdir='[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/[% src %] + sudo chown -R $(whoami) "$srcdir" + if [ $(ls -1 "$srcdir"/* 2> /dev/null | wc -l) -gt 0 ] + then + for file in "$srcdir"/* + do + bname="$(basename "$file")" + test -e [% dst %]/"$bname" && rm -Rf [% dst %]/"$bname" + mv -f "$file" [% dst %]/ + done + fi + + remote_finish: | + #!/bin/sh + set -e + sudo rm -Rf '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs '[% c("var/container/dir", { error_if_undef => 1 }) %]'/config.json + rmdir '[% c("var/container/dir") %]' + +ENV: + TZ: UTC + LC_ALL: C +--- | + # This part of the file contains options written in perl + use IO::CaptureOutput qw(capture_exec); + + my $hashlist = {}; + open(my $f, '<:encoding(UTF-8)', 'hashlist') or die "Cannot open hashlist"; + while (my $row = <$f>) { + chomp $row; + my @words = split / /, $row; + my $repo = $words[1]; + my $hash = $words[2]; + $hashlist->{$repo} = $hash; + #print "$repo = $hash\n"; + } + + ( + var_p => { + # runc100 is true if we are using runc >= 1.0.0 + # we assume that any version that is not 0.1.1 is >= 1.0.0 + runc100 => sub { + my ($out) = capture_exec('sudo', 'runc', '--version'); + return !($out =~ m/^runc version 0.1.1/); + }, + # runc_spec100 is true if runc spec is at least 1.0.0 + # We will need to update this when there is a new spec version available + runc_spec100 => sub { + my ($out) = capture_exec('sudo', 'runc', '--version'); + return $out =~ m/^.*spec: 1\.[0-9]+\.[0-9]+$/m; + }, + + id => $hashlist, + }, + )