From: Roland Hieber <rhi@pengutronix.de>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: distrokit@pengutronix.de
Subject: Re: [DistroKit] [PATCH v1] MIPS: add a script to update all configs
Date: Sun, 5 Apr 2020 01:23:37 +0200 [thread overview]
Message-ID: <20200404232336.eiu7y27id6iztn2m@pengutronix.de> (raw)
In-Reply-To: <20200404200519.5yllsngjbivy6odp@pengutronix.de>
On Sat, Apr 04, 2020 at 10:05:19PM +0200, Roland Hieber wrote:
> On Fri, Apr 03, 2020 at 02:40:24PM +0200, Oleksij Rempel wrote:
> > Add a script to make updating of barebox and kernel packages easier.
> >
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
> > scripts/update-diffs-mips.sh | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> > create mode 100755 scripts/update-diffs-mips.sh
>
> We already have scripts/p-all for the ptxdist part, and we have several
I meant to say "scripts/update-diffs-v7a.sh", not "scripts/p-all".
> bareboxes in the v7a platform as well, and I think we can solve all of
> those by expanding your script. Luckily I have a similar script lying
> around in another BSP… let me see if I can adapt that :)
This is what I currently have, with two big FIXMEs:
#!/bin/bash -e
self="$(realpath "${0}")" &&
bsp="$(realpath "$(dirname "${self}")"/..)"
cd "${bsp}"
info() {
tput setaf 3 # yellow
"$@"
tput sgr 0 # back to normal
}
if [ -z "$PTXDIST" ]; then
PTXDIST=ptxdist
else
info printf "Note: using PTXDIST=%s\n" "${PTXDIST}"
fi
do_ptxdist() {
local target="ptxdist"
info prefix_target "ptxdist migrate\n"
ptxdist_platform migrate
}
do_barebox() {
local target="barebox"
# FIXME:
# - find out which bareboxes are there
# - static shell variables?
# - find configs/platform-$n/rules/barebox*make ?
# - ptxdist print -v BAREBOX_%_CONFIG?
# - find out in which order to reconfigure them
# - ptxdist print -v BAREBOX_%_REF_CONFIG and iterate over dependencies?
# - makefile?
local bareboxes="barebox-common"
for barebox in $bareboxes; do
if [ -n "$do_clean" ]; then
info prefix_target "ptxdist clean %s\n" "$barebox"
ptxdist_platform clean "$barebox"
fi
info prefix_target "ptxdist oldconfig %s\n" "$barebox"
ptxdist_platform oldconfig "$barebox"
done
}
do_kernel() {
local target="kernel"
# FIXME: same as in do_barebox
local kernels="kernel"
for kernel in $kernels; do
if [ -n "$do_clean" ]; then
info prefix_target "ptxdist clean %s\n" "$kernel"
ptxdist_platform clean "$kernel"
fi
info prefix_target "ptxdist oldconfig %s\n" "$kernel"
ptxdist_platform oldconfig "$kernel"
done
}
usage() {
cat <<-EOF
Usage: $0 [params...]
Recalculate config diffs
Params can be given in any order:
* any platform names ('mips', 'rpi', 'v7a', ...):
only work on the respective platforms. (default: all platforms)
* 'ptxdist':
only work on ptxconfig and platformconfig
* 'barebox':
only work on barebox packages
* kernel:
only work on kernel packages
* '--clean', '-c':
do a 'ptxdist clean' on kernel and barebox packages before working on them
Example:
$ $0
Recalculate ptxdist, barebox and kernel config diffs for all platforms
$ $0 rpi
Recalculate ptxdist, barebox and kernel config diffs only for the 'rpi' platform
$ $0 v7a kernel mips
Recalculate kernel config diffs for the 'v7a' and 'mips' platforms
$ $0 v7a kernel --clean mips
As above, but clean kernel packages before
EOF
}
main() {
local platforms=()
local do_clean=
local do_ptxdist=
local do_barebox=
local do_kernel=
while [ -n "$1" ]; do
case "$1" in
--help|-h) usage "$self"; exit;;
--clean) do_clean=1;;
barebox) do_barebox=1;;
kernel) do_kernel=1;;
ptxdist) do_ptxdist=1;;
*)
if [ -d configs/platform-${1} ]; then
platforms+=($1)
else
printf "Unknown platform: %s\n" "$1"
exit 1
fi
;;
esac
shift
done
if [ -z "$platforms" ]; then
platforms=( $(find configs/platform-* -maxdepth 0 -type d | cut -d- -f2) )
fi
if [ -z "$do_ptxdist$do_barebox$do_kernel" ]; then
do_ptxdist=1
do_barebox=1
do_kernel=1
fi
if [ -n "${do_barebox}" ] && [ "$(echo local_src/barebox*)" != 'local_src/barebox*' ]; then
echo "Refusing to work with local_src symlinks present:"
ls -d1 local_src/barebox*
exit 1
fi
if [ -n "${do_kernel}" ] && [ "$(echo local_src/kernel*)" != 'local_src/kernel*' ]; then
echo "Refusing to work with local_src symlinks present:"
ls -d1 local_src/kernel*
exit 1
fi
printf "Platforms: %s\n" "${platforms[*]}"
printf "Targets: %s%s%s%s%s\n" \
"$(if [ -n "$do_ptxdist" ]; then printf "ptxdist "; fi)" \
"$(if [ -n "$do_barebox" ]; then printf "barebox"; fi)" \
"$(if [ -n "$do_clean" ]; then printf "(clean) "; else printf " "; fi)" \
"$(if [ -n "$do_kernel" ]; then printf "kernel"; fi)" \
"$(if [ -n "$do_clean" ]; then printf "(clean) "; fi)"
echo
local platform
for platform in "${platforms[@]}"; do
prefix_target() {
printf "%s/%s: " "$platform" "$target"
printf "$@"
}
ptxdist_platform() {
"$PTXDIST" --platformconfig=configs/platform-"${platform}"/platformconfig "$@"
}
if [ -n "$do_ptxdist" ]; then do_ptxdist; fi
if [ -n "$do_barebox" ]; then do_barebox; fi
if [ -n "$do_kernel" ]; then do_kernel; fi
done;
}
main "$@"
--
Roland Hieber, Pengutronix e.K. | r.hieber@pengutronix.de |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
DistroKit mailing list
DistroKit@pengutronix.de
prev parent reply other threads:[~2020-04-04 23:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-03 12:40 Oleksij Rempel
2020-04-03 13:54 ` Robert Schwebel
2020-04-04 20:05 ` Roland Hieber
2020-04-04 23:23 ` Roland Hieber [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200404232336.eiu7y27id6iztn2m@pengutronix.de \
--to=rhi@pengutronix.de \
--cc=distrokit@pengutronix.de \
--cc=o.rempel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox