Skip to content
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

Allow overlay to reinstate a port. #772

Closed
wants to merge 1 commit into from
Closed

Conversation

web-sst
Copy link
Contributor

@web-sst web-sst commented Aug 18, 2020

This update allows an overlay to reinstate a port with a MOVED entry. It applies the following convention to reinstate a deleted origin:

old name (blank for reinstated)|new name|date of move|reason

MOVED files from overlays are effectively appended to the MOVED file from the base repo. This is possibly incorrect for any use except simple reinstatement.

@@ -7060,8 +7060,13 @@ load_moved() {
[ -f ${MASTERMNT}${PORTSDIR}/MOVED ] || return 0
msg "Loading MOVED for ${MASTERMNT}${PORTSDIR}"
bset status "loading_moved:"
awk -f ${AWKPREFIX}/parse_MOVED.awk \
${MASTERMNT}${PORTSDIR}/MOVED | \
{ cat ${MASTERMNT}${PORTSDIR}/MOVED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a local o at the top of the function to avoid leaking $o

awk -f ${AWKPREFIX}/parse_MOVED.awk \
${MASTERMNT}${PORTSDIR}/MOVED | \
{ cat ${MASTERMNT}${PORTSDIR}/MOVED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can avoid calling cat with a variable. And should fixup quoting since touching this.

local movedfiles

movedfiles="${MASTERMNT}${PORTSDIR}/MOVED"
for o in ${OVERLAYS}; do
                 test -f "${MASTERMNT}${OVERLAYSDIR}/${o}/MOVED" || continue
                 movedfiles="${movedfiles} ${MASTERMNT}${OVERLAYSDIR}/${o}/MOVED"
done
awk -f ${AWKPREFIX}/parse_MOVED.awk ${movedfiles} | \
...

I doubt we would hit the command line argument limit here but if we do then this pattern would be more efficient

{
echo file1
for o; do
echo $o
done
} | xargs cat | awk -f ...

Best to avoid fork/exec if possible.

@web-sst web-sst mentioned this pull request Sep 7, 2020
@web-sst
Copy link
Contributor Author

web-sst commented Sep 7, 2020

Replaced by #783

@web-sst web-sst closed this Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants