Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jrszY-0005SK-OR for pljava-dev@arkaria.postgresql.org; Sun, 05 Jul 2020 00:58:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jrszV-0001vM-JJ for pljava-dev@arkaria.postgresql.org; Sun, 05 Jul 2020 00:58:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jrszV-0001vF-3a for pljava-dev@lists.postgresql.org; Sun, 05 Jul 2020 00:58:45 +0000 Received: from anastigmatix.net ([68.171.219.55]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jrszR-0001BB-Cm for pljava-dev@lists.postgresql.org; Sun, 05 Jul 2020 00:58:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3o2e4YBN+0FiSDnJbqbYN5tTpXAShIU+fF0qyTjn7AE=; b=Ur4RzIUFG4B3hjpu4KegTUkwQe bKo+YwEeNk2WlnAJ3c+KpSYm5VfJfMecWbOB8JrwooEnXIvVryqdNNSIyj6DrXRvHXsDcBFB0LOSu QWU3qGgLXDhxIE9/RkkvyFZY4mpBzW5ax5i54KMMyAvy6CldGvZf79GfMPJksby6zNddSXqX70ank 7QjK0qTakxFZxwk7ckbhWyLHOwXN9PRrthKhplUfUeyFebPvAvjEGiKyi/CxSpHGoIdlpCAgQk2PO 3lmW5z3dvuJmw07DFRfAuFKyF1QATe+ciXSAXAEThTJw7RIeiGDiKPjEy+yZ1ACdITK0S2tXn3j9d zDf4zy1Q==; Received: from [184.19.31.139] (port=42873) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jrszN-001LOx-FG; Sat, 04 Jul 2020 20:58:38 -0400 Subject: Re: PL/Java new build plugin To: Kartik Ohri References: <5EF7B265.3060907@anastigmatix.net> <5EFA6C22.8060006@anastigmatix.net> <5EFC18D9.3090108@anastigmatix.net> <5EFD41B1.30009@anastigmatix.net> <5EFE0A4D.8060402@anastigmatix.net> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5F0125BC.5000609@anastigmatix.net> Date: Sat, 4 Jul 2020 20:58:36 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-95.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 07/03/20 06:20, Kartik Ohri wrote: > Hi! I have pushed a commit to branch modifying the mojo to create a > pgxs.properties file. It works fine on Linux except the version > classifier regex. I copied it from the build.xml file. I do not know what > the pattern of a version is so I am unable to debug this. Can you explain > this a bit ? The stuff in the filterchain/tokenfilter elements, right? Hmm, well well, it looks like I wrote those, back in 2015, and then tweaked them slightly in 2016 because some builds of PostgreSQL can have extra custom information appended to the version. Then tweaked them again in 2017 for PG 10 where the numbering scheme changed. The commit where I tweaked for the custom suffixes was bf59577, and the one for the PG10 numbering change was c434748. The commit comments and diffs give some insight into what was changed and why. (Have you played with 'blame' in git before?) There are two steps there. The first will just replace any suffix like BETA1 or RC2 with a .99 numeric component, so the next step can just: skip some possible non-digits at the front, then look for some groups of digits separated by real dots, then skip anything else at the end. Replace all that with pg\1.\2 where the references are to the first two groups of digits. Now that I think of it, that wasn't quite the right tweak for the PG10 version-scheme change. Prior to 10, a PG version had three numeric components, and the first two together made a major version (9.4, 9.5, etc.) and the third component was a minor update. In 10 and later, there are two numeric components, and just the first one is the major version, and the second is the minor. So, if the way the script previously worked was to make, say, a ...-pg9.5-amd64-Linux-gpp.jar (where the classifier mentioned just the PG major version 9.5, and not the minor version), then in 10 and later it should just produce ...-pg10-amd64-Linux-gpp.jar. Right now it produces -pg10.12 (that is, it still includes two components, so now the jar name reflects the minor version updates, which it previously did not). I also see I was careless writing the earlier, replaceregex pattern. I am prone to forgetting that pretty much everything binds more tightly than | does, so the way I wrote that pattern, the $ at the end only applies to the last alternative. It turns out not to make much difference because every alternative ends with .*, but it could be a subtle trap if there is ever a reason to tweak that pattern. It would be clearer to enclose all the alternatives in a non-capturing group and have the $ follow that. It looks as if you copied the expressions faithfully, except perhaps for the flags that are set for the first one. That probably doesn't explain any problem you're having (though it should be fixed anyway), as that first pattern isn't even in play unless you are building against a devel, alpha, beta, or rc version of PostgreSQL. Can you supply an example of what is going wrong? One last thing, not regex related: You can see the original build.xml code invokes pg_config multiple times, reading one configuration value each time, and the same is done by PGXS in Makefile.global [1]. It does seem more efficient to invoke pg_config only once and parse its output for the various values, as you are doing here. What could be the reason existing code avoided doing that? Regards, -Chap [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/Makefile.global.in;h=20d7a1d;hb=4fc935a#l119