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)"
|
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() {
|
list_tasks() {
|
||||||
for task in "${build}"/*; do
|
for task in ${tasks} ; do
|
||||||
printf '%s\n' "${task##*/}"
|
echo "${task}"
|
||||||
done
|
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
|
# Takes exactly one task as parameter
|
||||||
list_packages() {
|
list_packages() {
|
||||||
for package in "${build}"/"${1}"/*; do
|
task="${1}"
|
||||||
printf '%s\n' "${package##*/}"
|
|
||||||
done
|
list_tasks_paths "${task}" | \
|
||||||
|
sed 's#/.*##'
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
@ -82,18 +104,26 @@ if [ $# -gt 1 ]; then
|
||||||
|
|
||||||
case "${package}" in
|
case "${package}" in
|
||||||
list)
|
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}"
|
list_packages "${task}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
all)
|
all)
|
||||||
for package in $(list_packages "${task}"); do
|
for package in $(list_packages "${task}"); do
|
||||||
"${build}"/"${task}"/"${package}" $@
|
resources/packages/"${package}"/"${task}" $@
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -d "${build}"/"${task}"/ ]; then
|
if [ -d resources/packages/"${package}" ] ; then
|
||||||
if [ -f "${build}"/"${task}"/"${package}" ]; then
|
pkg_dir=resources/packages/"${package}"
|
||||||
"${build}"/"${task}"/"${package}" $@
|
if [ -f "${pkg_dir}"/"${task}" ]; then
|
||||||
|
"${pkg_dir}"/"${task}" $@
|
||||||
else
|
else
|
||||||
help
|
help
|
||||||
die "Invalid package for '${task}'." \
|
die "Invalid package for '${task}'." \
|
||||||
|
|
28
download
28
download
|
@ -36,12 +36,10 @@ deleteblobs="true"
|
||||||
|
|
||||||
rm -f "build_error"
|
rm -f "build_error"
|
||||||
|
|
||||||
download=resources/scripts/download
|
|
||||||
|
|
||||||
list_packages() {
|
list_packages() {
|
||||||
for package in "${download}"/*; do
|
ls -d resources/packages/*/download | \
|
||||||
printf '%s\n' "${package##*/}"
|
sed 's#/download$##' | \
|
||||||
done
|
sed 's#^resources/packages/##'
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
@ -85,32 +83,30 @@ shift 1
|
||||||
[ "${package}" = help ] && help && exit 0
|
[ "${package}" = help ] && help && exit 0
|
||||||
|
|
||||||
if [ "${package}" = "all" ]; then
|
if [ "${package}" = "all" ]; then
|
||||||
for downloadPackage in ${download}/*; do
|
for script in resources/packages/*/download; do
|
||||||
if [ -f "${downloadPackage}" ]; then
|
|
||||||
if [ "${deleteblobs}" = "false" ]; then
|
if [ "${deleteblobs}" = "false" ]; then
|
||||||
NODELETE= "${downloadPackage}"
|
NODELETE= "${script}"
|
||||||
else
|
else
|
||||||
"${downloadPackage}"
|
"${script}"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
elif [ ! -f "${download}/${package}" ]; then
|
elif [ ! -f "resources/packages/${package}/download" ]; then
|
||||||
help
|
help
|
||||||
die "Invalid argument '${package}'. See: './download help'."
|
die "Invalid package '${package}'. See: './download help'."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
if [ "${deleteblobs}" = "false" ]; then
|
if [ "${deleteblobs}" = "false" ]; then
|
||||||
NODELETE= "${download}/${package}"
|
NODELETE= resources/packages/"${package}"/download
|
||||||
else
|
else
|
||||||
"${download}/${package}"
|
resources/packages/"${package}"/download
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "${deleteblobs}" = "false" ]; then
|
if [ "${deleteblobs}" = "false" ]; then
|
||||||
NODELETE= "${download}/${package}" $@
|
NODELETE= resources/packages/"${package}"/download $@
|
||||||
else
|
else
|
||||||
"${download}/${package}" $@
|
resources/packages/"${package}"/download $@
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
39
modify
39
modify
|
@ -26,19 +26,25 @@ set -u -e
|
||||||
projectname="$(cat projectname)"
|
projectname="$(cat projectname)"
|
||||||
./resources/scripts/misc/versioncheck
|
./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() {
|
list_packages() {
|
||||||
for package in "${modify}"/*; do
|
list_modify_paths | \
|
||||||
printf '%s\n' "${package##*/}"
|
sed 's#/.*##'
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Takes exactly one package as parameter
|
# Takes exactly one package as parameter
|
||||||
listoptions() {
|
listoptions() {
|
||||||
for option in "${modify}"/"${1}"/*; do
|
package="${1}"
|
||||||
printf '%s\n' "${option##*/}"
|
find resources/packages/"${package}/modify/" \
|
||||||
done
|
-mindepth 1 -maxdepth 1 \
|
||||||
|
-type f \
|
||||||
|
-printf "%P\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
@ -75,18 +81,25 @@ if [ $# -gt 1 ]; then
|
||||||
|
|
||||||
case "${option}" in
|
case "${option}" in
|
||||||
list)
|
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}"
|
listoptions "${package}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
all)
|
all)
|
||||||
for option in $(listoptions "${package}"); do
|
for option in $(listoptions "${package}"); do
|
||||||
"${modify}"/"${package}"/"${option}" $@
|
resources/packages/"${package}"/modify/"${option}" $@
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -d "${modify}"/"${package}"/ ]; then
|
if [ -d resources/packages/"${package}"/modify ]; then
|
||||||
if [ -f "${modify}"/"${package}"/"${option}" ]; then
|
pkg_dir=resources/packages/"${package}"
|
||||||
"${modify}"/"${package}"/"${option}" $@
|
if [ -f "${pkg_dir}"/modify/"${option}" ]; then
|
||||||
|
"${pkg_dir}"/modify/"${option}" $@
|
||||||
else
|
else
|
||||||
help
|
help
|
||||||
die "Invalid option for '${package}'." \
|
die "Invalid option for '${package}'." \
|
||||||
|
|
|
@ -36,7 +36,7 @@ release_files=""
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
progname="resources/scripts/build/release/u-boot-libre"
|
progname="resources/packages/u-boot-libre/release"
|
||||||
|
|
||||||
printf "Usage:\n"
|
printf "Usage:\n"
|
||||||
printf "\t%s # %s\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
|
If the `ubuntu2004` script complains about missing dependencies, just modify
|
||||||
the script and remove those dependencies. The script is located
|
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
|
Ubuntu 20.04, but it should work fine in other GNU+Linux distributions that use
|
||||||
the `apt-get` package manager.
|
the `apt-get` package manager.
|
||||||
|
|
||||||
A `flashrom/` directory will be present, with a `flashrom` executable inside
|
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
|
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
|
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
|
for use on x86-64 systems running Ubuntu 20.04, but it should work in Raspbian
|
||||||
on the Raspberry Pi.
|
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
|
If you downloaded the flashrom source code directly, you can go into the
|
||||||
directory and simply type `make`. In the Libreboot build system, build
|
directory and simply type `make`. In the Libreboot build system, build
|
||||||
dependencies are documented in script located
|
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.
|
using the `apt-get` software.
|
||||||
|
|
||||||
How to use flashrom
|
How to use flashrom
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/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>
|
# Copyright (C) 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||||
#
|
#
|
||||||
|
@ -25,5 +25,5 @@ set -u -e
|
||||||
topdir="$(realpath $(dirname $(realpath $0))/../)"
|
topdir="$(realpath $(dirname $(realpath $0))/../)"
|
||||||
progname="$(basename $(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"
|
sha512sum -c "${topdir}/tests/${progname}.sha512"
|
||||||
|
|
32
update
32
update
|
@ -26,19 +26,17 @@ set -u -e
|
||||||
projectname="$(cat projectname)"
|
projectname="$(cat projectname)"
|
||||||
./resources/scripts/misc/versioncheck
|
./resources/scripts/misc/versioncheck
|
||||||
|
|
||||||
update=./resources/scripts/update
|
|
||||||
|
|
||||||
list_packages() {
|
list_packages() {
|
||||||
for package in "${update}"/*; do
|
ls -d resources/packages/*/update/ | \
|
||||||
printf '%s\n' "${package##*/}"
|
sed 's#resources/packages/##' | \
|
||||||
done
|
sed 's#/.*##'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Takes exactly one package as parameter
|
# Takes exactly one package as parameter
|
||||||
listoptions() {
|
listoptions() {
|
||||||
for option in "${update}"/"${1}"/*; do
|
package="${1}"
|
||||||
printf '%s\n' "${option##*/}"
|
ls -d resources/packages/"${package}"/update/* | \
|
||||||
done
|
sed 's#resources/packages/'"${package}"'/update/##'
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
@ -74,18 +72,24 @@ if [ $# -gt 1 ]; then
|
||||||
|
|
||||||
case "${option}" in
|
case "${option}" in
|
||||||
list)
|
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}"
|
listoptions "${package}"
|
||||||
;;
|
fi
|
||||||
all)
|
all)
|
||||||
for option in $(listoptions "${package}"); do
|
for option in $(listoptions "${package}"); do
|
||||||
"${update}"/"${package}"/"${option}" $@
|
resources/packages/"${package}"/update/"${option}" $@
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -d "${update}"/"${package}"/ ]; then
|
if [ -d resources/packages/"${package}"/update ]; then
|
||||||
if [ -f "${update}"/"${package}"/"${option}" ]; then
|
pkg_dir=resources/packages/"${package}"
|
||||||
"${update}"/"${package}"/"${option}" $@
|
if [ -f "${pkg_dir}"/update/"${option}" ]; then
|
||||||
|
"${pkg_dir}"/update/"${option}" $@
|
||||||
else
|
else
|
||||||
help
|
help
|
||||||
die "Invalid option for '${package}'." \
|
die "Invalid option for '${package}'." \
|
||||||
|
|
Loading…
Reference in New Issue