-
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
Conversation
| 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" |
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/$PKGHASH is 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 with INSTALLROOT/$PKGHASH as it is under $WORKDIR directory ... right?) in them. If we search for INSTALLROOT/$PKGHASH then we might miss those text files which have hard coded paths of package dependencies ( e.g. root-config)
| 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/" |
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.
Maybe we should use install, to make sure the copied file has the right mode?
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.
done in #75
| 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" |
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.
-i should take an argument (the extension of the unmodified file) and the backup file should be deleted afterwards.
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.
done in #75
|
Merging once the last test rerun completes. Please consider the comments and see if anything applies for some further PR. |
This PR proposes the following changes
etc/profile.d/.bits-relocatefile int he package contains the list of all text files with hard-coded build pathetc/profile.d/.bits-pkginfocontaine the package information e.g. it now contains the package build directory path which can be used to properly relocate all text files.etc/profile.d/.bits-pkginfoso there is no need to keep the extra*.unrelocatedcopies of files to be relocatedI have tested this using dummy packages by building/uploading them from different build directory and it has properly relocated the text files [a-d]. I will run more tests e.g. building few externals with long dependency chain
[a] Building/uploading pkg1 (hich depemnds on pkg0) in PKG1 directory
[b] Building/uploading pkg2 (hich depends on pkg1, so downloaded the prebuild binaries) in PKG2 directory
[c] Building/uploading pkg3 (hich depends on pkg2, so downloaded the prebuild binaries) in PKG3 directory
[d]
bin/pkg-configin each package contains paths to its dependencies which were properly relocated