buildroot.buildroot.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Andreas Ziegler <br025@umbiko.net>
Cc: buildroot@buildroot.org, Marcus Hoffmann <buildroot@bubu1.eu>
Subject: Re: [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications
Date: Thu, 27 Aug 2026 07:40:44 +0200	[thread overview]
Message-ID: <ao_Nj3une8D_aVEC@windsurf> (raw)
In-Reply-To: <20260827032643.1940-2-br025@umbiko.net>

Hello Andreas,

On Thu, Aug 27, 2026 at 05:26:38AM +0200, Andreas Ziegler wrote:
> +# sed snippet from https://stackoverflow.com/a/37911473
> +# single-line configurations will be inserted behind the last matching line
> +# in the target file, multi-line blocks are just appended at the bottom.
>  define MPD_INSTALL_EXTRA_FILES
> -	$(INSTALL) -m 0644 -D package/mpd/mpd.conf $(TARGET_DIR)/etc/mpd.conf
> +	$(INSTALL) -m 0644 -D $(@D)/doc/mpdconf.example $(TARGET_DIR)/etc/mpd.conf
> +	export multiline=0
> +	while read -r line; do \
> +		if [[ $$line =~ ^[a-zA-Z] ]]; then \
> +			if [ "$${line##*[[:space:]]}" == "{" ]; then \
> +				export multiline=1; \
> +				printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
> +			else \
> +				[ $$multiline ] && \
> +					printf "\t%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
> +				[ ! $$multiline ] && \
> +					sed '/#'$${line%%[[:space:]]*}'[^\n]*/,$$!b;//{x;//p;g};//!H;$$!d;x;s||&\n'"$$line"'|' -i "$(TARGET_DIR)"/etc/mpd.conf; \
> +			fi \
> +		elif [ "$$line" == "}" ]; then \
> +			printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
> +			export multiline=0; \
> +		fi \
> +	done < package/mpd/mpd.conf

I am sorry, but this is way too complicated for Buildroot's KISS
principle. Some much simpler approach needs to be found.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2026-08-27  5:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  3:26 [Buildroot] [PATCH v3 0/2] Add runtime test for mpd Andreas Ziegler
2026-08-27  3:26 ` [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications Andreas Ziegler
2026-08-27  5:40   ` Thomas Petazzoni via buildroot [this message]
2026-08-28  2:53     ` Andreas Ziegler
2026-08-27  3:26 ` [Buildroot] [PATCH v3 2/2] support/testing: add runtime test for mpd Andreas Ziegler

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=ao_Nj3une8D_aVEC@windsurf \
    --to=buildroot@buildroot.org \
    --cc=br025@umbiko.net \
    --cc=buildroot@bubu1.eu \
    --cc=thomas.petazzoni@bootlin.com \
    /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;
as well as URLs for NNTP newsgroup(s).