diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2017-11-21 10:49:27 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2017-11-23 14:28:16 +0100 |
commit | d364270362ad40e998abd2d93550d5585148e8e4 (patch) | |
tree | 59f6aa5ea4d0ff9e7811919dd5ad9412e7c270ca | |
parent | 88fd49063f52cb756c4a03a1f124ac879dd25870 (diff) | |
download | ptxdist-d364270362ad40e998abd2d93550d5585148e8e4.tar.gz ptxdist-d364270362ad40e998abd2d93550d5585148e8e4.tar.xz |
scripts: consolidate file URL usage
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | scripts/lib/ptxd_make_world_extract.sh | 6 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_license.sh | 6 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_patchin.sh | 6 | ||||
-rw-r--r-- | scripts/libptxdist.sh | 12 |
4 files changed, 17 insertions, 13 deletions
diff --git a/scripts/lib/ptxd_make_world_extract.sh b/scripts/lib/ptxd_make_world_extract.sh index a4bb98b83..f458f9d1e 100644 --- a/scripts/lib/ptxd_make_world_extract.sh +++ b/scripts/lib/ptxd_make_world_extract.sh @@ -42,11 +42,7 @@ ptxd_make_world_extract() { fi ;; file://*) - local url="${pkg_url//file:\/\//}" - if [[ ! "${url}" =~ ^/ ]]; then - # relative to absolute path - url="${PTXDIST_WORKSPACE}/${url}" - fi + local url="$(ptxd_file_url_path "${pkg_url}")" if [ -d "${url}" ]; then echo "local directory instead of tar file, linking build dir" ln -sf "$(ptxd_abspath "${url}")" "${pkg_dir}" diff --git a/scripts/lib/ptxd_make_world_license.sh b/scripts/lib/ptxd_make_world_license.sh index c82a724be..6fa80fe07 100644 --- a/scripts/lib/ptxd_make_world_license.sh +++ b/scripts/lib/ptxd_make_world_license.sh @@ -484,9 +484,9 @@ ptxd_make_world_release() { mkdir -p ${pkg_release_dir} && # BSP local packages do not have ${pkg_srcs} filled - if [[ -z "${pkg_srcs}" && "${pkg_url}" =~ "file://${PTXDIST_WORKSPACE}" && -f "${pkg_url#file://}" ]]; then + if [[ -z "${pkg_srcs}" && "${pkg_url}" =~ "file://" && -f "$(ptxd_file_url_path "${pkg_url}")" ]]; then # Use the URL for local archives - pkg_srcs="${pkg_url#file://}" + pkg_srcs="$(ptxd_file_url_path "${pkg_url}")" fi if [ -z "${pkg_srcs}" ]; then if [ -z "${pkg_url}" ]; then @@ -494,7 +494,7 @@ ptxd_make_world_release() { # does not work, since some packages (udev for example, refer to systemd and has no own sources) echo "Error: unable to detect source files/archives for package '${pkg_label}'" > "${pkg_release_dir}/source" else - if [[ "${pkg_url}" =~ "file://${PTXDIST_WORKSPACE}" ]]; then + if [[ "${pkg_url}" =~ "file://" ]]; then echo "Note: this package has BSP internal source code" > "${pkg_release_dir}/source" else if [[ "${pkg_url}" =~ "lndir://${PTXDIST_WORKSPACE}" ]]; then diff --git a/scripts/lib/ptxd_make_world_patchin.sh b/scripts/lib/ptxd_make_world_patchin.sh index 57f472130..81537f55a 100644 --- a/scripts/lib/ptxd_make_world_patchin.sh +++ b/scripts/lib/ptxd_make_world_patchin.sh @@ -439,12 +439,8 @@ ptxd_make_world_patchin_init() fi if [[ "${pkg_url}" =~ ^file:// ]]; then - local url="${pkg_url//file:\/\//}" + local url="$(ptxd_file_url_path "${pkg_url}")" # local directories are not intended to be patched - if [[ ! "${url}" =~ ^/ ]]; then - # ensure an absolute path for this BSP relative URL - url="${PTXDIST_WORKSPACE}/${url}" - fi if [ -d "${url}" ]; then echo "Local source directory detected, skipping patch-in step" return diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index ffbe839f5..433d789ea 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -646,6 +646,18 @@ ptxd_abs2rel() { } export -f ptxd_abs2rel +# +# Converts a file URL into an absolute path +# +ptxd_file_url_path() { + local url="${1//file:\/\//}" + if [[ ! "${url}" =~ ^/ ]]; then + # relative to absolute path + url="${PTXDIST_WORKSPACE}/${url}" + fi + echo "${url}" +} +export -f ptxd_file_url_path # # prints a path but removes non interesting prefixes |