# PERL RDAPPER # https://github.com/gbxyz/rdapper # https://metacpan.org/pod/App::rdapper %global _rdap_scm_host https://github.com %global _rdap_scm_repo gbxyz/rdapper # latest/current release version from CPAN %global _rdap_cpan_tag %( curl -s https://fastapi.metacpan.org/v1/release/App-rdapper | jq .version | sed 's|"||g' ) %global _owner pgnd %global _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S --utc ) %global _dist .%{_build_timestamp}.%{_owner}.fc%{fedora} # https://stackoverflow.com/questions/47838041/rpmbuild-how-to-disable-check-buildroot # https://rpm-software-management.github.io/rpm/manual/dependency_generators.html # %%global __spec_install_pre /bin/true # %%global __arch_install_post %%{nil} # %%global __os_install_post %%{nil} %global _disable_source_fetch 0 # %%undefine _auto_set_build_flags %global _hardened_build 1 %global __brp_mangle_shebangs %{nil} # DEBUG %global debug_package %{nil} # fix 'Error: Transaction test error:' ; RHEL8 rpmbuild and /usr/lib/.build-id # https://access.redhat.com/discussions/5045161 # https://unix.stackexchange.com/questions/688839/if-i-do-not-care-about-debug-support-in-red-hat-packages-what-are-the-drawbacks %global _build_id_links none # STRIP # do NOT strip bins -- specifically, spamc breaks if stripped # https://devel.fedoraproject.narkive.com/Ljv01e3Z/disabling-brp-strip-for-mock-builds # https://www.reddit.com/r/Fedora/comments/wsumts/weird_copr_build_result/ %global __brp_strip %{nil} %global __strip /bin/true %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's|/usr/lib/rpm/[^/]*/?brp-strip %{__strip}||g') # %%global __requires_exclude ^.*/xxx/bin/python.*$ # %%global __requires_exclude_from ^.*/xxx/bin/python.*$ # %%bcond_with XXX : opt build with XXX; default, without # %%bcond_without XXX : opt build without XXX; default, with %global _rdap_name perl-rdapper %global _rdap_pkgnm perl-rdapper %global _rdap_comment Simple console-based RDAP client %global _rdap_descrip %{expand: %{_rdap_comment}.} # https://spdx.org/licenses/GPL-1.0-or-later.html or https://spdx.org/licenses/Artistic-1.0-Perl.html %global _rdap_license GPL-1.0-or-later or Artistic-1.0-Perl %global _rdap_bin_dir_r bin %global _rdap_cache_dir /var/cache/authentication_milter %global _rdap_conf_dir /usr/local/etc/fm-auth-milter %global _rdap_install_dir /usr/local/perl-rdapper %global _rdap_libexec_dir /libexec %global _rdap_run_dir /run/%{_rdap_pkgnm} %global _rdap_exec %{_rdap_install_dir}/%{_rdap_bin_dir_r}/rdapper %global _rdap_exec_link /usr/local/bin/rdapper # single "/" s %global _rdap_local_lib %( echo "/builddir/%{_rdap_install_dir}" | sed -E 's|/{2,}|/|g' ) # https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/ %global _rdap_scm_repo_esc %( echo %{_rdap_scm_repo} | sed 's|_|-|g' | sed 's|/|%2F|g') %global _rdap_scm_repo_norm %( echo %{_rdap_scm_repo} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _rdap_scm_url %{_rdap_scm_host}/%{_rdap_scm_repo} %global dist %{_dist} # Vendor Pinning Vendor: %{_owner} # NEVRA (n-e:v-r.a) Name: %{_rdap_pkgnm} Epoch: 3 # https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ Version: cpan_%( echo %{_rdap_cpan_tag} | sed 's|-|_|g' ) Release: 0%{?dist} # https://blog.jasonantman.com/2014/07/how-yum-and-rpm-compare-versions/ %global _same_evr %{epoch}:%{version}-%{release} Summary: %{_rdap_comment} License: %{_rdap_license} URL: %{_rdap_scm_url} BuildRequires: curl BuildRequires: findutils BuildRequires: gcc BuildRequires: gettext BuildRequires: make BuildRequires: pcre2-devel BuildRequires: perl(local::lib) BuildRequires: perl(App::cpanminus) BuildRequires: perl(deprecate) BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: perl(File::Copy) BuildRequires: perl(Test::More) BuildRequires: perl(Test::NoWarnings) BuildRequires: pkgconf Requires: findutils Requires: logrotate Requires: perl(local::lib) Requires: rsyslog Requires(post): coreutils Requires(postun): coreutils Provides: perl-rdapper = %{_same_evr} Obsoletes: perl-rdapper < %{_same_evr} %description %{_rdap_comment} %global _build_work_dir /builddir %prep echo '##### STARTING PREP #####' %build echo '##### STARTING BUILD #####' cd %{_builddir} echo '##### SETUP BUILD ENV #####' # https://metacpan.org/dist/App-cpanminus/view/bin/cpanm _opts="" _opts+=" --verify" _opts+=" --no-prompt" _opts+=" --notest" _opts+=" --no-sudo" _opts+=" --no-interactive" _opts+=" --with-recommends" _opts+=" --with-suggests" _opts+=" --local-lib %{_rdap_local_lib}" _opts+=" --self-contained" # http://mirrors.cpan.org/ # use cpan CDN # https://www.cpan.org/SITES.html #_opts+=" --from http://mirrors.rit.edu/CPAN/" _opts+=" --from https://www.cpan.org/" #_opts+=" --from https://cpan.metacpan.org" export PERL_CPANM_OPT="${_opts}" export PERL_CPANM_HOME="%{_build_work_dir}/.cpanm" # local::lib INSTALL #####' # https://manpages.ubuntu.com/manpages/lunar/man3/local::lib.3pm.html # https://www.perlmonks.org/?node_id=967116 # https://metacpan.org/pod/local::lib#Bootstrapping-into-an-alternate-directory # Build RPMs of CPAN Modules # https://perlhacks.com/2015/10/build-rpms-of-cpan-modules/ mkdir -p %{_rdap_local_lib} cd %{_rdap_local_lib} # perl -Mlocal::lib=./ eval $(perl -Mlocal::lib=./) printenv | grep PERL | sort # PERL5LIB=/builddir/perlbuilddir/lib/perl5 # PERL_CPANM_HOME=/builddir/.cpanm # PERL_CPANM_OPT= --verify --no-prompt --notest --no-sudo --no-interactive --with-recommends --with-suggests --local-lib /builddir/perlbuilddir --self-contained --from https://www.cpan.org/ # PERL_LOCAL_LIB_ROOT=/builddir/perlbuilddir/ # PERL_MB_OPT=--install_base "/builddir/perlbuilddir/" # PERL_MM_OPT=INSTALL_BASE=/builddir/perlbuilddir/ # update, first, to latest CoreList @ CPAN perl -MCPAN -e 'install "Module::CoreList"' cpanm --quiet Module::Info # module_info Module::Info ##################### ## GET/FIX PREREQS # Net::IDN::Encode @F40 # fix "-Werror=implicit-function-declaration" on rawhide # https://github.com/fastmail/authentication_milter/issues/149 # https://github.com/cfaerber/Net-IDN-Encode/pull/11 # https://src.fedoraproject.org/rpms/perl-Net-IDN-Encode/blob/rawhide/f/Net-IDN-Encode-2.500-use_uvchr_to_utf8_flags_instead_of_uvuni_to_utf8_flags.patch _mod="Net::IDN::Encode" pushd . rm -rf ./tmpdir mkdir -p ./tmpdir cd ./tmpdir _mod_info=$( cpanm --info ${_mod} ) _mod_vers=$( echo ${_mod_info} | sed 's|.*/||g' | sed 's|\.tar\.gz||g' ) curl -O https://cpan.metacpan.org/authors/id/${_mod_info:0:1}/${_mod_info:0:2}/${_mod_info} tar zxvf ${_mod_vers}.tar.gz cd ${_mod_vers} export PERL_MM_USE_DEFAULT=1 curl -o _this.patch \ https://src.fedoraproject.org/rpms/perl-Net-IDN-Encode/raw/rawhide/f/Net-IDN-Encode-2.500-use_uvchr_to_utf8_flags_instead_of_uvuni_to_utf8_flags.patch patch --quiet -p1 -i _this.patch perl Build.PL ./Build --quiet installdeps --cpan_client 'cpanm --quiet' ./Build --quiet ./Build --quiet install popd rm -rf ./tmpdir ## Net::RDAP _mod="Net::RDAP" echo "##### PREREQ: ${_mod} #####" pushd . rm -rf ./tmpwork mkdir -p ./tmpwork cd ./tmpwork _mod_info=$( cpanm --info ${_mod} ) _mod_vers=$( echo ${_mod_info} | sed 's|.*/||g' | sed 's|\.tar\.gz||g' ) curl -O https://cpan.metacpan.org/authors/id/${_mod_info:0:1}/${_mod_info:0:2}/${_mod_info} tar zxf ${_mod_vers}.tar.gz cd ${_mod_vers} export PERL_MM_USE_DEFAULT=1 # cpanm --quiet --installdeps . perl Makefile.PL make -j${RPM_BUILD_NCPUS} make install popd rm -rf ./tmpwork ##\GET/FIX PREREQS ##################### #cpanm --quiet --installdeps App::rdapper #cpanm --quiet App::rdapper cpanm --installdeps App::rdapper cpanm App::rdapper %install echo '##### STARTING INSTALL #####' cd %{_builddir} mkdir -p ${RPM_BUILD_ROOT}/$(dirname %{_rdap_install_dir}) mv -f \ %{_rdap_local_lib} \ ${RPM_BUILD_ROOT}/$(dirname %{_rdap_install_dir}) echo '##### FIX PATHS #####' # --exclude="spamc" \ grep -rlni \ --binary-files=without-match \ "%{_rdap_local_lib}" ${RPM_BUILD_ROOT}/ \ | xargs -i@ sed -i 's|/builddir/|/|g' @ %pre %post -e # Ensure /usr/local/bin/rdapper -> %%{_rdap_target_bin} _target="%{_rdap_exec}" _link="%{_rdap_exec_link}" # Remove any pre-existing file or symlink at the link path if [ -e "${_link}" ] || [ -L "${_link}" ] then find "$(dirname "${_link}")" -maxdepth 1 -xdev \( -L -o -type f \) -name "$(basename "${_link}")" -delete fi # Create parent dir and symlink install -d -m 0755 -- "$(dirname "${_link}")" ln -s -- "${_target=}" "${_link}" %preun %postun if [ "$1" -eq 0 ] then _target="%{_rdap_exec}" _link="%{_rdap_exec_link}" find "$(dirname "${_link}")" \ -maxdepth 1 -xdev -type l \ -lname "${_target}" \ -name "$(basename "${_link}")" \ -delete fi %files # http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html %dir %{_rdap_install_dir} %{_rdap_install_dir}/* %changelog * Mon Sep 22 2025 pgnd _ - bump 1758559212