Switch to packages structure.
The various build scripts are scattered around in multiple places. This make it hard for contributors to understand what they need to modify. Most GNU Boot users are interested in running GNU/Linux or BSD operating systems. And the way to install software on these operating systems is through a package manager. So most users and contributors already know the package manager abstraction. So using that abstraction makes it easier to find where things are. The scripts to install dependencies don't really fit the new structure but for now we move them in to make sure that everything works fine. This could be fixed later on and migrated to a single dependencies packages by auto-detecting the distribution with /etc/os-release. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Acked-by: Adrien 'neox' Bourmault <neox@gnu.org> Signed-off-by: Adrien 'neox' Bourmault <neox@gnu.org>
This commit is contained in:
parent
12a200fc18
commit
857afa42a8
52
build
52
build
|
@ -27,19 +27,41 @@ set -u -e
|
|||
|
||||
projectname="$(cat projectname)"
|
||||
|
||||
build=./resources/scripts/build
|
||||
# This is for backward compatibility: before the list of "modes" was
|
||||
# auto-detected, but there isn't a 1:1 matching between modes and
|
||||
# packages tasks (build, clean, etc).
|
||||
tasks="\
|
||||
boot \
|
||||
clean \
|
||||
dependencies \
|
||||
descriptors \
|
||||
module \
|
||||
payload \
|
||||
release \
|
||||
"
|
||||
|
||||
list_tasks() {
|
||||
for task in "${build}"/*; do
|
||||
printf '%s\n' "${task##*/}"
|
||||
for task in ${tasks} ; do
|
||||
echo "${task}"
|
||||
done
|
||||
}
|
||||
|
||||
list_tasks_paths() {
|
||||
task="${1}"
|
||||
|
||||
find resources/packages \
|
||||
-mindepth 2 -maxdepth 2 \
|
||||
-type f \
|
||||
-name "${task}" \
|
||||
-printf "%P\n"
|
||||
}
|
||||
|
||||
# Takes exactly one task as parameter
|
||||
list_packages() {
|
||||
for package in "${build}"/"${1}"/*; do
|
||||
printf '%s\n' "${package##*/}"
|
||||
done
|
||||
task="${1}"
|
||||
|
||||
list_tasks_paths "${task}" | \
|
||||
sed 's#/.*##'
|
||||
}
|
||||
|
||||
help() {
|
||||
|
@ -82,18 +104,26 @@ if [ $# -gt 1 ]; then
|
|||
|
||||
case "${package}" in
|
||||
list)
|
||||
printf "Available packages for task '%s':\n\n" "${task}"
|
||||
tasks_paths=$(list_tasks_paths "${task}")
|
||||
if [ -z "${tasks_paths}" ] ; then
|
||||
die "Invalid task '${task}'." \
|
||||
" See './build help'."
|
||||
else
|
||||
printf "Available packages for task '%s':\n\n" \
|
||||
"${task}"
|
||||
list_packages "${task}"
|
||||
fi
|
||||
;;
|
||||
all)
|
||||
for package in $(list_packages "${task}"); do
|
||||
"${build}"/"${task}"/"${package}" $@
|
||||
resources/packages/"${package}"/"${task}" $@
|
||||
done
|
||||
;;
|
||||
*)
|
||||
if [ -d "${build}"/"${task}"/ ]; then
|
||||
if [ -f "${build}"/"${task}"/"${package}" ]; then
|
||||
"${build}"/"${task}"/"${package}" $@
|
||||
if [ -d resources/packages/"${package}" ] ; then
|
||||
pkg_dir=resources/packages/"${package}"
|
||||
if [ -f "${pkg_dir}"/"${task}" ]; then
|
||||
"${pkg_dir}"/"${task}" $@
|
||||
else
|
||||
help
|
||||
die "Invalid package for '${task}'." \
|
||||
|
|
28
download
28
download
|
@ -36,12 +36,10 @@ deleteblobs="true"
|
|||
|
||||
rm -f "build_error"
|
||||
|
||||
download=resources/scripts/download
|
||||
|
||||
list_packages() {
|
||||
for package in "${download}"/*; do
|
||||
printf '%s\n' "${package##*/}"
|
||||
done
|
||||
ls -d resources/packages/*/download | \
|
||||
sed 's#/download$##' | \
|
||||
sed 's#^resources/packages/##'
|
||||
}
|
||||
|
||||
help() {
|
||||
|
@ -85,32 +83,30 @@ shift 1
|
|||
[ "${package}" = help ] && help && exit 0
|
||||
|
||||
if [ "${package}" = "all" ]; then
|
||||
for downloadPackage in ${download}/*; do
|
||||
if [ -f "${downloadPackage}" ]; then
|
||||
for script in resources/packages/*/download; do
|
||||
if [ "${deleteblobs}" = "false" ]; then
|
||||
NODELETE= "${downloadPackage}"
|
||||
NODELETE= "${script}"
|
||||
else
|
||||
"${downloadPackage}"
|
||||
fi
|
||||
"${script}"
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
elif [ ! -f "${download}/${package}" ]; then
|
||||
elif [ ! -f "resources/packages/${package}/download" ]; then
|
||||
help
|
||||
die "Invalid argument '${package}'. See: './download help'."
|
||||
die "Invalid package '${package}'. See: './download help'."
|
||||
fi
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
if [ "${deleteblobs}" = "false" ]; then
|
||||
NODELETE= "${download}/${package}"
|
||||
NODELETE= resources/packages/"${package}"/download
|
||||
else
|
||||
"${download}/${package}"
|
||||
resources/packages/"${package}"/download
|
||||
fi
|
||||
else
|
||||
if [ "${deleteblobs}" = "false" ]; then
|
||||
NODELETE= "${download}/${package}" $@
|
||||
NODELETE= resources/packages/"${package}"/download $@
|
||||
else
|
||||
"${download}/${package}" $@
|
||||
resources/packages/"${package}"/download $@
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
39
modify
39
modify
|
@ -26,19 +26,25 @@ set -u -e
|
|||
projectname="$(cat projectname)"
|
||||
./resources/scripts/misc/versioncheck
|
||||
|
||||
modify=./resources/scripts/modify
|
||||
|
||||
list_modify_paths() {
|
||||
find resources/packages \
|
||||
-mindepth 2 -maxdepth 2 \
|
||||
-type d \
|
||||
-name "modify" \
|
||||
-printf "%P\n"
|
||||
}
|
||||
list_packages() {
|
||||
for package in "${modify}"/*; do
|
||||
printf '%s\n' "${package##*/}"
|
||||
done
|
||||
list_modify_paths | \
|
||||
sed 's#/.*##'
|
||||
}
|
||||
|
||||
# Takes exactly one package as parameter
|
||||
listoptions() {
|
||||
for option in "${modify}"/"${1}"/*; do
|
||||
printf '%s\n' "${option##*/}"
|
||||
done
|
||||
package="${1}"
|
||||
find resources/packages/"${package}/modify/" \
|
||||
-mindepth 1 -maxdepth 1 \
|
||||
-type f \
|
||||
-printf "%P\n"
|
||||
}
|
||||
|
||||
help() {
|
||||
|
@ -75,18 +81,25 @@ if [ $# -gt 1 ]; then
|
|||
|
||||
case "${option}" in
|
||||
list)
|
||||
printf "Available options for package '%s':\n\n" "${package}"
|
||||
if [ ! -d resources/packages/"${package}" ] ; then
|
||||
die "Invalid package '${package}'." \
|
||||
" See './modify help'."
|
||||
else
|
||||
printf "Available options for package '%s':\n\n" \
|
||||
"${package}"
|
||||
listoptions "${package}"
|
||||
fi
|
||||
;;
|
||||
all)
|
||||
for option in $(listoptions "${package}"); do
|
||||
"${modify}"/"${package}"/"${option}" $@
|
||||
resources/packages/"${package}"/modify/"${option}" $@
|
||||
done
|
||||
;;
|
||||
*)
|
||||
if [ -d "${modify}"/"${package}"/ ]; then
|
||||
if [ -f "${modify}"/"${package}"/"${option}" ]; then
|
||||
"${modify}"/"${package}"/"${option}" $@
|
||||
if [ -d resources/packages/"${package}"/modify ]; then
|
||||
pkg_dir=resources/packages/"${package}"
|
||||
if [ -f "${pkg_dir}"/modify/"${option}" ]; then
|
||||
"${pkg_dir}"/modify/"${option}" $@
|
||||
else
|
||||
help
|
||||
die "Invalid option for '${package}'." \
|
||||
|
|
|
@ -36,7 +36,7 @@ release_files=""
|
|||
|
||||
usage()
|
||||
{
|
||||
progname="resources/scripts/build/release/u-boot-libre"
|
||||
progname="resources/packages/u-boot-libre/release"
|
||||
|
||||
printf "Usage:\n"
|
||||
printf "\t%s # %s\n" \
|
|
@ -243,13 +243,13 @@ script is also applicable to newer ubuntu versions
|
|||
|
||||
If the `ubuntu2004` script complains about missing dependencies, just modify
|
||||
the script and remove those dependencies. The script is located
|
||||
at `resources/scripts/build/dependencies/ubuntu2004` and it is written for
|
||||
at `resources/packages/ubuntu2004/dependencies` and it is written for
|
||||
Ubuntu 20.04, but it should work fine in other GNU+Linux distributions that use
|
||||
the `apt-get` package manager.
|
||||
|
||||
A `flashrom/` directory will be present, with a `flashrom` executable inside
|
||||
of it. If you got an error about missing package when running the dependencies
|
||||
command above, tweak `resources/scripts/build/dependencies/ubuntu2004`. That
|
||||
command above, tweak `resources/packages/ubuntu2004/dependencies`. That
|
||||
script downloads and installs build dependencies in apt-get and it is intended
|
||||
for use on x86-64 systems running Ubuntu 20.04, but it should work in Raspbian
|
||||
on the Raspberry Pi.
|
||||
|
@ -266,7 +266,7 @@ argument in flashrom. This mitigates stability issues.
|
|||
If you downloaded the flashrom source code directly, you can go into the
|
||||
directory and simply type `make`. In the Libreboot build system, build
|
||||
dependencies are documented in script located
|
||||
at `resources/scripts/build/dependencies/` which you can install
|
||||
at `resources/packages/*/dependencies` which you can install
|
||||
using the `apt-get` software.
|
||||
|
||||
How to use flashrom
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# tests for resources/scripts/build/release/u-boot-stable-src-release
|
||||
# tests for resources/packages/u-boot-libre/release
|
||||
#
|
||||
# Copyright (C) 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
|
@ -25,5 +25,5 @@ set -u -e
|
|||
topdir="$(realpath $(dirname $(realpath $0))/../)"
|
||||
progname="$(basename $(realpath $0))"
|
||||
|
||||
"${topdir}/resources/scripts/build/release/u-boot-libre"
|
||||
"${topdir}/resources/packages/u-boot-libre/release"
|
||||
sha512sum -c "${topdir}/tests/${progname}.sha512"
|
||||
|
|
32
update
32
update
|
@ -26,19 +26,17 @@ set -u -e
|
|||
projectname="$(cat projectname)"
|
||||
./resources/scripts/misc/versioncheck
|
||||
|
||||
update=./resources/scripts/update
|
||||
|
||||
list_packages() {
|
||||
for package in "${update}"/*; do
|
||||
printf '%s\n' "${package##*/}"
|
||||
done
|
||||
ls -d resources/packages/*/update/ | \
|
||||
sed 's#resources/packages/##' | \
|
||||
sed 's#/.*##'
|
||||
}
|
||||
|
||||
# Takes exactly one package as parameter
|
||||
listoptions() {
|
||||
for option in "${update}"/"${1}"/*; do
|
||||
printf '%s\n' "${option##*/}"
|
||||
done
|
||||
package="${1}"
|
||||
ls -d resources/packages/"${package}"/update/* | \
|
||||
sed 's#resources/packages/'"${package}"'/update/##'
|
||||
}
|
||||
|
||||
help() {
|
||||
|
@ -74,18 +72,24 @@ if [ $# -gt 1 ]; then
|
|||
|
||||
case "${option}" in
|
||||
list)
|
||||
printf "Available options for package '%s':\n\n" "${package}"
|
||||
if [ ! -d resources/packages/"${package}" ] ; then
|
||||
die "Invalid package '${package}'." \
|
||||
" See './update help'."
|
||||
else
|
||||
printf "Available options for package '%s':\n\n" \
|
||||
"${package}"
|
||||
listoptions "${package}"
|
||||
;;
|
||||
fi
|
||||
all)
|
||||
for option in $(listoptions "${package}"); do
|
||||
"${update}"/"${package}"/"${option}" $@
|
||||
resources/packages/"${package}"/update/"${option}" $@
|
||||
done
|
||||
;;
|
||||
*)
|
||||
if [ -d "${update}"/"${package}"/ ]; then
|
||||
if [ -f "${update}"/"${package}"/"${option}" ]; then
|
||||
"${update}"/"${package}"/"${option}" $@
|
||||
if [ -d resources/packages/"${package}"/update ]; then
|
||||
pkg_dir=resources/packages/"${package}"
|
||||
if [ -f "${pkg_dir}"/update/"${option}" ]; then
|
||||
"${pkg_dir}"/update/"${option}" $@
|
||||
else
|
||||
help
|
||||
die "Invalid option for '${package}'." \
|
||||
|
|
Loading…
Reference in New Issue