Re: bsd.port.mk: fix update-patches target to honor user reply
On Sat, Jun 09 2018, Klemens Nanni wrote: > On Fri, Jun 08, 2018 at 11:55:45PM +0200, Jeremie Courreges-Anglas wrote: >> I'd prefer: >> >> if [ "$$REPLY" != N ]; then \ >> >> so that by default we keep the current behavior. I think it's good to >> push people to check patch comments that might not be accurate any more. > Fair point. > > I went for 'n' so the capital yes equivalent indicates the default reply. ok jca@ > Index: bsd.port.mk > === > RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v > retrieving revision 1.1414 > diff -u -p -r1.1414 bsd.port.mk > --- bsd.port.mk 4 Jun 2018 06:14:56 - 1.1414 > +++ bsd.port.mk 8 Jun 2018 22:30:32 - > @@ -2362,11 +2362,12 @@ update-patches: > PATCH_LIST='${PATCH_LIST}' DIFF_ARGS='${DIFF_ARGS}' \ > DISTORIG=${DISTORIG} PATCHORIG=${PATCHORIG} \ > ${_PERLSCRIPT}/update-patches`; \ > - case $$toedit in "");; \ > - *) read i?'edit patches: '; \ > - cd ${PATCHDIR} && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit;; esac > - > - > + if [ -n "$$toedit" ]; then \ > + read -r REPLY?'edit patches? [Yn]: '; \ > + if [ "$$REPLY" != n ]; then \ > + cd ${PATCHDIR} && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} > $$toedit; \ > + fi; \ > + fi > > .endif # IGNORECMD > > -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: bsd.port.mk: fix update-patches target to honor user reply
On Fri, Jun 08, 2018 at 11:55:45PM +0200, Jeremie Courreges-Anglas wrote: > I'd prefer: > > if [ "$$REPLY" != N ]; then \ > > so that by default we keep the current behavior. I think it's good to > push people to check patch comments that might not be accurate any more. Fair point. I went for 'n' so the capital yes equivalent indicates the default reply. Index: bsd.port.mk === RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v retrieving revision 1.1414 diff -u -p -r1.1414 bsd.port.mk --- bsd.port.mk 4 Jun 2018 06:14:56 - 1.1414 +++ bsd.port.mk 8 Jun 2018 22:30:32 - @@ -2362,11 +2362,12 @@ update-patches: PATCH_LIST='${PATCH_LIST}' DIFF_ARGS='${DIFF_ARGS}' \ DISTORIG=${DISTORIG} PATCHORIG=${PATCHORIG} \ ${_PERLSCRIPT}/update-patches`; \ - case $$toedit in "");; \ - *) read i?'edit patches: '; \ - cd ${PATCHDIR} && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit;; esac - - + if [ -n "$$toedit" ]; then \ + read -r REPLY?'edit patches? [Yn]: '; \ + if [ "$$REPLY" != n ]; then \ + cd ${PATCHDIR} && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit; \ + fi; \ + fi .endif # IGNORECMD
Re: bsd.port.mk: fix update-patches target to honor user reply
On Fri, Jun 08 2018, Klemens Nanni wrote: > The following diff makes `update-patches' ask for 'y' or 'N', accept > nothing but 'y' as valid confirmation to open the editor and exit > cleanly otherwise. > > Current behaviour is to prompt anything out of the blue and treat every > reply as confirmation to run an editor on updated patches. The only way > to get away without editing is ^C (which still updates patches > successfully but returns 1 anyway). > > Someone mentioned a make variable as user knob to override this > behaviour (unconditionally?); If at all, I'd like to handle this > separately. > > Feedback? OK? > > Index: bsd.port.mk > === > RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v > retrieving revision 1.1414 > diff -u -p -r1.1414 bsd.port.mk > --- bsd.port.mk 4 Jun 2018 06:14:56 - 1.1414 > +++ bsd.port.mk 8 Jun 2018 21:02:37 - > @@ -2362,11 +2362,12 @@ update-patches: > PATCH_LIST='${PATCH_LIST}' DIFF_ARGS='${DIFF_ARGS}' \ > DISTORIG=${DISTORIG} PATCHORIG=${PATCHORIG} \ > ${_PERLSCRIPT}/update-patches`; \ > - case $$toedit in "");; \ > - *) read i?'edit patches: '; \ > - cd ${PATCHDIR} && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit;; esac > - > - > + if [ -n "$$toedit" ]; then \ > + read -r REPLY?'edit patches? [yN]: '; \ > + if [ "$$REPLY" = y ]; then \ I'd prefer: if [ "$$REPLY" != N ]; then \ so that by default we keep the current behavior. I think it's good to push people to check patch comments that might not be accurate any more. > + cd ${PATCHDIR} && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} > $$toedit; \ > + fi; \ > + fi > > .endif # IGNORECMD > > -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE