* [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir
@ 2014-09-26 21:46 jon
2014-09-27 9:08 ` Guillermo Rodriguez Garcia
2014-09-29 9:42 ` Michael Olbrich
0 siblings, 2 replies; 7+ messages in thread
From: jon @ 2014-09-26 21:46 UTC (permalink / raw)
To: ptxdist; +Cc: Jon Ringle
From: Jon Ringle <jringle@gridpoint.com>
This is useful if you install a package to /opt and libs are in /opt/lib:
$(call install_lib, foo, 0, 0, 0644, libfoo, opt/)
Signed-off-by: Jon Ringle <jringle@gridpoint.com>
---
rules/post/install.make | 4 +++-
scripts/lib/ptxd_make_xpkg_pkg.sh | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/rules/post/install.make b/rules/post/install.make
index d57e5dd..2ff9f40 100644
--- a/rules/post/install.make
+++ b/rules/post/install.make
@@ -231,6 +231,7 @@ install_package = \
# $3: GID
# $4: permissions (octal)
# $5: library name without suffix.
+# $6: optional root dir
#
install_lib = \
XPKG=$(subst _,-,$(strip $(1))); \
@@ -238,8 +239,9 @@ install_lib = \
GRP="$(strip $(3))"; \
PER="$(strip $(4))"; \
LIB=$(strip $(5)); \
+ DST=$(strip $(6)); \
$(call install_check, install_lib); \
- echo "ptxd_install_lib '$$LIB' '$$OWN' '$$GRP' '$$PER'" >> "$(STATEDIR)/$$XPKG.cmds"
+ echo "ptxd_install_lib '$$LIB' '$$DST' '$$OWN' '$$GRP' '$$PER'" >> "$(STATEDIR)/$$XPKG.cmds"
#
# install_replace
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index 86196a2..501d1fd 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -744,9 +744,11 @@ export -f ptxd_install_shared
ptxd_install_lib() {
local lib_dir=$(ptxd_get_lib_dir)
local lib="$1"
+ local root_dir="$2"
+ shift
shift
- local file="$(for dir in "${pkg_pkg_dir}/"{,usr/}${lib_dir}; do
+ local file="$(for dir in "${pkg_pkg_dir}/"${root_dir}{,usr/}${lib_dir}; do
find "${dir}" -type f -path "${dir}/${lib}.so*"; done 2>/dev/null)"
if [ ! -f "${file}" ]; then
--
1.8.5.4
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir
2014-09-26 21:46 [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir jon
@ 2014-09-27 9:08 ` Guillermo Rodriguez Garcia
2014-09-27 21:14 ` Jon Ringle
2014-09-29 9:42 ` Michael Olbrich
1 sibling, 1 reply; 7+ messages in thread
From: Guillermo Rodriguez Garcia @ 2014-09-27 9:08 UTC (permalink / raw)
To: ptxdist; +Cc: Jon Ringle
[-- Attachment #1.1: Type: text/plain, Size: 439 bytes --]
El viernes, 26 de septiembre de 2014, <jon@ringle.org> escribió:
> From: Jon Ringle <jringle@gridpoint.com <javascript:;>>
>
> This is useful if you install a package to /opt and libs are in /opt/lib:
> $(call install_lib, foo, 0, 0, 0644, libfoo, opt/)
Shouldn't this be handled with DESTDIR in the install target of
the package's Makefile?
Guillermo
--
Guillermo Rodriguez Garcia
guille.rodriguez@gmail.com
[-- Attachment #1.2: Type: text/html, Size: 946 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir
2014-09-27 9:08 ` Guillermo Rodriguez Garcia
@ 2014-09-27 21:14 ` Jon Ringle
0 siblings, 0 replies; 7+ messages in thread
From: Jon Ringle @ 2014-09-27 21:14 UTC (permalink / raw)
To: Guillermo Rodriguez Garcia; +Cc: Ringle, Jonathan, ptxdist
[-- Attachment #1: Type: TEXT/PLAIN, Size: 708 bytes --]
On Sat, 27 Sep 2014, Guillermo Rodriguez Garcia wrote:
> El viernes, 26 de septiembre de 2014, <jon@ringle.org> escribió:
> From: Jon Ringle <jringle@gridpoint.com>
>
> This is useful if you install a package to /opt and libs are in /opt/lib:
> $(call install_lib, foo, 0, 0, 0644, libfoo, opt/)
>
>
> Shouldn't this be handled with DESTDIR in the install target of the package's Makefile?
$DESTDIR is used during the <PKG>.install target to put the files in the
packages/<PKG> directory. But $(call install_dir ...) and friends are used
during the <PKG>.targetinstall target to put files from the packages/<PKG>
directory to the root/ and root-debug/ directories.
Jon
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir
2014-09-26 21:46 [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir jon
2014-09-27 9:08 ` Guillermo Rodriguez Garcia
@ 2014-09-29 9:42 ` Michael Olbrich
2014-09-29 12:25 ` Jon Ringle
1 sibling, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2014-09-29 9:42 UTC (permalink / raw)
To: ptxdist
On Fri, Sep 26, 2014 at 05:46:51PM -0400, jon@ringle.org wrote:
> From: Jon Ringle <jringle@gridpoint.com>
>
> This is useful if you install a package to /opt and libs are in /opt/lib:
> $(call install_lib, foo, 0, 0, 0644, libfoo, opt/)
Is '/opt' your actual use-case or just an example? I wouldn't mind adding
/opt to the default list.
If not:
> Signed-off-by: Jon Ringle <jringle@gridpoint.com>
> ---
> rules/post/install.make | 4 +++-
> scripts/lib/ptxd_make_xpkg_pkg.sh | 4 +++-
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/rules/post/install.make b/rules/post/install.make
> index d57e5dd..2ff9f40 100644
[...]
> diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
> index 86196a2..501d1fd 100644
> --- a/scripts/lib/ptxd_make_xpkg_pkg.sh
> +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
> @@ -744,9 +744,11 @@ export -f ptxd_install_shared
> ptxd_install_lib() {
> local lib_dir=$(ptxd_get_lib_dir)
> local lib="$1"
> + local root_dir="$2"
> + shift
> shift
local root_dir="${2%/}/"
shift 2
>
> - local file="$(for dir in "${pkg_pkg_dir}/"{,usr/}${lib_dir}; do
> + local file="$(for dir in "${pkg_pkg_dir}/"${root_dir}{,usr/}${lib_dir}; do
local file="$(for dir in "${pkg_pkg_dir}/"${root_dir#/}{,usr/}${lib_dir}; do
So the argument for install_lib can be absolute, and the trailing / is
optional. Maybe even enforce an absolute path for root_dir.
And use root_dir instead of '{,usr/}' and not before it.
Michael
> find "${dir}" -type f -path "${dir}/${lib}.so*"; done 2>/dev/null)"
>
> if [ ! -f "${file}" ]; then
> --
> 1.8.5.4
>
>
> --
> ptxdist mailing list
> ptxdist@pengutronix.de
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir
2014-09-29 9:42 ` Michael Olbrich
@ 2014-09-29 12:25 ` Jon Ringle
2014-09-30 7:53 ` Michael Olbrich
0 siblings, 1 reply; 7+ messages in thread
From: Jon Ringle @ 2014-09-29 12:25 UTC (permalink / raw)
To: ptxdist
[-- Attachment #1.1: Type: text/plain, Size: 2117 bytes --]
On Mon, Sep 29, 2014 at 5:42 AM, Michael Olbrich <m.olbrich@pengutronix.de>
wrote:
> On Fri, Sep 26, 2014 at 05:46:51PM -0400, jon@ringle.org wrote:
> > From: Jon Ringle <jringle@gridpoint.com>
> >
> > This is useful if you install a package to /opt and libs are in /opt/lib:
> > $(call install_lib, foo, 0, 0, 0644, libfoo, opt/)
>
> Is '/opt' your actual use-case or just an example? I wouldn't mind adding
> /opt to the default list.
>
It is just an example. My actual use-case looks like this:
@$(foreach lib, $(GPEC_LIBS), \
$(call install_lib, gpec, 0, 0, 0644, $(lib), opt/gpec/live/);)
where the list of libs in $(GPEC_LIBS) is installed to /opt/gpec/live/lib/
> If not:
>
> > Signed-off-by: Jon Ringle <jringle@gridpoint.com>
> > ---
> > rules/post/install.make | 4 +++-
> > scripts/lib/ptxd_make_xpkg_pkg.sh | 4 +++-
> > 2 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/rules/post/install.make b/rules/post/install.make
> > index d57e5dd..2ff9f40 100644
> [...]
> > diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh
> b/scripts/lib/ptxd_make_xpkg_pkg.sh
> > index 86196a2..501d1fd 100644
> > --- a/scripts/lib/ptxd_make_xpkg_pkg.sh
> > +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
> > @@ -744,9 +744,11 @@ export -f ptxd_install_shared
> > ptxd_install_lib() {
> > local lib_dir=$(ptxd_get_lib_dir)
> > local lib="$1"
> > + local root_dir="$2"
> > + shift
> > shift
>
> local root_dir="${2%/}/"
> shift 2
>
> >
> > - local file="$(for dir in "${pkg_pkg_dir}/"{,usr/}${lib_dir}; do
> > + local file="$(for dir in
> "${pkg_pkg_dir}/"${root_dir}{,usr/}${lib_dir}; do
>
> local file="$(for dir in
> "${pkg_pkg_dir}/"${root_dir#/}{,usr/}${lib_dir}; do
>
With this, is seems that the trailing / after ${pkg_pkg_dir} could be
removed...
>
> So the argument for install_lib can be absolute, and the trailing / is
> optional. Maybe even enforce an absolute path for root_dir.
> And use root_dir instead of '{,usr/}' and not before it.
>
If the '{,/usr}' is removed, then won't that break searching for libs that
might be in /usr/lib/ ?
[-- Attachment #1.2: Type: text/html, Size: 3666 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir
2014-09-29 12:25 ` Jon Ringle
@ 2014-09-30 7:53 ` Michael Olbrich
2014-10-01 5:09 ` Jon Ringle
0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2014-09-30 7:53 UTC (permalink / raw)
To: ptxdist
On Mon, Sep 29, 2014 at 08:25:38AM -0400, Jon Ringle wrote:
> On Mon, Sep 29, 2014 at 5:42 AM, Michael Olbrich <m.olbrich@pengutronix.de>
> wrote:
>
> > On Fri, Sep 26, 2014 at 05:46:51PM -0400, jon@ringle.org wrote:
> > > From: Jon Ringle <jringle@gridpoint.com>
> > >
> > > This is useful if you install a package to /opt and libs are in /opt/lib:
> > > $(call install_lib, foo, 0, 0, 0644, libfoo, opt/)
> >
> > Is '/opt' your actual use-case or just an example? I wouldn't mind adding
> > /opt to the default list.
> >
>
> It is just an example. My actual use-case looks like this:
>
> @$(foreach lib, $(GPEC_LIBS), \
> $(call install_lib, gpec, 0, 0, 0644, $(lib), opt/gpec/live/);)
>
> where the list of libs in $(GPEC_LIBS) is installed to /opt/gpec/live/lib/
Ok.
> > If not:
> >
> > > Signed-off-by: Jon Ringle <jringle@gridpoint.com>
> > > ---
> > > rules/post/install.make | 4 +++-
> > > scripts/lib/ptxd_make_xpkg_pkg.sh | 4 +++-
> > > 2 files changed, 6 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/rules/post/install.make b/rules/post/install.make
> > > index d57e5dd..2ff9f40 100644
> > [...]
> > > diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh
> > b/scripts/lib/ptxd_make_xpkg_pkg.sh
> > > index 86196a2..501d1fd 100644
> > > --- a/scripts/lib/ptxd_make_xpkg_pkg.sh
> > > +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
> > > @@ -744,9 +744,11 @@ export -f ptxd_install_shared
> > > ptxd_install_lib() {
> > > local lib_dir=$(ptxd_get_lib_dir)
> > > local lib="$1"
> > > + local root_dir="$2"
> > > + shift
> > > shift
> >
> > local root_dir="${2%/}/"
> > shift 2
> >
> > >
> > > - local file="$(for dir in "${pkg_pkg_dir}/"{,usr/}${lib_dir}; do
> > > + local file="$(for dir in
> > "${pkg_pkg_dir}/"${root_dir}{,usr/}${lib_dir}; do
> >
> > local file="$(for dir in
> > "${pkg_pkg_dir}/"${root_dir#/}{,usr/}${lib_dir}; do
> >
>
> With this, is seems that the trailing / after ${pkg_pkg_dir} could be
> removed...
>
>
> >
> > So the argument for install_lib can be absolute, and the trailing / is
> > optional. Maybe even enforce an absolute path for root_dir.
> > And use root_dir instead of '{,usr/}' and not before it.
> >
>
> If the '{,/usr}' is removed, then won't that break searching for libs that
> might be in /usr/lib/ ?
how about this (untested, but I thin you get the idea):
rootdir="${root_dir#/}/"
if [ "${root_dir}" != "${root_dir%/}" ]; then
bailout: must be absolute
fi
...
local file="$(for dir in "${pkg_pkg_dir}"${root_dir:-/,/usr/}${lib_dir}; do
...
So either use ${root_dir}/lib or /lib,/usr/lib
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir
2014-09-30 7:53 ` Michael Olbrich
@ 2014-10-01 5:09 ` Jon Ringle
0 siblings, 0 replies; 7+ messages in thread
From: Jon Ringle @ 2014-10-01 5:09 UTC (permalink / raw)
To: ptxdist
[-- Attachment #1.1: Type: text/plain, Size: 784 bytes --]
On Tue, Sep 30, 2014 at 3:53 AM, Michael Olbrich <m.olbrich@pengutronix.de>
wrote:
> On Mon, Sep 29, 2014 at 08:25:38AM -0400, Jon Ringle wrote:
> > On Mon, Sep 29, 2014 at 5:42 AM, Michael Olbrich <
> m.olbrich@pengutronix.de>
> > wrote:
>
> how about this (untested, but I thin you get the idea):
>
> rootdir="${root_dir#/}/"
>
> if [ "${root_dir}" != "${root_dir%/}" ]; then
> bailout: must be absolute
> fi
> ...
> local file="$(for dir in "${pkg_pkg_dir}"${root_dir:-/,/usr/}${lib_dir}; do
>
I was unable to get brace expansion to work properly inside of a variable
substitution.
> ...
>
> So either use ${root_dir}/lib or /lib,/usr/lib
>
The v3 patch I'm sending will search ${root_dir}/lib and
${root_dir}/usr/lib (where ${root_dir} could be an empty string)
Jon
[-- Attachment #1.2: Type: text/html, Size: 1497 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-10-01 5:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26 21:46 [ptxdist] [PATCH] install_dir: Allow one to specify an alternate root dir jon
2014-09-27 9:08 ` Guillermo Rodriguez Garcia
2014-09-27 21:14 ` Jon Ringle
2014-09-29 9:42 ` Michael Olbrich
2014-09-29 12:25 ` Jon Ringle
2014-09-30 7:53 ` Michael Olbrich
2014-10-01 5:09 ` Jon Ringle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox