Bug 226689 - [NEW PORT] databases/pgsanity: Check syntax of PostgreSQL SQL files
Summary: [NEW PORT] databases/pgsanity: Check syntax of PostgreSQL SQL files
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tobias Kortkamp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-18 04:14 UTC by Mateusz Piotrowski
Modified: 2018-03-19 10:29 UTC (History)
1 user (show)

See Also:
0mp: maintainer-feedback+


Attachments
Shell archive of a new databases/pgsanity port (version: v0.2.8.20170811) (2.40 KB, text/plain)
2018-03-18 04:14 UTC, Mateusz Piotrowski
0mp: maintainer-approval+
Details
Shell archive of a new databases/pgsanity port (version: v0.2.8-16-gd82a5be, revision: 2) (2.40 KB, text/plain)
2018-03-18 12:05 UTC, Mateusz Piotrowski
0mp: maintainer-approval+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mateusz Piotrowski freebsd_committer freebsd_triage 2018-03-18 04:14:32 UTC
Created attachment 191589 [details]
Shell archive of a new databases/pgsanity port (version: v0.2.8.20170811)

PgSanity is a utility to check syntax of PostgreSQL SQL files. I find it pretty handy and it would be nice to have it in our ports tree.

The Makefile is pretty straightforward. The package requires ecpg, which is an embedded SQL C preprocessor installed with a PostgreSQL server. Unfortunately, I have not found a way to avoid adding PostgreSQL as a dependency. Another issue is that the upstream maintainer haven't tagged the newest 0.2.9 release on GitHub. Because of this I suggest to use 0.2.8.20170811 for the time being. This way the future transition should be easy.

QA:
 - poudriere: 11.1-RELEASE amd64 (with postgresql95-server)
 - portlint
 - my machine: FreeBSD 12.0-CURRENT r330529 amd64 (with postgresql10-server)

Cheers!
Comment 1 Tobias Kortkamp freebsd_committer freebsd_triage 2018-03-18 06:13:23 UTC
Please use the procedure at [1] to derive a proper DISTVERSION{,SUFFIX,PREFIX}
triple and drop GH_TAGNAME.

Let's not invent random version numbers if we don't have to.

[1] https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html#makefile-master_sites-github-ex5
Comment 2 Mateusz Piotrowski freebsd_committer freebsd_triage 2018-03-18 12:05:34 UTC
Created attachment 191593 [details]
Shell archive of a new databases/pgsanity port (version: v0.2.8-16-gd82a5be, revision: 2)

(In reply to Tobias Kortkamp from comment #1)
Thanks for spotting this! :)

The new attachment changes version variables as requested. 

The reason why I did it this way is that I followed example 5.11.[1] It is rather missleading as both example 5.11 and 5.13 seem appropriate. I'll read through the whole section next time.

Additional QA:
 - poudriere: 10.4-RELEASE amd64, 11.1-RELEASE i386

[1]: https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html#makefile-master_sites-github-ex2
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-03-18 12:31:57 UTC
A commit references this bug:

Author: tobik
Date: Sun Mar 18 12:31:14 UTC 2018
New revision: 464904
URL: https://svnweb.freebsd.org/changeset/ports/464904

Log:
  New port: databases/pgsanity

  PgSanity checks the syntax of PostgreSQL SQL files.

  It does this by leveraging the ecpg command which is traditionally
  used for preparing C files with embedded SQL for compilation.
  However, as part of that preparation, ecpg checks the embedded SQL
  statements for syntax errors using the exact same parser that is in
  PostgreSQL.

  So the approach that PgSanity takes is to take a file that has a list
  of bare SQL in it, make that file look like a C file with embedded
  SQL, run it through ecpg and let ecpg report on the syntax errors of
  the SQL.

  WWW: https://github.com/markdrago/pgsanity

  PR:		226689
  Submitted by:	0mp

Changes:
  head/databases/Makefile
  head/databases/pgsanity/
  head/databases/pgsanity/Makefile
  head/databases/pgsanity/distinfo
  head/databases/pgsanity/pkg-descr
Comment 4 Tobias Kortkamp freebsd_committer freebsd_triage 2018-03-19 10:29:51 UTC
Committed. Thanks!