Skip to content

Commit

Permalink
opentofu: add new package opentofu v1.6.2 (#8654)
Browse files Browse the repository at this point in the history
  • Loading branch information
trungams committed Apr 4, 2024
1 parent f1587f4 commit e6f03ca
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions LICENSES-AND-NOTICES/SPECS/data/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@
"openssl",
"openssl-ibmpkcs11",
"openssl-pkcs11",
"opentofu",
"openwsman",
"optipng",
"opus",
Expand Down
117 changes: 117 additions & 0 deletions SPECS/opentofu/generate_source_tarball.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Quit on failure
set -e

PKG_VERSION=""
SRC_TARBALL=""
VENDOR_VERSION="1"
OUT_FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# parameters:
#
# --srcTarball : src tarball file
# this file contains the 'initial' source code of the component
# and should be replaced with the new/modified src code
# --outFolder : folder where to copy the new tarball(s)
# --pkgVersion : package version
# --vendorVersion : vendor version
#
PARAMS=""
while (( "$#" )); do
case "$1" in
--srcTarball)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
SRC_TARBALL=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
--outFolder)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
OUT_FOLDER=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
--pkgVersion)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
PKG_VERSION=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
--vendorVersion)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
VENDOR_VERSION=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-*|--*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2
exit 1
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done

echo "--srcTarball -> $SRC_TARBALL"
echo "--outFolder -> $OUT_FOLDER"
echo "--pkgVersion -> $PKG_VERSION"
echo "--vendorVersion -> $VENDOR_VERSION"

if [ -z "$PKG_VERSION" ]; then
echo "--pkgVersion parameter cannot be empty"
exit 1
fi

echo "-- create temp folder"
tmpdir=$(mktemp -d)
function cleanup {
echo "+++ cleanup -> remove $tmpdir"
rm -rf $tmpdir
}
trap cleanup EXIT

TARBALL_FOLDER="$tmpdir/tarballFolder"
mkdir -p $TARBALL_FOLDER
cp $SRC_TARBALL $tmpdir

pushd $tmpdir > /dev/null

PKG_NAME="opentofu"
NAME_VER="$PKG_NAME-$PKG_VERSION"
VENDOR_TARBALL="$OUT_FOLDER/$NAME_VER-govendor-v$VENDOR_VERSION.tar.gz"

echo "Unpacking source tarball..."
tar -xf $SRC_TARBALL
cd $NAME_VER

echo "Vendor go modules..."
go mod vendor

echo ""
echo "========================="
echo "Tar vendored tarball"
tar --sort=name \
--mtime="2021-04-26 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-czf "$VENDOR_TARBALL" vendor

popd > /dev/null
echo "$PKG_NAME vendored modules are available at $VENDOR_TARBALL"
6 changes: 6 additions & 0 deletions SPECS/opentofu/opentofu.signatures.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"Signatures": {
"opentofu-1.6.2.tar.gz": "3bf0fc807004ba26305331ecf1334ff2160f8c131ee53c107292d60069400da6",
"opentofu-1.6.2-govendor-v1.tar.gz": "dc735fbddb7555b3aa4f4840ee4d10108c93d54aaedb8c2002aedaa4d5151ce6"
}
}
69 changes: 69 additions & 0 deletions SPECS/opentofu/opentofu.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
%bcond_without vendor

Name: opentofu
Version: 1.6.2
Release: 1%{?dist}
Summary: OpenTofu lets you declaratively manage your cloud infrastructure
Vendor: Microsoft Corporation
Distribution: Azure Linux

License: 0BSD AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT AND MPL-2.0
URL: https://github.com/opentofu/opentofu
Source0: https://github.com/opentofu/opentofu/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: %{name}-%{version}-govendor-v1.tar.gz

BuildRequires: golang

%description
OpenTofu lets you declaratively manage your cloud infrastructure.

%prep
%autosetup -p1 %{?with_vendor:-a1}

%build
export VERSION=%{version}
export LDFLAGS="-X github.com/opentofu/opentofu/version.dev=no \
-X github.com/opentofu/opentofu/version=$VERSION \
-extldflags '-Wl,-z,relro'"
go build \
-buildmode pie \
-compiler gc \
-tags="rpm_crashtraceback" \
-ldflags "$LDFLAGS" \
%{?with_vendor:-mod=vendor } \
-a -v -x \
-o ./bin/tofu \
github.com/opentofu/opentofu/cmd/tofu

%install
install -m 0755 -vd %{buildroot}%{_bindir}
install -m 0755 -vp ./bin/* %{buildroot}%{_bindir}/

%check
# Disabling some tests:
# - TestFileExists: This contains a test case where a file permisison is set to 000
# and the test expects the file cannot be found. However, since we are running
# %check section as root, we can always see the file, thus fail the unit test.
for test in "TestFileExists" \
; do
awk -i inplace '/^func.*'"$test"'\(/ { print; print "\tt.Skip(\"disabled failing test\")"; next}1' $(grep -rl $test)
done
go test -mod=vendor ./...

%files
%license LICENSE %{?with_vendor:vendor/modules.txt}
%doc docs BUILDING.md CODE_OF_CONDUCT.md DEBUGGING.md MIGRATION_GUIDE.md
%doc SECURITY.md README.md CHANGELOG.md CONTRIBUTING.md TSC_SUMMARY.md
%doc WEEKLY_UPDATES.md
%{_bindir}/tofu

%changelog
* Mon Apr 01 2024 - Thien Trung Vuong <[email protected]> - 1.6.2-1
- Initial Azure Linux import from Fedora 40 (license: MIT).
- License verified.

* Thu Feb 08 2024 - Mikel Olasagasti Uranga <[email protected]> - 1.6.1-2
- Don't include devel files

* Mon Feb 05 2024 - Mikel Olasagasti Uranga <[email protected]> - 1.6.1-1
- Initial package - Closes rhbz#2258867
10 changes: 10 additions & 0 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15238,6 +15238,16 @@
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "opentofu",
"version": "1.6.2",
"downloadUrl": "https://github.com/opentofu/opentofu/archive/v1.6.2.tar.gz"
}
}
},
{
"component": {
"type": "other",
Expand Down

0 comments on commit e6f03ca

Please sign in to comment.