Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
| [turso.tech](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/turso.tech) | `tursodb` — in-process SQL database compatible with SQLite | gh release | 1.0.0 |
| [webinstall.dev](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/webinstall.dev) | `webi` — install packages without sudo | curl | 1.0.1 |
| [yakitrak/notesmd-cli](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/yakitrak-notesmd-cli) | `notesmd-cli` — manage Obsidian vaults from the terminal | gh release | 1.0.0 |
| [yoctoproject.org](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/yoctoproject.org) | `bitbake` — build tool for the Yocto Project and OpenEmbedded | curl | 1.0.0 |
| [yq](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/yq) | `yq` — command-line YAML/JSON/XML processor | gh release | 1.0.1 |
| [zellij.dev](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/zellij.dev) | `zellij` — terminal workspace with multiplexer and layouts | gh release | 1.0.2 |
| [zyedidia/eget](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/zyedidia-eget) | `eget` — easily install prebuilt binaries from GitHub releases | gh release | 1.0.2 |
17 changes: 17 additions & 0 deletions src/yoctoproject.org/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yoctoproject.org

## Project

- [Yocto Project / BitBake](https://github.com/openembedded/bitbake)

## Description

`bitbake` is the build tool at the heart of the Yocto Project and OpenEmbedded. It processes recipes and layer configurations to build custom embedded Linux distributions and cross-compilation toolchains. `bitbake` is also used standalone outside of a full Yocto environment.

## Installation Method

Downloaded as a source archive from the [openembedded/bitbake GitHub tags](https://github.com/openembedded/bitbake/tags), extracted to `/opt/bitbake`, and a wrapper script placed in `/usr/local/bin`.

## Other Notes

_No additional notes._
17 changes: 17 additions & 0 deletions src/yoctoproject.org/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "yoctoproject.org",
"id": "yoctoproject.org",
"version": "1.0.0",
"description": "Install \"bitbake\" binary",
"documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/yoctoproject.org",
"options": {
"version": {
"type": "string",
"default": "latest",
"proposals": [
"latest"
],
"description": "Version of \"bitbake\" to install."
}
}
}
108 changes: 108 additions & 0 deletions src/yoctoproject.org/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash
set -o errexit
set -o pipefail
set -o noclobber
set -o nounset
set -o allexport
readonly githubRepository='openembedded/bitbake'
readonly binaryName='bitbake'
readonly versionArgument='--version'
readonly installDir='/opt/bitbake'
readonly binaryTargetFolder='/usr/local/bin'
readonly name="${githubRepository##*/}"
apt_get_update() {
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}
apt_get_checkinstall() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
apt_get_update
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends --no-install-suggests --option 'Debug::pkgProblemResolver=true' --option 'Debug::pkgAcquire::Worker=1' "$@"
fi
}
apt_get_cleanup() {
apt-get clean
rm -rf /var/lib/apt/lists/*
}
check_curl_file_tar_installed() {
declare -a requiredAptPackagesMissing=()
if ! [ -r '/etc/ssl/certs/ca-certificates.crt' ]; then
requiredAptPackagesMissing+=('ca-certificates')
fi
if ! command -v curl >/dev/null 2>&1; then
requiredAptPackagesMissing+=('curl')
fi
if ! command -v file >/dev/null 2>&1; then
requiredAptPackagesMissing+=('file')
fi
if ! command -v tar >/dev/null 2>&1; then
requiredAptPackagesMissing+=('tar')
fi
declare -i requiredAptPackagesMissingCount=${#requiredAptPackagesMissing[@]}
if [ $requiredAptPackagesMissingCount -gt 0 ]; then
apt_get_update
apt_get_checkinstall "${requiredAptPackagesMissing[@]}"
apt_get_cleanup
fi
}
curl_check_url() {
local url=$1
local status_code
status_code=$(curl -s -o /dev/null -w '%{http_code}' "$url")
if [ "$status_code" -ne 200 ] && [ "$status_code" -ne 302 ]; then
echo "Failed to download '$url'. Status code: $status_code."
return 1
fi
}
curl_download_stdout() {
local url=$1
curl \
--silent \
--location \
--output '-' \
--connect-timeout 5 \
"$url"
}
echo_banner() {
local text="$1"
echo -e "\e[1m\e[97m\e[41m$text\e[0m"
}
bitbake_list_versions() {
curl -s "https://api.github.com/repos/${githubRepository}/tags?per_page=100" \
| grep -Po '"name": "yocto-\K[0-9]+\.[0-9]+\.[0-9]+(?=")'
}
bitbake_get_latest_version() {
bitbake_list_versions | head -n 1
}
utils_check_version() {
local version=$1
if ! [[ "${version:-}" =~ ^(latest|[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
printf >&2 '=== [ERROR] Option "version" (value: "%s") is not "latest" or valid semantic version format "X.Y.Z" !\n' \
"$version"
exit 1
fi
}
install() {
utils_check_version "$VERSION"
check_curl_file_tar_installed
apt_get_checkinstall python3 locales
locale-gen en_US.UTF-8
if [ "$VERSION" == 'latest' ] || [ -z "$VERSION" ]; then
VERSION=$(bitbake_get_latest_version)
fi
readonly version="${VERSION:?}"
readonly downloadUrl="https://github.com/${githubRepository}/archive/refs/tags/yocto-${version}.tar.gz"
curl_check_url "$downloadUrl"
mkdir -p "${installDir}"
curl_download_stdout "$downloadUrl" | tar -xz -f '-' --strip-components=1 -C "${installDir}"
printf '#!/bin/bash\nexec %s/bin/%s "$@"\n' "${installDir}" "${binaryName}" \
> "${binaryTargetFolder}/${binaryName}"
chmod 755 "${binaryTargetFolder}/${binaryName}"
apt_get_cleanup
}
echo_banner "devcontainer.community"
echo "Installing $name..."
install "$@"
echo "(*) Done!"
14 changes: 14 additions & 0 deletions test/yoctoproject.org/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -e

# Optional: Import test library bundled with the devcontainer CLI
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
# Provides the 'check' and 'reportResults' commands.
source dev-container-features-test-lib

# Feature-specific tests
check "execute command" bash -c "bitbake --version | grep 'BitBake'"

# Report results
reportResults
Loading