Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opentofu: Add port. #27326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions sysutils/opentofu/Portfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

Check warning on line 1 in sysutils/opentofu/Portfile

View workflow job for this annotation

GitHub Actions / macos-13

port lint opentofu-1.7: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in sysutils/opentofu/Portfile

View workflow job for this annotation

GitHub Actions / macos-13

port lint opentofu-1.8: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in sysutils/opentofu/Portfile

View workflow job for this annotation

GitHub Actions / macos-14

port lint opentofu-1.7: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in sysutils/opentofu/Portfile

View workflow job for this annotation

GitHub Actions / macos-14

port lint opentofu-1.8: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in sysutils/opentofu/Portfile

View workflow job for this annotation

GitHub Actions / macos-15

port lint opentofu-1.7: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in sysutils/opentofu/Portfile

View workflow job for this annotation

GitHub Actions / macos-15

port lint opentofu-1.8: Warning: Unnecessary platforms line as darwin is the default

PortSystem 1.0
PortGroup select 1.0

name opentofu
categories sysutils
maintainers {@graywolf wolfsden.cz:~+macports} openmaintainer
license MPL-2

homepage https://opentofu.org/

installs_libs no

# Shamelessly inspired by terraform's Portfile
proc opentofuBaseVersion {} {
global subport
return [lindex [split ${subport} "-"] 1]
}

proc opentofuVersion {} {
global patchNumber
return [opentofuBaseVersion].${patchNumber}
}

proc opentofuDistBase {} {
global name
return tofu_[opentofuVersion]_darwin
}

# *NOTE* Remember to update `latestVersion` on a version upgrade.
set latestVersion opentofu-1.8.8

subport opentofu-1.8 {
set patchNumber 8
revision 0

checksums [opentofuDistBase]_amd64.tar.gz \
rmd160 574f8be74cd6a9d252ceb4172daa9b7b133f74be \
sha256 9dd27362eb247abe181b6825ae72af37bc0b9e4dc74df2392dc681761fef520f \
size 26008291 \
[opentofuDistBase]_arm64.tar.gz \
rmd160 7bf8f69f8527032dacbc44c0fbea24d98faf69e0 \
sha256 dab912199ff7703c8ce8e7679dcac57a18f9bfc2f60a12454c82e74a3e24ca78 \
size 24556716
}

subport opentofu-1.7 {
set patchNumber 7
revision 0

checksums [opentofuDistBase]_amd64.tar.gz \
rmd160 799695b039d6a9108bcd86553b3d580a66992e48 \
sha256 94fdd023c38ee2f1765fec43eff59ed1a91b24e10a517b31de128eccc0b8fd24 \
size 25922637 \
[opentofuDistBase]_arm64.tar.gz \
rmd160 cb6d471cdcc681a0cea84bb21e6706595d8c7fbe \
sha256 7253fbb4fd2448e0480d6f3f567c569b108507ddfc6fc1c6c2e956eddaba11d7 \
size 24471570
}
subport opentofu_select {}

if {${subport} eq ${name}} {
PortGroup obsolete 1.0

replaced_by ${latestVersion}
version 1.8.8
revision 0

} elseif {${subport} eq "opentofu_select"} {
version 0.0.0
revision 0
supported_archs noarch
platforms any

description Common files for selecting the default opentofu \
version
long_description \
This port installs files that allow 'port select' \
to create links to the preferred default version of opentofu.
homepage https://www.macports.org/

distfiles
use_configure no
build {}

destroot {
select::install opentofu ${filespath}/base
select::install opentofu ${filespath}/none
}

livecheck.type none
} else {
set baseVersion [opentofuBaseVersion]
set baseName opentofu-${baseVersion}

version [opentofuVersion]

supported_archs x86_64 arm64

distname [opentofuDistBase]_amd64
if {${build_arch} eq "arm64"} {
distname [opentofuDistBase]_arm64
}

depends_run port:opentofu_select

description A tool for building, changing, and versioning \
infrastructure safely and efficiently.
long_description \
OpenTofu is an open source fork of Terraform. It \
allows users to define a datacenter infrastructure in \
a high-level configuration language, from which it can \
create an execution plan to build the infrastructure \
in a service provider such as AWS.

master_sites https://github.com/${name}/${name}/releases/download/v${version}

use_configure no
extract.mkdir yes

select.group opentofu
select.file ${workpath}/${baseName}

build {
file copy ${filespath}/opentofu-XX.template ${workpath}/${baseName}
reinplace "s|@@BASE_VERSION@@|${baseVersion}|g" ${workpath}/${baseName}
}

destroot {
xinstall ${worksrcpath}/tofu \
${destroot}${prefix}/bin/tofu-${baseVersion}
}

set regexVersionPart [string map {. {\.}} $baseVersion]
livecheck.type regex
livecheck.url https://github.com/opentofu/opentofu/tags.atom
livecheck.regex title>v(${regexVersionPart}\\.\\d+)</title

notes "
To make this the default opentofu run:
sudo port select --set opentofu ${baseName}
"
}
1 change: 1 addition & 0 deletions sysutils/opentofu/files/base
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/tofu
1 change: 1 addition & 0 deletions sysutils/opentofu/files/none
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-
1 change: 1 addition & 0 deletions sysutils/opentofu/files/opentofu-XX.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/tofu-@@BASE_VERSION@@