Page MenuHomeFreeBSD

smart_makepatch.sh: Quote PATCH_WRKSRC when regenerating patches.
ClosedPublic

Authored by rakuco on Jan 21 2016, 10:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 30 2024, 10:16 AM
Unknown Object (File)
Dec 14 2023, 5:28 AM
Unknown Object (File)
Dec 9 2023, 1:32 AM
Unknown Object (File)
Dec 4 2023, 7:12 AM
Unknown Object (File)
Dec 3 2023, 9:06 PM
Unknown Object (File)
Nov 18 2023, 2:18 PM
Unknown Object (File)
Nov 18 2023, 2:18 PM
Unknown Object (File)
Nov 18 2023, 2:18 PM
Subscribers

Details

Summary

Put ${PATCH_WRSKRC} within quotes so that expanding it works properly when it contains spaces.

Test Plan

make makepatch in audio/quimup.

Before:

% make -dl makepatch                   
/usr/bin/env WRKDIR=/usr/local/poudriere/ports/default/audio/quimup/work PATCHDIR=/usr/local/poudriere/ports/default/audio/quimup/files  PATCH_WRKSRC=/usr/local/poudriere/ports/default/audio/quimup/work/quimup\ 1.4.0  STRIP_COMPONENTS="
0"  /bin/sh /home/rakuco/ports/Mk/Scripts/smart_makepatch.sh
cd: too many arguments
cd: too many arguments

With this change everything works as expected and I don't end up with an empty files/ directory.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rakuco retitled this revision from to smart_makepatch.sh: Quote PATCH_WRKSRC when regenerating patches..
rakuco updated this object.
rakuco edited the test plan for this revision. (Show Details)
rakuco added reviewers: portmgr, marino.
rakuco set the repository for this revision to rP FreeBSD ports repository.
marino edited edge metadata.

it's okay by me. danfe@ sent me something similar by email (more expansive perhaps?)

mat added a reviewer: mat.
This revision is now accepted and ready to land.Jan 21 2016, 10:22 AM
This revision was automatically updated to reflect the committed changes.
danfe added a subscriber: danfe.

John asked to me move my own patch over here. :-(

Committed version was incomplete, quoting only two cd arguments out of five. This is inconsistent and confusing to the reader, not to mention that ${PATCHDIR} might contain spaces as well.

Index: /usr/ports/Mk/Scripts/smart_makepatch.sh
===================================================================
--- /usr/ports/Mk/Scripts/smart_makepatch.sh	(revision 407796)
+++ /usr/ports/Mk/Scripts/smart_makepatch.sh	(working copy)
@@ -67,7 +67,7 @@
 
 patchdir_files_list() {
 	if [ -d "${PATCHDIR}" ]; then
-		(cd ${PATCHDIR} && \
+		(cd "${PATCHDIR}" && \
 			find * -type f -name "patch-*" -maxdepth 0 \
 			2>/dev/null | sed -e '/\.orig$/d'
 		)
@@ -100,7 +100,7 @@
 	local P
 	local t
 	for P in ${old_patch_list}; do
-		target=$(cd ${PATCHDIR} && \
+		target=$(cd "${PATCHDIR}" && \
 			grep "^+++ " ${P} | awk '{print $2}'
 		)
 		# For single patches, we honor previous separators, but use
@@ -215,7 +215,7 @@
 	local P
 	local name
 	local patch_list
-	patch_list=$(cd ${REGENNED} && find * -name "patch-*" 2>/dev/null)
+	patch_list=$(cd "${REGENNED}" && find * -name "patch-*" 2>/dev/null)
 	for P in ${patch_list}; do
 		name=$(get_patch_name ${P})
 		[ -e ${COMMENTS}/${P} ] && cat ${COMMENTS}/${P} \
This revision is now accepted and ready to land.Feb 2 2016, 7:10 AM

I also approve this change (revision is already approved so I can only say this is comments)

Alexey, are you going to land your update to this patch?

Do by "Land your update" you mean "commit it"? I can do it any time, I was just thinking that perhaps a nod from portmgr@ is in order (no matter how stupid it might look in this particular case).

Yes, that's what I meant.

@mat: perhaps you can sign off again?

I have D13970 going on cleaning things up, this should be part of it.