summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-vagrant-libvirt-box13
-rwxr-xr-xscripts/check-build-env3
-rw-r--r--scripts/defaults.py2
-rwxr-xr-xscripts/live-build-config10
-rwxr-xr-xscripts/make-version-file24
5 files changed, 39 insertions, 13 deletions
diff --git a/scripts/build-vagrant-libvirt-box b/scripts/build-vagrant-libvirt-box
index 7aff4eda..6db77c2a 100755
--- a/scripts/build-vagrant-libvirt-box
+++ b/scripts/build-vagrant-libvirt-box
@@ -54,16 +54,21 @@ fi
PROVIDER=libvirt
# Create version
-curl -XPOST -d "version[version]=${VERSION}" \
+major=$(cat build/version | cut -d'+' -f2 | cut -d'-' -f1 | rev | cut -c 5- | rev)
+sub=$(cat build/version | cut -d'+' -f2 | cut -d'-' -f1 | rev | cut -c 3-4 | rev)
+minor=$(cat build/version | cut -d'+' -f2 | cut -d'-' -f1 | rev | cut -c 1-2 | rev)
+version=$(echo "$major.$sub.$minor")
+curl -XPOST -d "version[version]=${version}" \
https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/versions?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN}
echo
# Create provider
-curl -XPOST -d "provider[name]=${PROVIDER}" -d "provider[url]=${VAGRANT_BOX_BASE_URL}/vyos-${VERSION}-vagrant-${PROVIDER}.box" \
- https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/version/${VERSION}/providers?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN}
+urlencoded_version=$(cat build/version | sed 's/+/%2B/')
+curl -XPOST -d "provider[name]=${PROVIDER}" -d "provider[url]=${VAGRANT_BOX_BASE_URL}/vyos-${urlencoded_version}-vagrant-${PROVIDER}.box" \
+ https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/version/${version}/providers?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN}
echo
# Release version
curl -XPUT \
- https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/version/${VERSION}/release?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN}
+ https://app.vagrantup.com/api/v1/box/${VAGRANT_BOX_NAME}/version/${version}/release?access_token=${VAGRANT_CLOUD_ACCESS_TOKEN}
echo
diff --git a/scripts/check-build-env b/scripts/check-build-env
index 7f02c02a..7377be64 100755
--- a/scripts/check-build-env
+++ b/scripts/check-build-env
@@ -32,7 +32,8 @@ deps = {
'live-build',
'pbuilder',
'devscripts',
- 'python3-pystache'
+ 'python3-pystache',
+ 'python3-git'
],
'binaries': []
}
diff --git a/scripts/defaults.py b/scripts/defaults.py
index bb6f0910..93eadc30 100644
--- a/scripts/defaults.py
+++ b/scripts/defaults.py
@@ -33,7 +33,7 @@ PBUILDER_DIR = os.path.join(BUILD_DIR, 'pbuilder')
LB_CONFIG_DIR = os.path.join(BUILD_DIR, 'config')
CHROOT_INCLUDES_DIR = os.path.join(LB_CONFIG_DIR, 'includes.chroot')
-VYOS_MIRROR = 'http://dev.packages.vyos.net/repositories/current/vyos'
+VYOS_MIRROR = 'http://dev.packages.vyos.net/repositories/current'
VYOS_BRANCH = 'current'
diff --git a/scripts/live-build-config b/scripts/live-build-config
index 4c4a38ac..b1a77b4c 100755
--- a/scripts/live-build-config
+++ b/scripts/live-build-config
@@ -36,7 +36,7 @@ lb config noauto \
--architectures {{architecture}} \
--bootappend-live "boot=live components hostname=vyos username=live nopersistence noautologin nonetworking union=overlay" \
--linux-flavours {{architecture}}-vyos \
- --linux-packages linux-image-4.4.113 \
+ --linux-packages linux-image-4.14.26 \
--bootloader syslinux \
--binary-images iso-hybrid \
--debian-installer false \
@@ -53,7 +53,8 @@ lb config noauto \
--archive-areas "main contrib non-free" \
--firmware-chroot true \
--updates true \
- --security true
+ --security true \
+ --apt-indices false
"${@}"
"""
@@ -64,16 +65,19 @@ debug = build_config['debug']
# Add the additional repositories to package lists
print("Setting up additional APT entries")
-vyos_repo_entry = "deb {0} {1} main\n".format(build_config['vyos_mirror'], build_config['vyos_branch'])
+vyos_repo_entry = "deb {0}/vyos {1} main\n".format(build_config['vyos_mirror'], build_config['vyos_branch'])
+vyos_debian_repo_entry = "deb {0}/debian {1} main\n".format(build_config['vyos_mirror'], build_config['vyos_branch'])
apt_file = os.path.join(build_config['build_dir'], defaults.VYOS_REPO_FILE)
if debug:
print("Adding these entries to {0}:".format(apt_file))
print("\t", vyos_repo_entry)
+ print("\t", vyos_debian_repo_entry)
with open(apt_file, 'w') as f:
f.write(vyos_repo_entry)
+ f.write(vyos_debian_repo_entry)
# Configure live-build
diff --git a/scripts/make-version-file b/scripts/make-version-file
index 3bb33319..0459b8bf 100755
--- a/scripts/make-version-file
+++ b/scripts/make-version-file
@@ -1,6 +1,6 @@
#!/usr/bin/python3
#
-# Copyright (C) 2016 VyOS maintainers and contributors
+# Copyright (C) 2018 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -25,16 +25,18 @@ import datetime
import json
import uuid
+import git
+
import defaults
import util
+# Load the build config
util.check_build_config()
with open(defaults.BUILD_CONFIG, 'r') as f:
build_config = json.load(f)
-
+# Create a build timestamp
now = datetime.datetime.today()
-
build_timestamp = now.strftime("%Y%m%d%H%M")
# FIXME: use aware rather than naive object
@@ -43,9 +45,23 @@ build_date = now.strftime("%a %d %b %Y %H:%M UTC")
# Assign a (hopefully) unique identifier to the build (UUID)
build_id = str(uuid.uuid4())
+# Create a build version
if build_config['build_type'] == 'development':
- version = "999.{0}".format(build_timestamp)
+ try:
+ # Load the branch to version mapping file
+ with open('data/versions') as f:
+ version_mapping = json.load(f)
+
+ repo = git.Repo('.')
+ git_branch = repo.active_branch.name
+ branch_version = version_mapping[git_branch]
+
+ version = "{0}-rolling+{1}".format(branch_version, build_timestamp)
+ except Exception as e:
+ print("Could not build a version string specific to git branch, falling back to default: {0}".format(str(e)))
+ version = "999.{0}".format(build_timestamp)
else:
+ # Release build, use the version from ./configure arguments
version = build_config['version']
version_data = {