Files
cue/cue.spec
2025-10-02 16:55:21 +02:00

115 lines
3.4 KiB
RPMSpec

#
# spec file for package cue
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: cue
Version: 0.13.2
Release: 0
Summary: An open source data constraint language
License: Apache-2.0
URL: https://cuelang.org/
#!CreateArchive: cue
Source0: %{name}-%{version}.tar.gz
# Workaround: CreateArchive needs a version suffix. The unpacked directory is renamed
# to vendor/ in %prep
#!CreateArchive: vendor
Source1: vendor-1.tar.gz
BuildRequires: golang(API) >= 1.22
BuildRequires: golang-packaging
%description
CUE is an open source data constraint language which aims to simplify tasks involving defining and using data.
It is a superset of JSON, allowing users familiar with JSON to get started quickly.
%package bash-completion
Summary: Bash Completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Requires: bash-completion
Supplements: (%{name} and bash)
BuildArch: noarch
%description bash-completion
The official bash completion script for cue, generated during the build.
%package zsh-completion
Summary: ZSH Completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Supplements: (%{name} and zsh)
BuildArch: noarch
%description zsh-completion
The official zsh completion script for cue, generated during the build.
%package fish-completion
Summary: Fish Completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Supplements: (%{name} and fish)
BuildArch: noarch
%description fish-completion
The official fish completion script for cue, generated during the build.
%prep
%autosetup -a1
# go build expects vendor/
mv vendor-1 vendor
%build
mkdir build
go build -mod=vendor -o build/ -buildmode=pie ./cmd/cue
./build/cue completion bash > cue.bash
./build/cue completion zsh > cue.zsh
./build/cue completion fish > cue.fish
%install
install -D -m0755 build/%{name} %{buildroot}%{_bindir}/%{name}
install -D -m644 cue.bash %{buildroot}%{_datadir}/bash-completion/completions/cue
install -D -m644 cue.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/cue.fish
install -D -m644 cue.zsh %{buildroot}%{_datadir}/zsh/site-functions/_cue
%check
go test -skip TestCommits ./...
%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%files bash-completion
%license LICENSE
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/cue
%files fish-completion
%license LICENSE
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%{_datadir}/fish/vendor_completions.d/cue.fish
%files zsh-completion
%license LICENSE
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_cue
%changelog