# GOLANG # https://docs.fedoraproject.org/en-US/packaging-guidelines/Golang/ # https://docs.fedoraproject.org/en-US/quick-docs/publish-rpm-on-copr # http://ftp.rpm.org/max-rpm/s1-rpm-inside-scripts.html # https://rpm-software-management.github.io/rpm/manual/macros.html # https://rpm-packaging-guide.github.io/ %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 %global debug_package %{nil} # %%undefine _auto_set_build_flags %global _hardened_build 1 %global __brp_mangle_shebangs %%{nil} %global __brp_strip %%{nil} # %%global __requires_exclude ^.*/xxx/bin/python.*$ # %%global __requires_exclude_from ^.*/xxx/bin/python.*$ # RHEL8 rpmbuild and /usr/lib/.build-id # https://access.redhat.com/discussions/5045161 %global _build_id_links none # %%bcond_with XXX : opt build with XXX; default, without # %%bcond_without XXX : opt build without XXX; default, with # MMDBCTL # https://github.com/ipinfo/mmdbctl %global _mmdb_name mmdbctl %global _mmdb_pkgnm mmdbctl %global _mmdb_unitnm mmdbctl %global _mmdb_comment MMDB file management CLI %global _mmdb_descrip %{expand: %{_mmdb_comment}.} # https://spdx.org/licenses/Apache-2.0.html %global _mmdb_license Apache-2.0 # https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/ %global _mmdb_scm_repo ipinfo/mmdbctl %global _mmdb_scm_branch master %global _mmdb_scm_repo_esc %( echo %{_mmdb_scm_repo} | sed 's|_|-|g' | sed 's|/|%2F|g') %global _mmdb_scm_repo_norm %( echo %{_mmdb_scm_repo} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _mmdb_scm_branch_norm %( echo %{_mmdb_scm_branch} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _mmdb_scm_host https://github.com %global _mmdb_scm_host_api https://api.github.com/repos %global _mmdb_scm_url %{_mmdb_scm_host}/%{_mmdb_scm_repo} %global _mmdb_scm_tarball %{_mmdb_scm_host_api}/%{_mmdb_scm_repo}/tarball/%{commit0} # !!NOTE!! GH API tarball extracts to: %global _mmdb_scm_extract_dir %{_mmdb_scm_repo_norm}-%{shortcommit0} %global forgeurl0 %{_mmdb_scm_url} %global commit0 %( git ls-remote %{forgeurl0} | grep /%{_mmdb_scm_branch}$ | cut -f1 ) %global shortcommit0 %( c=%{commit0}; echo ${c} | head -c 7 ) %global forgesource0 %{_mmdb_scm_tarball} %global extractdir0 %{_mmdb_scm_extract_dir} %global forgesetupargs0 -T -D -b 0 -n %{extractdir0} %global goipath github.com/%{_mmdb_scm_repo} %forgemeta -i -a %global dist %{_dist} # Vendor Pinning Vendor: %{_owner} # NEVRA (n-e:v-r.a) Name: %{_mmdb_pkgnm} Epoch: 3 # https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ Version: %{scm0}_%( echo %{_mmdb_scm_branch} | 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: %{_mmdb_comment} License: %{_mmdb_license} URL: %{forgeurl0} Source0: %{forgesource0} # https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets # https://docs.pagure.org/packaging-guidelines/Packaging:Scriptlets.html BuildRequires: golang BuildRequires: bash %description %{_mmdb_descrip} %prep echo '##### STARTING PREP #####' %forgesetup -a %build echo '##### STARTING BUILD #####' cd %{_builddir}/%{extractdir0} mkdir -p %{buildroot}%{_bindir} echo '##### WHATS HERE 1 #####' pwd echo %{buildroot}%{_bindir} go build -o %{gobuilddir}/bin/mmdbctl . %install echo '##### STARTING INSTALL #####' cd %{_builddir}/%{extractdir0} mkdir -p ${RPM_BUILD_ROOT}/%{_bindir} install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ %pre %post -e %preun %postun %files # %%license LICENSE # %%doc CHANGELOG.md README.md scripts/changelog.sh %{_bindir}/* %changelog * Thu Oct 31 2024 pgnd _ - bump 1730382215