From cdb8b49f5ddf0ed8aa0b5d337953d10ce245c369 Mon Sep 17 00:00:00 2001 From: Jon-Paul Sullivan Date: Fri, 28 Mar 2014 18:06:28 +0000 Subject: [PATCH] Standardise manifest creation and retrieval Bring in line with the manifest standardisation in review I37eff5a13a14564e1adc33eb4f0144d571267617 This: * Removes the pip-manifest cleanup script and corresponding README documentation * Adds a dependency on the manifests element * Uses the manifests element for manifest location and copy to build area * Standardises the manifest naming Change-Id: I8ab0796a8e19419bf40c1ebc94a7eb04e3ba9180 --- elements/pip-manifest/README.md | 6 ------ elements/pip-manifest/bin/get-pip-manifest | 3 ++- elements/pip-manifest/bin/write-pip-manifest | 4 +++- elements/pip-manifest/element-deps | 1 + .../15-pip-manifests} | 8 ++------ .../pip-manifest/extra-data.d/75-inject-pip-manifests | 5 ++--- 6 files changed, 10 insertions(+), 17 deletions(-) create mode 100644 elements/pip-manifest/element-deps rename elements/pip-manifest/{cleanup.d/01-copy-pip-manifests => environment.d/15-pip-manifests} (75%) diff --git a/elements/pip-manifest/README.md b/elements/pip-manifest/README.md index 351968e29..b7c53881d 100644 --- a/elements/pip-manifest/README.md +++ b/elements/pip-manifest/README.md @@ -55,9 +55,3 @@ into the image chroot environment. ### 01-pip-manifest Installs the scripts in this element into the image for later use by other elements. -## cleanup.d - -### 01-copy-pip-manifests -Runs outside of the chroot and copies created manifests back to the -build environment for re-use in repeating the image build. - diff --git a/elements/pip-manifest/bin/get-pip-manifest b/elements/pip-manifest/bin/get-pip-manifest index bf52eb658..464c42053 100755 --- a/elements/pip-manifest/bin/get-pip-manifest +++ b/elements/pip-manifest/bin/get-pip-manifest @@ -18,7 +18,8 @@ set -eux name=${1:?"Usage: ${0} "} -build_manifest=/etc/dib-pip-manifests/dib-pip-build-manifest-${name//[^A-Za-z0-9]/_} + +build_manifest=${DIB_MANIFEST_PIP_DIR}/dib-pip-build-manifest-${name//[^A-Za-z0-9]/_} if [[ -f "${build_manifest}" ]]; then echo "${build_manifest}" diff --git a/elements/pip-manifest/bin/write-pip-manifest b/elements/pip-manifest/bin/write-pip-manifest index 3c8c1bfda..cf041477e 100755 --- a/elements/pip-manifest/bin/write-pip-manifest +++ b/elements/pip-manifest/bin/write-pip-manifest @@ -19,4 +19,6 @@ set -eux name=${1:?"Usage: ${0} "} -pip freeze -l | tee /etc/dib-pip-manifests/dib-pip-manifest-${name//[^A-Za-z0-9]/_} +manifest_name=dib-manifest-pip-${name//[^A-Za-z0-9]/_} + +pip freeze -l | tee ${DIB_MANIFEST_PIP_DIR}/${manifest_name} diff --git a/elements/pip-manifest/element-deps b/elements/pip-manifest/element-deps new file mode 100644 index 000000000..c890ea152 --- /dev/null +++ b/elements/pip-manifest/element-deps @@ -0,0 +1 @@ +manifests diff --git a/elements/pip-manifest/cleanup.d/01-copy-pip-manifests b/elements/pip-manifest/environment.d/15-pip-manifests similarity index 75% rename from elements/pip-manifest/cleanup.d/01-copy-pip-manifests rename to elements/pip-manifest/environment.d/15-pip-manifests index 77314005c..fe5c80bcd 100755 --- a/elements/pip-manifest/cleanup.d/01-copy-pip-manifests +++ b/elements/pip-manifest/environment.d/15-pip-manifests @@ -15,10 +15,6 @@ # License for the specific language governing permissions and limitations # under the License. # -set -eux +set -eu -if [ -d $TMP_MOUNT_PATH/etc/dib-pip-manifests ]; then - mkdir -p ${IMAGE_NAME}-manifests - cp --no-preserve=ownership -rv $TMP_MOUNT_PATH/etc/dib-pip-manifests \ - ${IMAGE_NAME}-manifests/ -fi +export DIB_MANIFEST_PIP_DIR=${DIB_MANIFEST_PIP_DIR:-${DIB_MANIFEST_IMAGE_DIR}/dib-manifests-pip} diff --git a/elements/pip-manifest/extra-data.d/75-inject-pip-manifests b/elements/pip-manifest/extra-data.d/75-inject-pip-manifests index 20f80bd68..4aa826b41 100755 --- a/elements/pip-manifest/extra-data.d/75-inject-pip-manifests +++ b/elements/pip-manifest/extra-data.d/75-inject-pip-manifests @@ -17,11 +17,10 @@ # set -eux -dib_pip_manifest_dir=$TMP_MOUNT_PATH/etc/dib-pip-manifests -sudo mkdir $dib_pip_manifest_dir +sudo mkdir -p $TMP_MOUNT_PATH/$DIB_MANIFEST_PIP_DIR # Find all of the pip manifests and copy them into the image for use in install.d for manifest in ${!DIB_PIP_MANIFEST_*} do - sudo cp ${!manifest} $dib_pip_manifest_dir/dib-pip-build-manifest-${manifest##DIB_PIP_MANIFEST_} + sudo cp ${!manifest} $TMP_MOUNT_PATH/$DIB_MANIFEST_PIP_DIR/dib-pip-build-manifest-${manifest##DIB_PIP_MANIFEST_} done