Re: Lot's of REINPLACE_CMD versus patch
- Reply: Mathieu Arnold : "Re: Lot's of REINPLACE_CMD versus patch"
- In reply to: Mathieu Arnold : "Re: Lot's of REINPLACE_CMD versus patch"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 25 May 2021 06:36:06 UTC
Hello Mathieu, Just a part of .post-install I have the files in directory "config" with 9 REINPLACE_CMDs applied! Isn't better to use patches in this case? one patch for each file with this 9 changes? Thanks Mathieu Arnold <mat@freebsd.org> escreveu no dia terça, 25/05/2021 à(s) 07:28: > On Tue, May 25, 2021 at 07:02:36AM +0100, Nuno Teixeira wrote: > > Hello! > > > > I'm working on a new port that have a lot of REINPLACE_CMDs and I'm > getting > > a lot of warnings saying, e.g.: > > "REINPLACE_CMD ran, but did not modify file contents: > > NsCDE/config/NsCDE-Font-120dpi.conf.bak.bak.bak.bak" > > > > And this waring shows that this particular file was changed four times! > > > > I'm thinking that REINPLACE_CMD is viable to small changes and for this > > port I think that is better change all files manually and then create > > patches with "make makepatch' > > > > What do you think? > > Small changes vs big changes has nothing to do with when to use > REINPLACE_CMD. > As noted in [1], REINPLACE_CMD CAN only be used when replacing some > dynamic content, say, /usr/local -> ${PREFIX}. In all other cases, a > patch MUST be used. > > 1: > https://docs.freebsd.org/en/books/porters-handbook/slow-porting/#slow-patch-automatic-replacements > > > --- > > post-patch: > > ${CP} ${WRKSRC}/NsCDE/libexec/generate_subpanels > > ${WRKSRC}/generate_subpanels > > @${REINPLACE_CMD} -e 's@config/@etc/nscde/@g' > > ${WRKSRC}/generate_subpanels > > ${FIND} ${WRKSRC}/NsCDE/config -type f -exec ${REINPLACE_CMD} > > -e 's@$$\[NSCDE_ROOT\]/share/doc/@'${PREFIX}'/share/doc/nscde/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/config -type f -exec ${REINPLACE_CMD} > > -e 's@$$\[NSCDE_ROOT\]/share/icons/@'${PREFIX}'/share/icons/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/config -type f -exec ${REINPLACE_CMD} > > -e 's@$$\[NSCDE_ROOT\]/share/@'${DATADIR}'/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/config -type f -exec ${REINPLACE_CMD} -e > 's@ > > $$\[NSCDE_ROOT\]/share@'${DATADIR}'@g' {} \; > > ${FIND} ${WRKSRC}/NsCDE/config ${WRKSRC}/NsCDE/lib/scripts -type > f > > -exec ${REINPLACE_CMD} -e > > 's@$$\[NSCDE_ROOT\]/libexec/@'${PREFIX}'/libexec/nscde/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/config -type f -exec ${REINPLACE_CMD} > > -e "s@$$\[NSCDE_ROOT\]/lib/@${PREFIX}/lib/nscde/@g" > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/config ${WRKSRC}/NsCDE/lib/scripts -type > f > > -exec ${REINPLACE_CMD} -e 's@$$\[NSCDE_ROOT\]/bin/@'${PREFIX}'/sbin/@g' > {} > > \; > > ${FIND} ${WRKSRC}/NsCDE/config -type f -exec ${REINPLACE_CMD} > > -e 's@$$\[NSCDE_ROOT\]/config/@'${ETCDIR}'/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/config -type f -exec ${REINPLACE_CMD} > > -e 's@$${NSCDE_ROOT}/share/icons/@'${PREFIX}'/share/icons/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/config -type f -exec ${REINPLACE_CMD} > > -e 's@$${NSCDE_ROOT}/share/@'${DATADIR}'/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/config -type f -exec ${REINPLACE_CMD} > > -e 's@$$NSCDE_ROOT/share/@'${DATADIR}'/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/config -type f -name '*.conf' -exec ${MV} > > {} {}.sample \; > > ${FIND} ${WRKSRC}/NsCDE/bin ${WRKSRC}/NsCDE/lib > > ${WRKSRC}/NsCDE/libexec ${WRKSRC}/NsCDE/config \ > > ${WRKSRC}/NsCDE/share/applications -type f -exec > > ${REINPLACE_CMD} -e 's@$$NSCDE\_ROOT\/bin@'${PREFIX}'/sbin@g' {} \; > > ${FIND} ${WRKSRC}/NsCDE/bin ${WRKSRC}/NsCDE/lib > > ${WRKSRC}/NsCDE/libexec -type f -exec ${REINPLACE_CMD} -e 's@ > > $$NSCDE\_ROOT\/config@'${ETCDIR}'@g' {} \; > > ${FIND} ${WRKSRC}/NsCDE/bin ${WRKSRC}/NsCDE/lib > > ${WRKSRC}/NsCDE/libexec -type f -exec ${REINPLACE_CMD} -e 's@ > > $$NSCDE\_ROOT\/libexec@'${PREFIX}'/libexec/nscde@g' {} \; > > ${FIND} ${WRKSRC}/NsCDE/bin ${WRKSRC}/NsCDE/lib > > ${WRKSRC}/NsCDE/libexec -type f -exec ${REINPLACE_CMD} -e > > 's@$$NSCDE\_ROOT\/lib\/@'${PREFIX}'/lib/nscde/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/bin ${WRKSRC}/NsCDE/lib > > ${WRKSRC}/NsCDE/libexec ${WRKSRC}/NsCDE/share/config_templates \ > > -type f -exec ${REINPLACE_CMD} -e > > 's@$$NSCDE\_ROOT\/share\/icons\/@'${PREFIX}'/share/icons/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/bin ${WRKSRC}/NsCDE/lib > > ${WRKSRC}/NsCDE/libexec ${WRKSRC}/NsCDE/share/config_templates \ > > -type f -exec ${REINPLACE_CMD} -e > > 's@$$NSCDE\_ROOT\/share\/doc\/@'${PREFIX}'/share/doc/nscde/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/bin ${WRKSRC}/NsCDE/lib > > ${WRKSRC}/NsCDE/libexec ${WRKSRC}/NsCDE/share/config_templates \ > > -type f -exec ${REINPLACE_CMD} -e > > 's@$$NSCDE\_ROOT\/share\/@'${DATADIR}'/@g' > > {} \; > > ${FIND} ${WRKSRC}/NsCDE/libexec -type f -exec ${REINPLACE_CMD} -e > > 's@$${NSCDE_ROOT}/share/icons/@'${PREFIX}'/share/icons/@g' {} \; > > ${FIND} ${WRKSRC}/NsCDE/libexec -type f -exec ${REINPLACE_CMD} -e > > 's@$${NSCDE_ROOT}/share/@'${DATADIR}'/@g' {} \; > > ${FIND} ${WRKSRC}/NsCDE/libexec -type f -exec ${REINPLACE_CMD} -e > > 's@$${NSCDE_ROOT}/config/@'${ETCDIR}'/@g' {} \; > > ${FIND} ${WRKSRC}/NsCDE/libexec -type f -exec ${REINPLACE_CMD} -e > > 's@$${NSCDE_ROOT}/libexec/@'${PREFIX}'/libexec/nscde/@g' {} \; > > ${FIND} ${WRKSRC}/NsCDE/libexec -type f -exec ${REINPLACE_CMD} -e > > 's@$${NSCDE_ROOT}/lib/@'${PREFIX}'/lib/nscde/@g' {} \; > > ${WRKSRC}/NsCDE/bin/ised -c 's/\*FrontPanel: \(.*x.*\), Id > > NsCDE-Subpanel\(.*\), Frame 1, PressColorset 27, \\/\*FrontPanel: \1, Id > > NsCDE-Subpanel\2, Frame 1, PressColorset 27, \\\n > > Icon NsCDE\/FPSubArrowUp.xpm, PressIcon NsCDE\/FPSubArrowDown.xpm, \\/g' > -f > > "${WRKSRC}/NsCDE/config/NsCDE-FrontPanel.conf.sample" > > ${FIND} ${WRKSRC}/NsCDE -type f -exec ${REINPLACE_CMD} -e > > 's@^#!/usr/bin/env > > ksh93@#!'${PREFIX}'/bin/ksh93@' {} \; > > ${FIND} ${WRKSRC}/NsCDE -type f -name '*.bak' -delete > > ( for HLP in ${PREFIX_FILES}; do ${REINPLACE_CMD} -e 's@ > $${PREFIX}@ > > '${PREFIX}'@g' ${WRKSRC}/$${HLP}; done ) > > --- > > > > Thanks, > > eduardo > > -- > Mathieu Arnold >