From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, Michael Paquier <michael(at)paquier(dot)xyz>, Craig Ringer <craig(dot)ringer(at)enterprisedb(dot)com> |
Subject: | Re: Why do we have perl and sed versions of Gen_dummy_probes? |
Date: | 2021-05-11 19:47:45 |
Message-ID: | 20210511194745.4bbnoutpnllupcwf@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2021-05-11 14:30:10 -0400, Andrew Dunstan wrote:
> On 5/11/21 1:21 PM, Andres Freund wrote:
> > It doesn't work in a VPATH build right now, FWIW. $@, $< will point to a
> > local file in the build directory, right now. And the path to perltidyrc
> > doesn't work either. It seems to work after the following modifications
> >
> > diff --git i/src/backend/utils/Makefile w/src/backend/utils/Makefile
> > index bcf9dd41adf..ca733d12dce 100644
> > --- i/src/backend/utils/Makefile
> > +++ w/src/backend/utils/Makefile
> > @@ -92,10 +92,10 @@ $(top_builddir)/src/include/utils/probes.h: probes.h
> > # Nothing depends on it, so it will never be called unless explicitly requested
> > # The last two lines of the recipe format the script according to our
> > # standard and put back some blank lines for improved readability.
> > -Gen_dummy_probes.pl: Gen_dummy_probes.sed
> > +$(top_srcdir)/src/backend/utils/Gen_dummy_probes.pl: $(top_srcdir)/src/backend/utils/Gen_dummy_probes.sed
> > perl -ni -e ' print; exit if /^\$$0/;' $@
> > s2p -f $< | sed -e 1,4d -e '/# #/d' -e '$$d' >> $@
> > - perltidy --profile=../../tools/pgindent/perltidyrc $@
> > + perltidy --profile=$(top_srcdir)/src/tools/pgindent/perltidyrc $@
> > perl -pi -e '!$$lb && ( /^\t+#/ || /^# prototypes/ ) && print qq{\n};'\
> > -e '$$lb = m/^\n/; ' $@
> >
>
>
> Yeah, but this will create the perl file in the vpath directory where it
> won't ever be used anyway. You really want this back in the source
> directory where you can check it in etc.
Hm, why would it? Both $< and $@ will be in the source tree, as
formulated above?
andres(at)awork3:~/src/postgresql$ git diff src/backend/utils/Gen_dummy_probes.pl
andres(at)awork3:~/src/postgresql$ echo foo >> src/backend/utils/Gen_dummy_probes.pl
andres(at)awork3:~/src/postgresql$ git diff src/backend/utils/Gen_dummy_probes.pl
diff --git i/src/backend/utils/Gen_dummy_probes.pl w/src/backend/utils/Gen_dummy_probes.pl
index 4852103daf4..1b724bf1038 100644
--- i/src/backend/utils/Gen_dummy_probes.pl
+++ w/src/backend/utils/Gen_dummy_probes.pl
@@ -257,3 +257,4 @@ sub printQ()
}
undef(@Q);
}
+foo
andres(at)awork3:~/src/postgresql$ touch src/backend/utils/Gen_dummy_probes.sed && make -C /home/andres/build/postgres/dev-assert/vpath/src/backend/utils Gen_dummy_probes.pl
perl -ni -e ' print; exit if /^\$0/;' /home/andres/src/postgresql/src/backend/utils/Gen_dummy_probes.pl
s2p -f /home/andres/src/postgresql/src/backend/utils/Gen_dummy_probes.sed | sed -e 1,4d -e '/# #/d' -e '$d' >> /home/andres/src/postgresql/src/backend/utils/Gen_dummy_probes.pl
perltidy --profile=/home/andres/src/postgresql/src/tools/pgindent/perltidyrc /home/andres/src/postgresql/src/backend/utils/Gen_dummy_probes.pl
perl -pi -e '!$lb && ( /^\t+#/ || /^# prototypes/ ) && print qq{\n};'\
-e '$lb = m/^\n/; ' /home/andres/src/postgresql/src/backend/utils/Gen_dummy_probes.pl
andres(at)awork3:~/src/postgresql$ git diff src/backend/utils/Gen_dummy_probes.pl
andres(at)awork3:~/src/postgresql$ ls /home/andres/build/postgres/dev-assert/vpath/src/backend/utils/Gen_dummy_probes*
/home/andres/build/postgres/dev-assert/vpath/src/backend/utils/Gen_dummy_probes.pl.tdy
So only a temp file ends up in the build dir?
> I came up with this:
>
>
> Gen_dummy_probes.pl: $(top_srcdir)/$(subdir)/Gen_dummy_probes.sed $(top_srcdir)/$(subdir)/Gen_dummy_probes.pl.prolog
> cp $(top_srcdir)/$(subdir)/Gen_dummy_probes.pl.prolog $(top_srcdir)/$(subdir)/$@
> s2p -f $< | sed -e 1,3d -e '/# #/ d' -e '$$d' >> $(top_srcdir)/$(subdir)/$@
> perltidy --profile=$(top_srcdir)/$(subdir)/../../tools/pgindent/perltidyrc $(top_srcdir)/$(subdir)/$@
> perl -pi -e '!$$lb && ( /^\t+#/ || /^# prototypes/ ) && print qq{\n};'\
> -e '$$lb = m/^\n/; ' $(top_srcdir)/$(subdir)/$@
>
>
> I'm not aware of any other case where we generate an in-tree file from a
> vpath, which is why it feels strange.
Yea, it is a bit odd, agreed. We don't have many generated sources
inside the git repo (vs in the tarball). The most prominent one is
configure, obviously...
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-05-11 19:51:39 | Re: PG 14 release notes, first draft |
Previous Message | Daniel Gustafsson | 2021-05-11 19:47:22 | Re: Let's get rid of serial_schedule |