Обсуждение: tydedef extraction - back to the future
Many years ago we in effect moved maintenance of the typedefs list for pgindent into the buildfarm client. The reason was that there were a number of typedefs that were platform dependent, so we wanted to have coverage across a number of platforms to get a comprehensive list. Lately, this has caused some dissatisfaction, with people wanting the logic for this moved back into core code, among other reasons so we're not reliant on one person - me - for changes. I share this dissatisfaction. Indeed, IIRC the use of the buildfarm was originally intended as something of a stopgap. Still, we do need to multi-platform support. Attached is an attempt to thread this needle. The core is a new perl module that imports the current buildfarm client logic. The intention is that once we have this, the buildfarm client will switch to using the module (if found) rather than its own built-in logic. There is precedent for this sort of arrangement (AdjustUpgrade.pm). Accompanying the new module is a standalone perl script that uses the new module, and replaces the current shell script (thus making it more portable). One thing this is intended to provide for is getting typedefs for non-core code such as third party extensions, which isn't entirely difficult (<https://adpgtech.blogspot.com/2015/05/running-pgindent-on-non-core-code-or.html>) but it's not as easy as it should be either. Comments welcome. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com
Вложения
Andrew Dunstan <andrew@dunslane.net> writes: > Attached is an attempt to thread this needle. The core is a new perl > module that imports the current buildfarm client logic. The intention is > that once we have this, the buildfarm client will switch to using the > module (if found) rather than its own built-in logic. There is precedent > for this sort of arrangement (AdjustUpgrade.pm). Accompanying the new > module is a standalone perl script that uses the new module, and > replaces the current shell script (thus making it more portable). Haven't read the code in detail, but +1 for concept. A couple of minor quibbles: * Why not call the wrapper script "find_typedefs"? Without the "s" it seems rather confusing --- "which typedef is this supposed to find, exactly?" * The header comment for sub typedefs seems to have adequate detail about what the arguments are, but that all ought to be propagated into the --help output for the wrapper script. Right now you couldn't figure out how to use the wrapper without reading the underlying module. regards, tom lane
On 20.05.24 23:11, Andrew Dunstan wrote: > Attached is an attempt to thread this needle. The core is a new perl > module that imports the current buildfarm client logic. The intention is > that once we have this, the buildfarm client will switch to using the > module (if found) rather than its own built-in logic. There is precedent > for this sort of arrangement (AdjustUpgrade.pm). Accompanying the new > module is a standalone perl script that uses the new module, and > replaces the current shell script (thus making it more portable). It looks like this code could use a bit of work to modernize and clean up cruft, such as + my $sep = $using_msvc ? ';' : ':'; This can be done with File::Spec. + next if $bin =~ m!bin/(ipcclean|pltcl_)!; Those are long gone. + next if $bin =~ m!/postmaster.exe$!; # sometimes a copy not a link Also gone. + elsif ($using_osx) + { + # On OS X, we need to examine the .o files Update the name. + # exclude ecpg/test, which pgindent does too + my $obj_wanted = sub { + /^.*\.o\z/s + && !($File::Find::name =~ m!/ecpg/test/!s) + && push(@testfiles, $File::Find::name); + }; + + File::Find::find($obj_wanted, $binloc); + } Not clear why this is specific to that platform. Also, some instructions should be provided. It looks like this is meant to be run on the installation tree? A README and/or a build target would be good. The code distinguishes between srcdir and bindir, but it's not clear what the latter is. It rather looks like the installation prefix. Does this code support out of tree builds? This should be cleared up.