mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
Initial support for pbuilder.
Note: pbuilder --create does not work well with relative build path, base.tgz creation fails. This led to the build_dir path being absolute. Perhaps we should make it more granular and only use absolute paths for pbuilder options.
This commit is contained in:
parent
c0cae8b7fe
commit
595d17abea
6
Makefile
6
Makefile
@ -24,6 +24,12 @@ iso: prepare
|
||||
lb build 2>&1 | tee build.log
|
||||
@echo "VyOS ISO build successful"
|
||||
|
||||
.PHONY: prepare-package-env
|
||||
.ONESHELL:
|
||||
prepare-package-env:
|
||||
@scripts/pbuilder-config
|
||||
@scripts/pbuilder-setup
|
||||
|
||||
.PHONY: clean
|
||||
.ONESHELL:
|
||||
clean:
|
||||
|
||||
@ -51,6 +51,13 @@ if (args['debian_mirror'] != defaults.DEBIAN_MIRROR) and \
|
||||
(args['pbuilder_debian_mirror'] == defaults.DEBIAN_MIRROR):
|
||||
args['pbuilder_debian_mirror'] = args['debian-mirror']
|
||||
|
||||
# Populate some defaults that are not configurable,
|
||||
# but that are handy to have in the options hash
|
||||
args['distribution'] = defaults.DEBIAN_DISTRIBUTION
|
||||
args['build_dir'] = os.path.join(os.getcwd(), defaults.BUILD_DIR)
|
||||
args['pbuilder_config'] = defaults.PBUILDER_CONFIG
|
||||
|
||||
|
||||
# Save to file
|
||||
distutils.dir_util.mkpath(defaults.BUILD_DIR)
|
||||
|
||||
|
||||
@ -5,3 +5,8 @@ BUILD_CONFIG = os.path.join(BUILD_DIR, 'build-config.json')
|
||||
|
||||
# The default mirror was chosen entirely at random
|
||||
DEBIAN_MIRROR = 'http://ftp.nl.debian.org/debian/'
|
||||
|
||||
DEBIAN_DISTRIBUTION = 'jessie'
|
||||
|
||||
PBUILDER_CONFIG = os.path.join(BUILD_DIR, 'pbuilderrc')
|
||||
PBUILDER_DIR = os.path.join(BUILD_DIR, 'pbuilder')
|
||||
|
||||
35
scripts/pbuilder-config
Executable file
35
scripts/pbuilder-config
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
import pystache
|
||||
|
||||
import defaults
|
||||
import util
|
||||
|
||||
util.check_build_config()
|
||||
|
||||
pbuilder_config_tmpl = """
|
||||
|
||||
BASETGZ={{build_dir}}/base.tgz
|
||||
BUILDPLACE={{build_dir}}/pbuilder/
|
||||
MIRRORSITE={{pbuilder_debian_mirror}}
|
||||
BUILDRESULT={{build_dir}}/pbuilder/result/
|
||||
|
||||
DISTRIBUTION={{distribution}}
|
||||
|
||||
ARCHITECTURE={{architecture}}
|
||||
|
||||
"""
|
||||
|
||||
with open(defaults.BUILD_CONFIG, 'r') as f:
|
||||
build_config = json.load(f)
|
||||
|
||||
pbuilder_config = pystache.render(pbuilder_config_tmpl, build_config)
|
||||
|
||||
print("Configuring pbuilder")
|
||||
|
||||
with open(defaults.PBUILDER_CONFIG, 'w+') as f:
|
||||
f.write(pbuilder_config)
|
||||
34
scripts/pbuilder-setup
Executable file
34
scripts/pbuilder-setup
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import distutils.dir_util
|
||||
|
||||
import pystache
|
||||
|
||||
import defaults
|
||||
import util
|
||||
|
||||
util.check_build_config()
|
||||
|
||||
pbuilder_create_cmd_tmpl= """
|
||||
sudo pbuilder --create \
|
||||
--configfile {{pbuilder_config}}
|
||||
"""
|
||||
|
||||
with open(defaults.BUILD_CONFIG, 'r') as f:
|
||||
build_config = json.load(f)
|
||||
|
||||
pbuilder_create_command = pystache.render(pbuilder_create_cmd_tmpl, build_config)
|
||||
|
||||
print("Creating a pbuilder environment")
|
||||
#os.chdir(defaults.BUILD_DIR)
|
||||
|
||||
distutils.dir_util.mkpath(defaults.PBUILDER_DIR)
|
||||
|
||||
result = os.system(pbuilder_create_command)
|
||||
if result > 0:
|
||||
print("pbuilder environment bootstrap failed")
|
||||
sys.exit(1)
|
||||
|
||||
6
scripts/pbuilder/hooks/C10shell
Executable file
6
scripts/pbuilder/hooks/C10shell
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# invoke shell if build fails.
|
||||
|
||||
apt-get install -y --force-yes vim nano less bash
|
||||
cd /tmp/buildd/*/debian/..
|
||||
/bin/bash < /dev/tty > /dev/tty 2> /dev/tty
|
||||
Loading…
x
Reference in New Issue
Block a user