Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26bb793730 | ||
|
|
c0c4502602 | ||
|
|
fe98860baf | ||
|
|
f35344f5cb | ||
|
|
8e3f3f6068 | ||
|
|
14a8336849 |
5 changed files with 168 additions and 38 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
/postgresql_anonymizer*
|
||||
/results*
|
||||
/results*
|
||||
/postgresql-16.8.tar.bz2
|
||||
|
|
|
|||
|
|
@ -2,7 +2,15 @@ summary: Setup everything needed for building cargo-pgrx and running make instal
|
|||
discover:
|
||||
how: fmf
|
||||
prepare:
|
||||
how: install
|
||||
package: [rustfmt, wget, diffutils, bzip2, postgresql16-server-devel, postgresql16-contrib, postgresql16-anonymizer]
|
||||
- name: Skip Testing Farm installation of artifacts
|
||||
how: install
|
||||
exclude:
|
||||
- .*
|
||||
|
||||
- how: shell
|
||||
script: dnf module enable -y postgresql:16
|
||||
|
||||
- how: install
|
||||
package: [gcc, readline-devel, zlib-devel, openssl-devel, wget, diffutils, bzip2, sudo, postgresql16-anonymizer, postgresql-server-devel, postgresql-contrib]
|
||||
execute:
|
||||
how: tmt
|
||||
|
|
|
|||
|
|
@ -1,10 +1,25 @@
|
|||
%{!?postgresql_default:%global postgresql_default 0}
|
||||
|
||||
%global shortname anonymizer
|
||||
%global extension postgresql_%{shortname}
|
||||
%global pgversion 16
|
||||
%global postgres_version %{pgversion}.8
|
||||
%global pgrx_version 0.16.0
|
||||
%global pg_config %{_bindir}/pg_config
|
||||
%global pg_config /tmp/pgsql%{_bindir}/pg_config
|
||||
|
||||
# postgresql conditions for easy handling of %%configure
|
||||
# during the build of postgresql
|
||||
%{!?upgrade:%global upgrade 1}
|
||||
%{!?plpython3:%global plpython3 1}
|
||||
%{!?pltcl:%global pltcl 1}
|
||||
%{!?plperl:%global plperl 1}
|
||||
%{!?ssl:%global ssl 1}
|
||||
%{!?icu:%global icu 1}
|
||||
%{!?kerberos:%global kerberos 1}
|
||||
%{!?ldap:%global ldap 1}
|
||||
%{!?nls:%global nls 1}
|
||||
%{!?uuid:%global uuid 1}
|
||||
%{!?xml:%global xml 1}
|
||||
%{!?pam:%global pam 1}
|
||||
%{!?selinux:%global selinux 1}
|
||||
|
||||
Name: postgresql%{pgversion}-%{shortname}
|
||||
Version: 2.4.1
|
||||
|
|
@ -56,6 +71,9 @@ Source0: https://gitlab.com/dalibo/%{extension}/-/archive/%{version}/%{ex
|
|||
Source1: %{extension}-%{version}-vendored.tar.xz
|
||||
# To create a tarball with all crates vendored (like https://src.fedoraproject.org/rpms/loupe/blob/rawhide/f/loupe.spec)
|
||||
Source2: create-vendored-tarball.sh
|
||||
# Since pg16 is only available in RHEL9 as a module and non-module RPMs don't support requiring modules, we need to
|
||||
# build pg16 from source and build against it
|
||||
Source3: https://ftp.postgresql.org/pub/source/v%{postgres_version}/postgresql-%{postgres_version}.tar.bz2
|
||||
# Change default feature to the correct pg version and remove tests from dependencies, the lack of tests is justified below
|
||||
Patch: anonymizer-cargo.patch
|
||||
Patch: remove-disallowed-licenses.patch
|
||||
|
|
@ -63,14 +81,6 @@ Patch: remove-disallowed-licenses.patch
|
|||
# drop i686 support (https://fedoraproject.org/wiki/Changes/Noi686Repositories)
|
||||
ExcludeArch: %{ix86}
|
||||
|
||||
%if %?postgresql_default
|
||||
%global pkgname %{extension}
|
||||
%package -n %{pkgname}
|
||||
Summary: Mask or replace personally identifiable information (PII) or sensitive data
|
||||
%else
|
||||
%global pkgname %name
|
||||
%endif
|
||||
|
||||
BuildRequires: rustfmt
|
||||
BuildRequires: clang
|
||||
BuildRequires: bison-devel
|
||||
|
|
@ -78,20 +88,71 @@ BuildRequires: readline-devel
|
|||
BuildRequires: zlib-devel
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: wget
|
||||
BuildRequires: postgresql%{pgversion}-server
|
||||
BuildRequires: postgresql%{pgversion}-server-devel
|
||||
BuildRequires: cargo-rpm-macros >= 26
|
||||
Requires: postgresql%{pgversion}-server
|
||||
|
||||
%global precise_version %{?epoch:%epoch:}%version-%release
|
||||
Provides: %{pkgname} = %precise_version
|
||||
%if %?postgresql_default
|
||||
Provides: %name = %precise_version
|
||||
Provides: postgresql-%{extension} = %precise_version
|
||||
# BuildRequires for postgresql
|
||||
BuildRequires: lz4-devel
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk
|
||||
BuildRequires: perl(ExtUtils::Embed), perl-devel
|
||||
BuildRequires: perl(Opcode)
|
||||
BuildRequires: perl-generators
|
||||
BuildRequires: readline-devel zlib-devel
|
||||
BuildRequires: multilib-rpm-config
|
||||
BuildRequires: docbook-style-xsl
|
||||
#aditional BuildRequires for postgresql that can be
|
||||
#turned off using the vars above
|
||||
%if %plpython3
|
||||
BuildRequires: python3-devel
|
||||
%endif
|
||||
Provides: %{pkgname}%{?_isa} = %precise_version
|
||||
Provides: %{extension}-any
|
||||
Conflicts: %{extension}-any
|
||||
|
||||
%if %pltcl
|
||||
BuildRequires: tcl-devel
|
||||
%endif
|
||||
|
||||
%if %ssl
|
||||
BuildRequires: openssl-devel
|
||||
%endif
|
||||
|
||||
%if %kerberos
|
||||
BuildRequires: krb5-devel
|
||||
%endif
|
||||
|
||||
%if %ldap
|
||||
BuildRequires: openldap-devel
|
||||
%endif
|
||||
|
||||
%if %nls
|
||||
BuildRequires: gettext >= 0.10.35
|
||||
%endif
|
||||
|
||||
%if %uuid
|
||||
BuildRequires: uuid-devel
|
||||
%endif
|
||||
|
||||
%if %xml
|
||||
BuildRequires: libxml2-devel libxslt-devel
|
||||
%endif
|
||||
|
||||
%if %pam
|
||||
BuildRequires: pam-devel
|
||||
%endif
|
||||
|
||||
%if %selinux
|
||||
BuildRequires: libselinux-devel
|
||||
%endif
|
||||
|
||||
%if %icu
|
||||
BuildRequires: libicu-devel
|
||||
%endif
|
||||
|
||||
Requires: postgresql-server > 16 postgresql-server < 17
|
||||
# There is really no postgres code included in the binary, so it probably isn't
|
||||
# necessary to provide these, but a more in-depth discusison should be had as the
|
||||
# guidelines aren't really clear on this. Including for now because it does no harm
|
||||
# and enables easier discovery in case of CVEs, which can still happen probably.
|
||||
# muPDF also provides -devel packages justifying it as "being the safer choice":
|
||||
# https://src.fedoraproject.org/rpms/mupdf/blob/epel9/f/mupdf.spec
|
||||
Provides: bundled(postgresql-server) = %{postgres_version}
|
||||
|
||||
%description
|
||||
PostgreSQL Anonymizer is an extension to mask or replace
|
||||
|
|
@ -101,28 +162,79 @@ The project has a declarative approach of anonymization. This means you can
|
|||
declare the masking rules using the PostgreSQL Data Definition Language (DDL)
|
||||
and specify your anonymization policy inside the table definition itself.
|
||||
|
||||
%if %?postgresql_default
|
||||
%description -n %{pkgname}
|
||||
PostgreSQL Anonymizer is an extension to mask or replace
|
||||
personally identifiable information (PII) or commercially sensitive data from
|
||||
a PostgreSQL database.
|
||||
The project has a declarative approach of anonymization. This means you can
|
||||
declare the masking rules using the PostgreSQL Data Definition Language (DDL)
|
||||
and specify your anonymization policy inside the table definition itself.
|
||||
%endif
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -a1 -p1 -n %{extension}-%{version}
|
||||
%setup -q -a1 -a3 -n %{extension}-%{version}
|
||||
%patch -P0 -p1
|
||||
%patch -P1 -p1
|
||||
# Enabling the unstable edition2024 feature for rust 1.84.1 on RHEL, TODO: remove in the future
|
||||
echo -e "cargo-features = [\"edition2024\"]\n$(cat vendor/base64ct-1.8.0/Cargo.toml)" > vendor/base64ct-1.8.0/Cargo.toml
|
||||
echo -e "cargo-features = [\"edition2024\"]\n$(cat vendor/cargo-edit-0.13.2/Cargo.toml)" > vendor/cargo-edit-0.13.2/Cargo.toml
|
||||
%{cargo_prep -v vendor}
|
||||
echo "[patch.crates-io]
|
||||
dunce = { path = 'vendor/dunce-1.0.5' }
|
||||
constant_time_eq = { path = 'vendor/constant_time_eq-0.3.1' }
|
||||
imgref = { path = 'vendor/imgref-1.11.0' }
|
||||
base64ct = { path = 'vendor/base64ct-1.8.0' }
|
||||
cargo-edit = { path = 'vendor/cargo-edit-0.13.2' }
|
||||
" >> .cargo/config.toml
|
||||
|
||||
|
||||
%build
|
||||
# build postgres first
|
||||
cd postgresql-%{postgres_version}
|
||||
common_configure_options='
|
||||
--disable-rpath
|
||||
%if %plperl
|
||||
--with-perl
|
||||
%endif
|
||||
%if %pltcl
|
||||
--with-tcl
|
||||
--with-tclconfig=/usr/%_lib
|
||||
%endif
|
||||
%if %ldap
|
||||
--with-ldap
|
||||
%endif
|
||||
%if %ssl
|
||||
--with-openssl
|
||||
%endif
|
||||
%if %pam
|
||||
--with-pam
|
||||
%endif
|
||||
%if %kerberos
|
||||
--with-gssapi
|
||||
%endif
|
||||
%if %uuid
|
||||
--with-ossp-uuid
|
||||
%endif
|
||||
%if %xml
|
||||
--with-libxml
|
||||
--with-libxslt
|
||||
%endif
|
||||
%if %nls
|
||||
--enable-nls
|
||||
%endif
|
||||
%if %selinux
|
||||
--with-selinux
|
||||
%endif
|
||||
--with-system-tzdata=/usr/share/zoneinfo
|
||||
--datadir=%_datadir/pgsql
|
||||
--with-lz4
|
||||
%if %icu
|
||||
--with-icu
|
||||
%endif
|
||||
%if %plpython3
|
||||
--with-python
|
||||
%endif
|
||||
'
|
||||
#holds the installed files from postgresql
|
||||
mkdir -p /tmp/pgsql
|
||||
%configure $common_configure_options
|
||||
%make_build
|
||||
make install DESTDIR=/tmp/pgsql
|
||||
cd ..
|
||||
export LD_LIBRARY_PATH=/tmp/pgsql%{_libdir}
|
||||
|
||||
# using normal cargo instead of the macros because `make extension` uses it too and needs to be able to find cargo pgrx
|
||||
# cannot build all of pgrx since pgrx-pg-sys (and anonymizer) depends on `cargo pgrx init` being called first
|
||||
export RUSTC_BOOTSTRAP=1
|
||||
|
|
@ -149,16 +261,21 @@ mkdir -p %{?buildroot}$COMMON_SHAREDIR/extension %{?buildroot}$COMMON_PKGLIBDIR
|
|||
%make_install PG_CONFIG=%{pg_config} PGVER=pg%{pgversion} \
|
||||
PG_SHAREDIR=%{?buildroot}$COMMON_SHAREDIR PG_PKGLIBDIR=%{?buildroot}$COMMON_PKGLIBDIR \
|
||||
TARGET_SHAREDIR=$TARGET_DIR$COMMON_SHAREDIR TARGET_PKGLIBDIR=$TARGET_DIR$COMMON_PKGLIBDIR
|
||||
# move the installed files from /tmp/pgsql
|
||||
mkdir -p %{?buildroot}%{_datadir} %{?buildroot}%{_libdir}
|
||||
mv %{?buildroot}/tmp/pgsql%{_datadir}/* %{?buildroot}%{_datadir}
|
||||
mv %{?buildroot}/tmp/pgsql%{_libdir}/postgresql %{?buildroot}%{_libdir}/pgsql
|
||||
|
||||
|
||||
# integration tests (make installcheck) and pg_tests are impossible to run here since postgres hardcodes
|
||||
# where it looks for extensions, and the pgrx_tests package also requires root access to be installed and run
|
||||
# where it looks for extensions, the pgrx_tests package also requires root access to be installed and run,
|
||||
# and we have not built pgtests_start and do not have postgresql_pkg_tests.sh on this system
|
||||
# therefore, we can only run unit tests
|
||||
%check
|
||||
PGRX_HOME=%{_builddir}/.pgrx CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' cargo pgrx test -rv pg%{pgversion} ::test_
|
||||
|
||||
|
||||
%files -n %{pkgname}
|
||||
%files
|
||||
%{_libdir}/pgsql/anon.so
|
||||
%{_datadir}/pgsql/extension/anon--%{version}.sql
|
||||
%{_datadir}/pgsql/extension/anon.control
|
||||
|
|
|
|||
1
sources
1
sources
|
|
@ -1,2 +1,3 @@
|
|||
SHA512 (postgresql_anonymizer-2.4.1.tar.bz2) = b043e9cbaa647fbed477128277dae5fe2a97f8db33cb204fa81a09e972b158b4ce9e18e0d2fdd7be85513ddba9a0cb7199bdffd541b491b5da87aff42c9cba12
|
||||
SHA512 (postgresql_anonymizer-2.4.1-vendored.tar.xz) = ca6cec1b64054cb7dfabf17a92453786323dca647f6d27912a6dd9fa6d95b4f5ce9e7eba6ce721b21be0b1d84becc8556c8d6654319648143b4555c00539dc00
|
||||
SHA512 (postgresql-16.8.tar.bz2) = f44fdfe01fbf82f3ffe4c9fc860bd27e06dddfe43b6bd6d1c6e267d64086eb5517e23cc1b2b8895cb73e63fce76779993ea9785a97e6e348ed91b4c08bb0492d
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
version=2.4.1
|
||||
|
||||
cd
|
||||
wget https://sh.rustup.rs
|
||||
sh ./index.html -y
|
||||
. "$HOME/.cargo/env"
|
||||
cargo install cargo-pgrx --version 0.16.0 --locked
|
||||
cargo pgrx init --pg16 /usr/bin/pg_config
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue