All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv4] core/pkg-generic: check proper package installation
Date: Fri, 6 Nov 2015 23:55:54 +0100	[thread overview]
Message-ID: <563D2FFA.5010403@mind.be> (raw)
In-Reply-To: <1446837330-31048-1-git-send-email-yann.morin.1998@free.fr>

On 06-11-15 20:15, Yann E. MORIN wrote:
> Some packages misbehave, and install files in either of;
>   - $(STAGING_DIR)/$(O) or $(TARGET_DIR)/$(O),
>   - $(STAGING_DIR)/$(HOST_DIR) or $(TARGET_DIR)/$(HOST_DIR).
> 
> One common reason for that is that pkgconf now prepends the sysroot path
> to all the paths it returns. Other reasons vary, but are mostly due to
> poorly writen generic-packages.
> 
> Add a check for those locations, as part of the command blocks for the
> target and staging installs.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> Cc: Peter Seiderer <ps.report@gmx.net>
> Cc: Romain Naour <romain.naour@openwide.fr>
> 
> ---
> Chamges v3 -> v4:
>   - don't use step hooks; do the checks in the command blocks (Arnout)
> 
> Changes v2 -> v3:
>   - also check for $(HOST_DIR) in case the user specified an
>     out-of-build-dir location  (Arnout)
> 
> ---
> Note that, in the current state of Buildroot, this *will* cause a lot of
> build failures until all those packages are fixed. Among the known to
> break are quite a few Xorg packages.
> ---
>  package/pkg-generic.mk | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index a5d0e57..82ec32e 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -229,6 +229,7 @@ $(BUILD_DIR)/%/.stamp_staging_installed:
>  	$(foreach hook,$($(PKG)_PRE_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
>  	+$($(PKG)_INSTALL_STAGING_CMDS)
>  	$(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
> +	$(call check-install-dirs,$(STAGING_DIR))
>  	$(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
>  		$(call MESSAGE,"Fixing package configuration files") ;\
>  			$(SED)  "s,$(BASE_DIR), at BASE_DIR@,g" \
> @@ -275,6 +276,7 @@ $(BUILD_DIR)/%/.stamp_target_installed:
>  	$(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
>  		$($(PKG)_INSTALL_INIT_SYSV))
>  	$(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
> +	$(call check-install-dirs,$(TARGET_DIR))
>  	$(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
>  		$(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \
>  	fi
> @@ -286,6 +288,23 @@ $(BUILD_DIR)/%/.stamp_dircleaned:
>  	rm -Rf $(@D)
>  
>  ################################################################################
> +# check-install-dirs -- check that packages do not incorrectly install files
> +# into incorrect locations
> +#
> +# argument 2 is the base directory to check for
> +################################################################################
> +define check-install-dirs
> +	$(Q)if [ -d $(1)/$(HOST_DIR) ]; then \
> +		printf "ERROR: package %s installs files in %s\n" $($(PKG)_NAME) $(1)$(HOST_DIR); \

 Missing / between $(1) and $(HOST_DIR).

> +		exit 1; \
> +	fi
> +	$(Q)if [ -d $(1)/$(O) ]; then \
> +		printf "ERROR: package %s installs files in %s\n" $($(PKG)_NAME) $(1)$(O); \

 Ditto.

> +		exit 1; \
> +	fi

 I think it's better without this duplication so with a second parameter and
calling the function twice.

 Regards,
 Arnout

> +endef
> +
> +################################################################################
>  # virt-provides-single -- check that provider-pkg is the declared provider for
>  # the virtual package virt-pkg
>  #
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

  reply	other threads:[~2015-11-06 22:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 19:15 [Buildroot] [PATCHv4] core/pkg-generic: check proper package installation Yann E. MORIN
2015-11-06 22:55 ` Arnout Vandecappelle [this message]
2015-11-06 23:07   ` Yann E. MORIN
2015-11-06 23:12     ` Arnout Vandecappelle
2015-11-09 13:20     ` Luca Ceresoli
2015-11-09 14:52       ` Arnout Vandecappelle
2015-11-29 17:58 ` Thomas Petazzoni
2015-11-29 18:10   ` Yann E. MORIN
2015-11-29 18:27     ` Thomas Petazzoni
2015-11-29 20:04       ` Yann E. MORIN
2015-11-29 20:31       ` Arnout Vandecappelle

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=563D2FFA.5010403@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.