-
Notifications
You must be signed in to change notification settings - Fork 3
Relocate all text files with hard-coded build paths #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ export PATH=$WORK_DIR/wrapper-scripts:$PATH | |
| # the bits script itself | ||
| # | ||
| # - ARCHITECTURE | ||
| # - BITS_SCRIPT_DIR | ||
| # - BUILD_REQUIRES | ||
| # - CACHED_TARBALL | ||
| # - CAN_DELETE | ||
|
|
@@ -212,27 +213,21 @@ EOF | |
|
|
||
| cd "$WORK_DIR/INSTALLROOT/$PKGHASH/$PKGPATH" | ||
| # Find which files need relocation. | ||
| { grep -I -H -l -R "\(INSTALLROOT/$PKGHASH\|[@][@]PKGREVISION[@]$PKGHASH[@][@]\)" . || true; } | sed -e 's|^\./||' > "$INSTALLROOT/.original-unrelocated" | ||
| { grep -I -H -l -R "\($WORK_DIR\|[@][@]PKGREVISION[@]$PKGHASH[@][@]\)" . || true; } | sed -e 's|^\./||' > "$INSTALLROOT/etc/profile.d/.bits-relocate" | ||
|
|
||
| # Relocate script for <arch>/<pkgname>/<pkgver> structure | ||
| cat > "$INSTALLROOT/relocate-me.sh" <<EoF | ||
| #!/bin/bash -e | ||
| if [[ "\$WORK_DIR" == '' ]]; then | ||
| echo 'Please, define \$WORK_DIR' | ||
| exit 1 | ||
| fi | ||
|
|
||
| cat > "$INSTALLROOT/etc/profile.d/.bits-pkginfo" <<EoF | ||
| OP=${PKGPATH} | ||
| PP=\${PKGPATH:-${PKGPATH}} | ||
| PH=${PKGHASH} | ||
| PKG_DIR="$WORK_DIR" | ||
| EoF | ||
|
|
||
| while read -r unrelocated; do | ||
| echo "sed -e \"s|/[^ ;:]*INSTALLROOT/\$PH/\$OP|\$WORK_DIR/\$PP|g; s|[@][@]PKGREVISION[@]\$PH[@][@]|$PKGREVISION|g\"" \ | ||
| "\$PP/$unrelocated.unrelocated > \$PP/$unrelocated" | ||
| done < "$INSTALLROOT/.original-unrelocated" >> "$INSTALLROOT/relocate-me.sh" | ||
| cp "${BITS_SCRIPT_DIR}/relocate-me.sh" "$INSTALLROOT/" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in #75 |
||
|
|
||
| # Always relocate the modulefile (if present) so that it works also in devel mode. | ||
| if [[ ! -s "$INSTALLROOT/.original-unrelocated" && -f "$INSTALLROOT/etc/modulefiles/$PKGNAME" ]]; then | ||
| if [[ ! -s "$INSTALLROOT/etc/profile.d/.bits-relocate" && -f "$INSTALLROOT/etc/modulefiles/$PKGNAME" ]]; then | ||
| echo "mv -f \$PP/etc/modulefiles/$PKGNAME \$PP/etc/modulefiles/${PKGNAME}.forced-relocation && sed -e \"s|[@][@]PKGREVISION[@]\$PH[@][@]|$PKGREVISION|g\" \$PP/etc/modulefiles/${PKGNAME}.forced-relocation > \$PP/etc/modulefiles/$PKGNAME" >> "$INSTALLROOT/relocate-me.sh" | ||
| fi | ||
|
|
||
|
|
@@ -289,7 +284,6 @@ EOF | |
| fi | ||
|
|
||
| cat "$INSTALLROOT/relocate-me.sh" | ||
| cat "$INSTALLROOT/.original-unrelocated" | xargs -n1 -I{} cp '{}' '{}'.unrelocated | ||
| fi | ||
| cd "$WORK_DIR/INSTALLROOT/$PKGHASH" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash -e | ||
| THISDIR="$(cd -P "$(dirname "$0")" && pwd)" | ||
| source ${THISDIR}/etc/profile.d/.bits-pkginfo | ||
| INSTALL_BASE=$(echo $THISDIR | sed "s|/$PP$||") | ||
| if [[ -s ${THISDIR}/etc/profile.d/.bits-relocate ]] ; then | ||
| for f in $(cat ${THISDIR}/etc/profile.d/.bits-relocate) ; do | ||
| sed -i -e "s|${PKG_DIR}/INSTALLROOT/$PH|$INSTALL_BASE|g;s|${PKG_DIR}|$INSTALL_BASE|g" "${THISDIR}/$f" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in #75 |
||
| done | ||
| fi | ||
| sed -i -e "s|^PKG_DIR=.*|PKG_DIR="${INSTALL_BASE}"|" $THISDIR/etc/profile.d/.bits-pkginfo | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why $WORK_DIR and not
INSTALLROOT/$PKGHASH?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INSTALLROOT/$PKGHASHis for the package itself but the whole idea of this change was to find all text files which has$WORKDIR(note that this will also match files withINSTALLROOT/$PKGHASHas it is under$WORKDIRdirectory ... right?) in them. If we search forINSTALLROOT/$PKGHASHthen we might miss those text files which have hard coded paths of package dependencies ( e.g.root-config)