From bf0aa55655a1796b8d010c990a10dea353adf195 Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Thu, 8 Aug 2024 06:07:24 -0700 Subject: [PATCH] build proper freebsd package --- docs/cli-reference.rst | 6 ++++++ docs/contributing.rst | 7 ++++++- docs/packages/cli/freebsd.rst | 2 ++ lib/fpm/package/freebsd.rb | 34 +++++++++++++++++++++++----------- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/docs/cli-reference.rst b/docs/cli-reference.rst index 744bfe9b21..fd9676ad51 100644 --- a/docs/cli-reference.rst +++ b/docs/cli-reference.rst @@ -246,6 +246,9 @@ General Options * ``--freebsd-origin ABI`` - (freebsd only) Sets the FreeBSD 'origin' pkg field +* ``--freebsd-osversion VERSION`` + - (freebsd only) Sets the FreeBSD 'version' pkg field, ie. 12 or 13, use '*' for all. + * ``--gem-bin-path DIRECTORY`` - (gem only) The directory to install gem executables @@ -766,6 +769,9 @@ freebsd * ``--freebsd-origin ABI`` - Sets the FreeBSD 'origin' pkg field +* ``--freebsd-osversion VERSION`` + - Sets the FreeBSD 'version' pkg field, ie. 12 or 13, use '*' for all. + gem --- diff --git a/docs/contributing.rst b/docs/contributing.rst index 2f2390f420..3ab6b740a4 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -56,10 +56,15 @@ when it lists the FPM gem: If your system doesn't have `bsdtar` by default, make sure to install it or some tests will fail: - apt-get install bsdtar + apt-get install bsdtar || apt install libarchive-tools yum install bsdtar + +You also need these tools: + + apt-get install lintian cpanminus + Next, run make in root of the FPM repo. If there are any problems (such as missing dependencies) you should receive an error diff --git a/docs/packages/cli/freebsd.rst b/docs/packages/cli/freebsd.rst index 3f16a015e8..017872feb2 100644 --- a/docs/packages/cli/freebsd.rst +++ b/docs/packages/cli/freebsd.rst @@ -1,3 +1,5 @@ * ``--freebsd-origin ABI`` - Sets the FreeBSD 'origin' pkg field +* ``--freebsd-osversion VERSION`` + - Sets the FreeBSD 'version' pkg field, ie. 12 or 13, use '*' for all. diff --git a/lib/fpm/package/freebsd.rb b/lib/fpm/package/freebsd.rb index 42d3df9823..2aab74be4b 100644 --- a/lib/fpm/package/freebsd.rb +++ b/lib/fpm/package/freebsd.rb @@ -16,6 +16,10 @@ class FPM::Package::FreeBSD < FPM::Package "Sets the FreeBSD 'origin' pkg field", :default => "fpm/" + option "--osversion", "VERSION", + "Sets the FreeBSD 'version' pkg field, ie 12 or 13, use '*' for all.", + :default => "13" + def output(output_path) output_check(output_path) @@ -90,28 +94,36 @@ def output(output_path) end # def output # Handle architecture naming conversion: - # :::[.other] + # :: def architecture - osname = %x{uname -s}.chomp - osversion = %x{uname -r}.chomp.split('.').first - - # Essentially because no testing on other platforms - arch = 'x86' + osname = 'FreeBSD' - wordsize = case @architecture + arch = case @architecture when nil, 'native' %x{getconf LONG_BIT}.chomp # 'native' is current arch when 'arm64' - '64' + 'arm64' + when 'aarch64' + 'arm64' when 'amd64' - '64' + 'amd64' + when 'x86_64' + 'amd64' when 'i386' - '32' + 'i386' + when 'i686' + 'i386' + when 'any' + '*' + when 'all' + '*' + when 'noarch' + '*' else %x{getconf LONG_BIT}.chomp # default to native, the current arch end - return [osname, osversion, arch, wordsize].join(':') + return [osname, attributes[:freebsd_osversion], arch].join(':') end def add_path(tar, tar_path, path)