packages: Add distclean
The various scripts present in GNU Boot are very fragile, so it's a good idea to have a pristine GNU Boot source code for making releases. The issue is that 'git clean -dfx' doesn't remove existing git repositories like coreboot/ grub/ etc, so we need additional code to take care of that. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
This commit is contained in:
parent
514c573b4d
commit
c7e28dc660
4
Makefile
4
Makefile
|
@ -59,6 +59,9 @@ clean:
|
|||
crossgcc-clean:
|
||||
./build clean crossgcc
|
||||
|
||||
distclean:
|
||||
./build distclean all
|
||||
|
||||
install-dependencies-ubuntu:
|
||||
./build dependencies ubuntu2004
|
||||
|
||||
|
@ -72,4 +75,5 @@ install-dependencies-void:
|
|||
./build dependencies void
|
||||
check:
|
||||
./tests/lint
|
||||
./tests/distclean
|
||||
./tests/u-boot-libre
|
||||
|
|
1
build
1
build
|
@ -37,6 +37,7 @@ tasks="\
|
|||
clean \
|
||||
dependencies \
|
||||
descriptors \
|
||||
distclean \
|
||||
install \
|
||||
module \
|
||||
payload \
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_coreboot()
|
||||
{
|
||||
rm -rf coreboot
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_coreboot $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_descriptors()
|
||||
{
|
||||
rm -rf descriptors
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_descriptors $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_flashrom()
|
||||
{
|
||||
rm -rf flashrom
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_flashrom $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_grub()
|
||||
{
|
||||
rm -rf grub
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_grub $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_ich9utils()
|
||||
{
|
||||
rm -rf ich9utils
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_ich9utils $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_memtest86plus()
|
||||
{
|
||||
rm -rf memtest86plus
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_memtest86plus $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_payloads()
|
||||
{
|
||||
rm -rf payloads
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_payloads $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_romimages()
|
||||
{
|
||||
rm -rf bin
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_romimages $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_roms()
|
||||
{
|
||||
rm -rf release
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_roms $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_seabios()
|
||||
{
|
||||
rm -rf seabios
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_seabios $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_src()
|
||||
{
|
||||
rm -rf release
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_src $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_u_boot_libre()
|
||||
{
|
||||
rm -rf release
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_u_boot_libre $@
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
|
||||
|
||||
distclean_u_boot()
|
||||
{
|
||||
rm -rf u-boot
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_u_boot $@
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2022-2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# shellcheck source=resources/scripts/misc/sysexits.sh
|
||||
topdir="$(dirname "${BASH_SOURCE[0]}")"/../../../
|
||||
. "${topdir}"/resources/scripts/misc/sysexits.sh
|
||||
|
||||
progname="$0"
|
||||
package="$(basename "$(dirname "${progname}")")"
|
||||
|
||||
distclean_usage()
|
||||
{
|
||||
printf "Usage:\n"
|
||||
printf "\t%s --help # %s\n" \
|
||||
"${progname}" \
|
||||
"Print this help"
|
||||
printf "\t%s # remove %s source code.\n" \
|
||||
"${progname}" \
|
||||
"${package}"
|
||||
}
|
||||
|
||||
distclean_main()
|
||||
{
|
||||
func="$1"
|
||||
shift 1
|
||||
if [ $# -eq 0 ] ; then
|
||||
if [ ! -f projectname ] ; then
|
||||
echo "Error: for safety reasons " \
|
||||
"this program can only run in the top directory."
|
||||
exit 1
|
||||
else
|
||||
eval "${func}"
|
||||
fi
|
||||
elif [ $# -eq 1 ] && [ "$1" = "--help" ] ; then
|
||||
distclean_usage "${progname}"
|
||||
exit 0
|
||||
else
|
||||
distclean_usage "${progname}"
|
||||
exit "${EX_USAGE}"
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
printf "+-------------------------+\n"
|
||||
printf "| Running distclean test: |\n"
|
||||
printf "+-------------------------+\n"
|
||||
|
||||
# shellcheck source=resources/scripts/tasks/distclean.sh
|
||||
. "$(dirname "$0")"/../resources/scripts/tasks/distclean.sh
|
||||
|
||||
report()
|
||||
{
|
||||
ret=$?
|
||||
message="$1"
|
||||
|
||||
if [ ${ret} -eq 0 ] ; then
|
||||
echo "[ OK ] ${message}"
|
||||
else
|
||||
echo "[ !! ] ${message} failed"
|
||||
exit ${ret}
|
||||
fi
|
||||
}
|
||||
|
||||
tmpdir="$(mktemp -d)" && test -d "${tmpdir}" ; report "\${tmpdir} created"
|
||||
|
||||
distclean_test()
|
||||
{
|
||||
rmdir "${tmpdir}" && test ! -d "${tmpdir}" ; report "\${tmpdir} removed"
|
||||
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
distclean_main distclean_test $@
|
||||
|
||||
printf "+---------------------+\n"
|
||||
printf "| Running tests done: |\n"
|
||||
printf "+---------------------+\n"
|
17
tests/lint
17
tests/lint
|
@ -33,7 +33,7 @@ report()
|
|||
run_shellcheck()
|
||||
{
|
||||
for path in "$@" ; do
|
||||
shellcheck "${path}" ; report "${path}"
|
||||
shellcheck -x "${path}" ; report "${path}"
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,21 @@ printf "+---------------------+\n"
|
|||
printf "| Running lint tests: |\n"
|
||||
printf "+---------------------+\n"
|
||||
run_shellcheck \
|
||||
resources/packages/descriptors/distclean \
|
||||
resources/packages/flashrom/distclean \
|
||||
resources/packages/grub/distclean \
|
||||
resources/packages/ich9utils/distclean \
|
||||
resources/packages/memtest86plus/distclean \
|
||||
resources/packages/payloads/distclean \
|
||||
resources/packages/rom_images/distclean \
|
||||
resources/packages/roms/distclean \
|
||||
resources/packages/seabios/distclean \
|
||||
resources/packages/src/distclean \
|
||||
resources/packages/u-boot-libre/distclean \
|
||||
resources/packages/u-boot/distclean \
|
||||
resources/packages/coreboot/distclean \
|
||||
resources/scripts/tasks/distclean.sh \
|
||||
tests/distclean \
|
||||
tests/lint
|
||||
|
||||
printf "+---------------------+\n"
|
||||
|
|
Loading…
Reference in New Issue