# Detect the distribution in use %global __despace head -n 1 | tr -d '[:space:]' | sed -e 's/[(].*[)]//g' %global __lower4 cut -c 1-4 | tr '[:upper:]' '[:lower:]' %global __distfile %([ -f /etc/SuSE-release ] && echo /etc/SuSE-release || echo /etc/redhat-release) %global __distinit %(sed -e 's/ release .*//' -e 's/\\([A-Za-z]\\)[^ ]*/\\1/g' %{__distfile} | %{__despace} | %{__lower4}) %global __distvers %(sed -e 's/.* release \\([^. ]*\\).*/\\1/' %{__distfile} | %{__despace}) # Identify Alma, CentOS, CentOS Stream and Rocky Linux as rhel %if "%{__distinit}" == "a" || "%{__distinit}" == "c" || "%{__distinit}" == "cl" || "%{__distinit}" == "cs" || "%{__distinit}" == "rl" %global __distinit rhel %endif # Dist tag for Fedora is still "fc" %if "%{__distinit}" == "f" %global __distinit fc %endif Summary: Return the host's fully-qualified name Name: perl-Sys-Hostname-Long Version: 1.5 Release: 26.%{__distinit}%{__distvers} License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/release/Sys-Hostname-Long Source0: https://cpan.metacpan.org/modules/by-module/Sys/Sys-Hostname-Long-%{version}.tar.gz BuildArch: noarch # Module Build BuildRequires: coreutils BuildRequires: findutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter BuildRequires: perl(ExtUtils::MakeMaker) # Module Runtime %if 0%{?fedora} > 20 || 0%{?rhel} > 7 BuildRequires: hostname %else BuildRequires: /bin/hostname %endif BuildRequires: perl(Carp) BuildRequires: perl(Exporter) BuildRequires: perl(IO::Socket) BuildRequires: perl(POSIX) BuildRequires: perl(strict) BuildRequires: perl(Sys::Hostname) BuildRequires: perl(vars) # Test Suite BuildRequires: perl(lib) BuildRequires: perl(Test) # Runtime %if 0%{?fedora} > 20 || 0%{?rhel} > 7 Requires: hostname %else Requires: /bin/hostname %endif %if 0%{?fedora} < 38 && 0%{?rhel} < 10 Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) %endif Requires: perl(IO::Socket) # Avoid unwanted dependencies from testall.pl %global __requires_exclude_from ^%{perl_vendorlib}/Sys/Hostname/testall\.pl %description Attempt via many methods to get the system's full name. The Sys::Hostname class is the best and standard way to get the system hostname. However, it is missing the long hostname. %prep %setup -q -n Sys-Hostname-Long-%{version} %build perl Makefile.PL INSTALLDIRS=vendor make %{?_smp_mflags} %install make pure_install DESTDIR=%{buildroot} find %{buildroot} -type f -name .packlist -delete %{_fixperms} -c %{buildroot} %check make test perl testall.pl %files %doc Changes README %{perl_vendorlib}/Sys/ %{_mandir}/man3/Sys::Hostname::Long.3* %changelog * Sun May 21 2023 Paul Howarth - 1.5-26 - Use SPDX-format license tag - Drop support for building with rpm < 4.9 - Switch upstream from search.cpan.org to metacpan.org * Thu Apr 12 2018 Paul Howarth - 1.5-11 - BR: perl-generators unconditionally - BR: perl-interpreter rather than perl * Mon May 15 2017 Paul Howarth - 1.5-8 - Add build/runtime dependency on hostname for situations where network is unavailable (#1450746) - Simplify find command using -delete - Fix dependency filtering - Run testall.pl in %%check - Drop support for EOL distributions prior to F-13 - Drop legacy BuildRoot: and Group: tags - No need to clean buildroot in %%install section - Drop explicit %%clean section * Tue Jul 26 2016 Paul Howarth - 1.5-5 - Fix FTBFS when perl is not in the minimal buildroot - Simplify find command using -delete - BR: perl-generators where available - Prefer %%global over %%define * Tue Jan 13 2015 Paul Howarth - 1.5-1 - Update to 1.5 - Improvements by Michiel Bejen - Drop %%defattr, redundant since rpm 4.4 - Classify buildreqs by usage * Tue Jun 12 2012 Paul Howarth 1.4-9 - Require IO::Socket for Network Socket hostname - BR: perl(Carp), perl(IO::Socket), perl(lib) and perl(Test) - Add filters to avoid doc-file dependencies - Don't need to remove empty directories from the buildroot - Drop support for old distributions prior to FC-3: - Don't need to define %%{perl_vendorlib} - Use DESTDIR rather than PERL_INSTALL_ROOT * Wed Jul 6 2011 Paul Howarth 1.4-8 - Rebuild for perl 5.14.1 in Rawhide - Nobody else likes macros for commands - Fix dist tag for CentOS 6 and Scientific Linux * Thu Jun 24 2010 Paul Howarth 1.4-7 - Rebuild for perl 5.12.1 in Rawhide * Fri May 7 2010 Paul Howarth 1.4-6 - Fix dist tag to work with RHEL6 Beta * Wed Mar 3 2010 Paul Howarth 1.4-5 - Dist tag for Rawhide no longer needs special-casing - Use %%{_fixperms} macro instead of our own %%{__chmod} incantation * Sat Sep 26 2009 Paul Howarth 1.4-4 - Clarify license as GPL (version 1 or later), or Artistic (i.e. same as perl) - Define RPM macros in global scope * Tue Jun 5 2007 Paul Howarth 1.4-3 - Fix dist tag for Fedora 7 onwards - Fix argument order for find with -depth - BuildRequire perl(ExtUtils::MakeMaker) * Fri Sep 1 2006 Paul Howarth 1.4-2 - Simplify distribution-detection - Remove macro %%{__perl_version}, used only once - Remove macro %%{__perl_package}, used only twice - Define %%{__id_u} in a more portable way - Use search.cpan.org URLs - Don't use macros in command paths, hardcode them instead - Clear buildroot unconditionally in %%clean and %%install - Fix directory ownership - Don't bother setting compiler flags for noarch package * Mon Jul 4 2005 Paul Howarth 1.4-1 - Update to 1.4 * Tue Jun 21 2005 Paul Howarth 1.2-2 - Rewrite spec file in (mainly) Fedora Extras style - Include full URL for source - Fix URL - Use MODULE_COMPAT dependency style and remove explicit perl dependency - Remove MANIFEST from %%doc * Wed Oct 27 2004 Paul Howarth 1.2-1 - Update to 1.2 - Tidy up spec file - Add kludge to remove bogus dependency on Win32::TieRegistry * Wed Apr 14 2004 Paul Howarth 1.0-2 - Added explicit perl dependency to ensure that an RPM built on a system with an updated version of perl (and hence having files installed in a place that a non-updated system won't find them) will not install on the non-updated system. In such cases, just rebuilt from the source RPM. - Changed distribution-identifying macros for greater portability. * Thu Feb 26 2004 Paul Howarth 1.0-1 - Initial build