Hi,
I need help with an issue I'm encountering consistently on my project.
I couldn't minimize it yet - maybe you can tell what's wrong already.
This issue occurs when directly building final container pavetta-sdk-custom
, but if we first build pavetta-redist
, it goes away.
There's also a warning I don't know how to handle:
WARN 2019-08-19T12:26:09Z: vagga::builder::commands::subcontainer: Can't write image usage info: No such file or directory (os error 2)
➜ seidhe git:(master) ✗ vagga pavetta run Iss/libraries/sysid
<ubuntu setup logs>
Setting up g++ (4:7.4.0-1ubuntu2.3) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/c++.1.gz because associated file /usr/share/man/man1/g++.1.gz (of link group c++) doesn't exist
Setting up build-essential (12.4ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
WARN 2019-08-19T12:26:09Z: vagga::builder::commands::subcontainer: Can't write image usage info: No such file or directory (os error 2)
ERROR 2019-08-19T12:26:09Z: vagga::builder: Error building container "pavetta-sdk-custom": step SubConfig { source: Directory, path: "vagga.yaml", container: "pavetta-sdk-common", cache: None } failed: sub-step Build { container: "pavetta-redist", source: "/usr/local/bin", path: Some("/usr/local/bin"), temporary_mount: None, content_hash: false, rules: ["/pavetta"] } failed: can't read "/vagga/base/.roots/pavetta-redist.a9d21258/root/usr/local/bin": No such file or directory (os error 2)
ERROR 2019-08-19T12:26:09Z: vagga::wrapper: Error executing _build: Builder exited with code 1
Command <Command "/proc/self/exe" "__wrapper__" "_build" "pavetta-sdk-custom"; environ[7]; uid_map=[UidMap { inside_uid: 0, outside_uid: 1000, count: 1 }, UidMap { inside_uid: 1, outside_uid: 100000, count: 65535 }]; gid_map=[GidMap { inside_gid: 0, outside_gid: 1000, count: 1 }, GidMap { inside_gid: 1, outside_gid: 100000, count: 65535 }]> exited with code 124
Relevant configs are:
containers:
pavetta-sdk-common:
setup:
- !Ubuntu bionic
- !UbuntuUniverse
- !Install [build-essential]
- !Build
container: pavetta-redist
source: /usr/local/bin
path: /usr/local/bin
rules:
- /pavetta
- !Build
container: ciri-redist
source: /usr/local/bin
path: /usr/local/bin
rules:
- /ciri
- !Build
container: ciri-lua
source: /opt/lua
path: /opt/lua
- !Install [liblua5.2-0]
- !Text
/usr/local/bin/Config.toml: |
test_suites = [
"/work/ciri/test_suites/",
]
[ciri]
path = "/usr/local/bin/ciri"
config_path = "/usr/local/bin/ciri-Config.toml"
- !Text
/usr/local/bin/ciri-Config.toml: |
lock_file_path = "/tmp/lock"
lua_prefix_path = "/opt/lua/"
- !SubConfig
container: sdk-deps
pavetta-sdk-custom:
environ:
HOME: /work/.vagga-ws
setup:
- !SubConfig
container: pavetta-sdk-common
- !SubConfig
container: sdk-deps
- !Build
container: sdk-custom
source: /opt
path: /opt
sdk-deps:
setup:
- !Install
- dosfstools
- doxygen
- jq
- libasound2
- libcurl3-gnutls
- libglib2.0-0
- libpixman-1-0
- libpulse0
- libsdl2-2.0-0
- libx11-6
- libxml2
- make
- mtd-utils
- parted
- python
- python3
- virtualenv
pavetta-redist:
environ:
HOME: /tmp
setup:
- !Container rust-build
- !Depends
path: pavetta
rules:
- /src
- /Cargo.toml
- !Sh |
cd pavetta
cargo build --target-dir /work/.vagga-ws/target/pavetta
- !Sh "cp /work/.vagga-ws/target/pavetta/debug/pavetta /usr/local/bin"
rust:
environ:
HOME: /work/.vagga-ws
setup:
- !Ubuntu bionic
- !UbuntuUniverse
- !TarInstall
url: https://static.rust-lang.org/dist/rust-1.35.0-x86_64-unknown-linux-gnu.tar.gz
script: ./install.sh --prefix=/usr
- !TarInstall
url: https://static.rust-lang.org/dist/rust-1.35.0-x86_64-unknown-linux-musl.tar.gz
script: ./install.sh --prefix=/usr --components=rust-std-x86_64-unknown-linux-musl
rust-build:
environ:
HOME: /work/.vagga-ws
setup:
- !Ubuntu bionic
- !UbuntuUniverse
- !Build
container: rust
source: /usr
path: /usr
- !Install [build-essential, curl, ca-certificates]
- !CacheDirs
/tmp/.cargo: cargo
ciri-redist:
environ:
HOME: /tmp
setup:
- !Container ciri-build
- !CacheDirs
/tmp/.cargo: cargo
- !Depends
path: ciri
rules:
- /src
- /Cargo.toml
- !Sh |
cd ciri
cargo build --target-dir /work/.vagga-ws/target/ciri
- !Sh "cp /work/.vagga-ws/target/ciri/debug/ciri /usr/local/bin/ciri"
ciri-build:
environ:
HOME: /work/.vagga-ws
setup:
- !Container rust-build
- !Install [liblua5.2-dev, liblua5.2-0, pkg-config]
ciri-lua:
setup:
- !Ubuntu bionic
- !UbuntuUniverse
- !Install
# Lua and Lua rocks build dependencies
- build-essential
- ca-certificates
- curl
- libreadline-dev
- unzip
# Lua native rocks extensions
- liblua5.2-dev
# Luarocks installation
- python-pip
# Luarocks GitHub installation support
- git
# luasec native dependency
- libssl-dev
- !Sh "pip install hererocks"
- !EnsureDir /opt
- !Cmd
- /bin/bash
- -exc
- |
hererocks -l5.2 -rlatest /opt/lua
- !CacheDirs
/tmp/.cache/luarocks: luarocks-cache
- !Depends
path: ciri
rules:
- /rocks.sh
- !Cmd
- /bin/bash
- -exc
- |
. /opt/lua/bin/activate
/work/ciri/rocks.sh
sdk-custom:
setup:
- !Container base
- !Sh |
echo "In case next step fails, look at .vagga/sdk-parser/sdk.yaml"
- !SubConfig
source: !Container sdk-spec-parser
path: sdk.yaml
container: sdk
sdk-spec-parser-base:
setup:
- !Container empty
- !Depends prepare-sdk-yaml.py
- !PipConfig
dependencies: true
- !Py3Install [PyYAML, pystache]
sdk-spec-parser:
setup:
- !Container sdk-spec-parser-base
- !Depends .vagga-ws/sdk-spec.yaml
- !Sh |
/work/prepare-sdk-yaml.py /work/.vagga-ws/sdk-spec.yaml /sdk.yaml
empty:
setup:
- !Alpine v3.10
prepare-sdk-yaml.py:
#!/usr/bin/env python3
import sys
import yaml
import pystache
template_head = """
containers:
sdk:
setup:
"""
template_steps_base = """
- !RunAs
script: |
if [ -f "/work/.vagga-ws/{{id}}/{{base_name}}-{{id}}_{{version}}_amd64.deb" ]; then
mkdir /tmp/{{id}}
cp /work/.vagga-ws/{{id}}/{{base_name}}-{{id}}_{{version}}_amd64.deb /tmp/{{id}}
else
jfrog rt download sdk/{{id}}/*_{{version}}_* | tee /work/.vagga-ws/jfrog-result | jq -e ".totals.success == 1 and .totals.failure == 0" || cat /work/.vagga-ws/jfrog-result
fi
work-dir: /tmp
- !Sh |
echo debconf {{base_name_lower}}-{{id_lower}}/eula select true | debconf-set-selections
echo debconf {{base_name_lower}}-{{id_lower}}/eula seen true | debconf-set-selections
dpkg -i /tmp/{{id}}/{{base_name}}-{{id}}_{{version}}_amd64.deb
"""
def main():
spec_file_path = sys.argv[1]
out_file_path = sys.argv[2]
with open(spec_file_path, 'r') as spec_file:
try:
with open(out_file_path, 'w') as out_file:
spec = yaml.safe_load(spec_file)
result = pystache.render(template_head, spec)
out_file.write(result)
for s in spec.values():
s['id_lower'] = s['id'].lower()
if not 'base_name' in s:
s['base_name'] = "KasperskyOS"
s['base_name_lower'] = s['base_name'].lower()
template_steps = pystache.render(template_steps_base, s)
result = pystache.render(template_steps, s)
out_file.write(result)
except yaml.YAMLError as exc:
print(exc)
if __name__ == "__main__":
main()
sdk-spec.template.yaml:
# Copy this file to .vagga-ws/sdk-spec.yaml and change as you like
# Then use container 'sdk-custom'. It will have specified SDK installed
komset:
id: Komset-001
version: 0.11
myoffice:
id: MyOffice-001
version: 0.39
# Initial part of deb package name
# By default, it's KasperskyOS
base_name: KasperskyOS-SDK