DistroKit Mailinglist
 help / color / mirror / Atom feed
* [DistroKit] [PATCH v1] MIPS: add a script to update all configs
@ 2020-04-03 12:40 Oleksij Rempel
  2020-04-03 13:54 ` Robert Schwebel
  2020-04-04 20:05 ` Roland Hieber
  0 siblings, 2 replies; 4+ messages in thread
From: Oleksij Rempel @ 2020-04-03 12:40 UTC (permalink / raw)
  To: distrokit; +Cc: Oleksij Rempel

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

diff --git a/scripts/update-diffs-mips.sh b/scripts/update-diffs-mips.sh
new file mode 100755
index 0000000..b1bdde3
--- /dev/null
+++ b/scripts/update-diffs-mips.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ -z "$PTXDIST" ]; then
+	PTXDIST=ptxdist
+else
+	tput setaf 3 # yellow
+	echo Note: using PTXDIST=$PTXDIST
+	tput sgr 0   # back to normal
+fi
+
+PACKAGES="barebox-common barebox-ar9331 barebox-malta kernel kernel-ar9331 kernel-malta"
+for pkg in $PACKAGES; do
+	$PTXDIST --platformconfig="configs/platform-mips/platformconfig" oldconfig $pkg
+done
-- 
2.26.0.rc2


_______________________________________________
DistroKit mailing list
DistroKit@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [DistroKit] [PATCH v1] MIPS: add a script to update all configs
  2020-04-03 12:40 [DistroKit] [PATCH v1] MIPS: add a script to update all configs Oleksij Rempel
@ 2020-04-03 13:54 ` Robert Schwebel
  2020-04-04 20:05 ` Roland Hieber
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Schwebel @ 2020-04-03 13:54 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: distrokit

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

Applied to next.

rsc
-- 
Pengutronix e.K.                           | Dipl.-Ing. Robert Schwebel  |
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [DistroKit] [PATCH v1] MIPS: add a script to update all configs
  2020-04-03 12:40 [DistroKit] [PATCH v1] MIPS: add a script to update all configs Oleksij Rempel
  2020-04-03 13:54 ` Robert Schwebel
@ 2020-04-04 20:05 ` Roland Hieber
  2020-04-04 23:23   ` Roland Hieber
  1 sibling, 1 reply; 4+ messages in thread
From: Roland Hieber @ 2020-04-04 20:05 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: distrokit

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
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 :)

 - Roland


> diff --git a/scripts/update-diffs-mips.sh b/scripts/update-diffs-mips.sh
> new file mode 100755
> index 0000000..b1bdde3
> --- /dev/null
> +++ b/scripts/update-diffs-mips.sh
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +
> +if [ -z "$PTXDIST" ]; then
> +	PTXDIST=ptxdist
> +else
> +	tput setaf 3 # yellow
> +	echo Note: using PTXDIST=$PTXDIST
> +	tput sgr 0   # back to normal
> +fi
> +
> +PACKAGES="barebox-common barebox-ar9331 barebox-malta kernel kernel-ar9331 kernel-malta"
> +for pkg in $PACKAGES; do
> +	$PTXDIST --platformconfig="configs/platform-mips/platformconfig" oldconfig $pkg
> +done
> -- 
> 2.26.0.rc2
> 
> 
> _______________________________________________
> DistroKit mailing list
> DistroKit@pengutronix.de
> 

-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [DistroKit] [PATCH v1] MIPS: add a script to update all configs
  2020-04-04 20:05 ` Roland Hieber
@ 2020-04-04 23:23   ` Roland Hieber
  0 siblings, 0 replies; 4+ messages in thread
From: Roland Hieber @ 2020-04-04 23:23 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: distrokit

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-04 23:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 12:40 [DistroKit] [PATCH v1] MIPS: add a script to update all configs Oleksij Rempel
2020-04-03 13:54 ` Robert Schwebel
2020-04-04 20:05 ` Roland Hieber
2020-04-04 23:23   ` Roland Hieber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox