diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2016-05-01 17:37:02 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2016-05-26 08:15:08 +0200 |
commit | 75e60fe045c7961f374965034aab15cf16f19d6f (patch) | |
tree | 7881721836565b476021e4c09b6f20f3a6f9bf00 | |
parent | 5efcadb3dc32132b3ea73035ecd617c9e7ac873c (diff) | |
download | ptxdist-75e60fe045c7961f374965034aab15cf16f19d6f.tar.gz ptxdist-75e60fe045c7961f374965034aab15cf16f19d6f.tar.xz |
install: add new 'install_glob' command
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | rules/post/install.make | 28 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_xpkg_pkg.sh | 36 |
2 files changed, 61 insertions, 3 deletions
diff --git a/rules/post/install.make b/rules/post/install.make index 7da3f0406..c40e36eb6 100644 --- a/rules/post/install.make +++ b/rules/post/install.make @@ -185,6 +185,34 @@ install_archive = \ echo "ptxd_install_archive '$$DIR' '$$DST' '$$OWN' '$$GRP'" >> "$(STATEDIR)/$$XPKG.cmds" # +# install_glob +# +# Installs all files and subdirectories with user/group ownership and +# permissions via fakeroot. +# +# +# $1: xpkg label +# $2: OWN, use '-' to use the real UID of each file/directory +# $3: GID, use '-' to use the real GID of each file/directory +# $4: the toplevel directory, or "-": to use $(PKG_PKGDIR)/$destination +# $5: the target directory. +# $6: the search patterns for 'find -path' +# $7: the search patterns for '! find -path' +# $8: strip +# +install_glob = \ + XPKG=$(subst _,-,$(strip $(1))); \ + OWN=$(strip $(2)); \ + GRP=$(strip $(3)); \ + DIR=$(strip $(4)); \ + DST=$(strip $(5)); \ + YGLOB="$(strip $(6))"; \ + NGLOB="$(strip $(7))"; \ + STRIP=$(strip $(8)); \ + $(call install_check, install_tree); \ + echo "ptxd_install_glob '$$DIR' '$$DST' '$$YGLOB' '$$NGLOB' '$$OWN' '$$GRP' '$$STRIP'" >> "$(STATEDIR)/$$XPKG.cmds" + +# # install_spec # # Installs files specified by a spec file diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh index 3122d7236..50c9c3998 100644 --- a/scripts/lib/ptxd_make_xpkg_pkg.sh +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh @@ -574,16 +574,21 @@ ptxd_install_find() { local strip="${5}" local -a dirs ndirs pdirs sdirs ddirs local mod_nfs mod_rw + if [ -z "${glob}" ]; then + local glob="-o -print" + fi ptxd_install_setup_src && test -d "${src}" && - find "${src}" -path "*/.svn" -prune -o -path "*/.git" -prune -o \ - -path "*/.pc" -prune -o -path "*/CVS" -prune -o \ - ! -path "${src}" -print | while read file; do + find "${src}" ! -path "${src}" -a \( \ + -path "*/.svn" -prune -o -path "*/.git" -prune -o \ + -path "*/.pc" -prune -o -path "*/CVS" -prune \ + ${glob} \) | while read file; do local dst_file="${dst}${file#${src}}" ptxd_install_generic "${file}" "${dst_file}" "${usr}" "${grp}" "${strip}" || return done + check_pipe_status } export -f ptxd_install_find @@ -597,6 +602,31 @@ ptxd_install_tree() { } export -f ptxd_install_tree +ptxd_install_glob() { + local cmd="file" + local src="${1}" + local dst="${2}" + local yglob=( ${3} ) + local nglob=( ${4} ) + local glob + + if [ -n "${3}" ]; then + yglob=( "${yglob[@]/#/-o -path }" ) + glob="${yglob[*]/%/ -print }" + else + glob="-o -print" + fi + if [ -n "${4}" ]; then + nglob=( "${nglob[@]/#/-o -path }" ) + glob="${nglob[*]/%/ -prune } ${glob}" + fi + shift 4 + + ptxd_install_find "${src}" "${dst}" "$@" || + ptxd_install_error "install_glob failed!" +} +export -f ptxd_install_glob + ptxd_install_alternative_tree() { local cmd="alternative" local src="${1}" |