Andrew Jeddeloh c14ed24
# Original spec file as generated by:
Andrew Jeddeloh c14ed24
#     gofed repo2spec --detect github.com/coreos/ignition --commit f7079129b8651ac51dba14c3af65692bb413c1dd  --with-extra --with-build -f
Andrew Jeddeloh c14ed24
# With:
Andrew Jeddeloh c14ed24
#     gofed/gofed:v1.0.1 docker image
333e3ff
333e3ff
333e3ff
# If any of the following macros should be set otherwise,
333e3ff
# you can wrap any of them with the following conditions:
333e3ff
# - %%if 0%%{centos} == 7
333e3ff
# - %%if 0%%{?rhel} == 7
333e3ff
# - %%if 0%%{?fedora} == 23
333e3ff
# Or just test for particular distribution:
333e3ff
# - %%if 0%%{centos}
333e3ff
# - %%if 0%%{?rhel}
333e3ff
# - %%if 0%%{?fedora}
333e3ff
#
333e3ff
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
333e3ff
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
333e3ff
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
333e3ff
333e3ff
# Generate devel rpm
333e3ff
%global with_devel 1
333e3ff
# Build project from bundled dependencies
333e3ff
%global with_bundled 0
333e3ff
# Build with debug info rpm
333e3ff
%global with_debug 1
333e3ff
# Run tests in check section
333e3ff
%global with_check 1
333e3ff
# Generate unit-test rpm
333e3ff
%global with_unit_test 1
333e3ff
333e3ff
%if 0%{?with_debug}
333e3ff
%global _dwz_low_mem_die_limit 0
333e3ff
%else
333e3ff
%global debug_package   %{nil}
333e3ff
%endif
333e3ff
333e3ff
%if ! 0%{?gobuild:1}
333e3ff
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
333e3ff
%endif
333e3ff
333e3ff
%global provider        github
333e3ff
%global provider_tld    com
333e3ff
%global project         coreos
333e3ff
%global repo            ignition
333e3ff
# https://github.com/coreos/ignition
333e3ff
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
333e3ff
%global import_path     %{provider_prefix}
Andrew Jeddeloh c14ed24
%global commit          f7079129b8651ac51dba14c3af65692bb413c1dd
333e3ff
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
333e3ff
333e3ff
Name:           golang-%{provider}-%{project}-%{repo}
333e3ff
Version:        0
333e3ff
Release:        0.1.git%{shortcommit}%{?dist}
333e3ff
Summary:        !!!!FILL!!!!
333e3ff
# Detected licences
333e3ff
# - Unknown at 'LICENSE'
333e3ff
License:        !!!!FILL!!!!
333e3ff
URL:            https://%{provider_prefix}
333e3ff
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
333e3ff
333e3ff
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
333e3ff
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
333e3ff
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
333e3ff
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
333e3ff
333e3ff
%if ! 0%{?with_bundled}
333e3ff
# validate/main.go
333e3ff
BuildRequires: golang(github.com/spf13/cobra)
333e3ff
333e3ff
# Remaining dependencies not included in main packages
Andrew Jeddeloh c14ed24
BuildRequires: golang(github.com/vmware/vmw-ovflib)
333e3ff
BuildRequires: golang(github.com/coreos/go-systemd/unit)
333e3ff
BuildRequires: golang(github.com/coreos/go-semver/semver)
333e3ff
BuildRequires: golang(github.com/sigma/vmw-guestinfo/vmcheck)
Andrew Jeddeloh c14ed24
BuildRequires: golang(github.com/pin/tftp)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/service/s3/s3manager)
333e3ff
BuildRequires: golang(github.com/sigma/vmw-guestinfo/rpcvmx)
333e3ff
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
Andrew Jeddeloh c14ed24
BuildRequires: golang(github.com/aws/aws-sdk-go/service/s3)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/session)
333e3ff
BuildRequires: golang(github.com/vincent-petithory/dataurl)
Andrew Jeddeloh c14ed24
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/awserr)
Andrew Jeddeloh c14ed24
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds)
333e3ff
BuildRequires: golang(github.com/ajeddeloh/go-json)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/credentials)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/ec2metadata)
Andrew Jeddeloh c14ed24
BuildRequires: golang(github.com/pborman/uuid)
Andrew Jeddeloh c14ed24
BuildRequires: golang(github.com/aws/aws-sdk-go/aws)
333e3ff
%endif
333e3ff
333e3ff
%description
333e3ff
%{summary}
333e3ff
333e3ff
%if 0%{?with_devel}
333e3ff
%package devel
333e3ff
Summary:       %{summary}
333e3ff
BuildArch:     noarch
333e3ff
333e3ff
%if 0%{?with_check} && ! 0%{?with_bundled}
333e3ff
BuildRequires: golang(github.com/ajeddeloh/go-json)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/aws)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/awserr)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/credentials)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/ec2metadata)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/aws/session)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/service/s3)
333e3ff
BuildRequires: golang(github.com/aws/aws-sdk-go/service/s3/s3manager)
333e3ff
BuildRequires: golang(github.com/coreos/go-semver/semver)
333e3ff
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
333e3ff
BuildRequires: golang(github.com/coreos/go-systemd/unit)
Andrew Jeddeloh c14ed24
BuildRequires: golang(github.com/pborman/uuid)
333e3ff
BuildRequires: golang(github.com/pin/tftp)
333e3ff
BuildRequires: golang(github.com/sigma/vmw-guestinfo/rpcvmx)
333e3ff
BuildRequires: golang(github.com/sigma/vmw-guestinfo/vmcheck)
333e3ff
BuildRequires: golang(github.com/vincent-petithory/dataurl)
333e3ff
BuildRequires: golang(github.com/vmware/vmw-ovflib)
333e3ff
%endif
333e3ff
333e3ff
Requires:      golang(github.com/ajeddeloh/go-json)
333e3ff
Requires:      golang(github.com/aws/aws-sdk-go/aws)
333e3ff
Requires:      golang(github.com/aws/aws-sdk-go/aws/awserr)
333e3ff
Requires:      golang(github.com/aws/aws-sdk-go/aws/credentials)
333e3ff
Requires:      golang(github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds)
333e3ff
Requires:      golang(github.com/aws/aws-sdk-go/aws/ec2metadata)
333e3ff
Requires:      golang(github.com/aws/aws-sdk-go/aws/session)
333e3ff
Requires:      golang(github.com/aws/aws-sdk-go/service/s3)
333e3ff
Requires:      golang(github.com/aws/aws-sdk-go/service/s3/s3manager)
333e3ff
Requires:      golang(github.com/coreos/go-semver/semver)
333e3ff
Requires:      golang(github.com/coreos/go-systemd/dbus)
333e3ff
Requires:      golang(github.com/coreos/go-systemd/unit)
Andrew Jeddeloh c14ed24
Requires:      golang(github.com/pborman/uuid)
333e3ff
Requires:      golang(github.com/pin/tftp)
333e3ff
Requires:      golang(github.com/sigma/vmw-guestinfo/rpcvmx)
333e3ff
Requires:      golang(github.com/sigma/vmw-guestinfo/vmcheck)
333e3ff
Requires:      golang(github.com/vincent-petithory/dataurl)
333e3ff
Requires:      golang(github.com/vmware/vmw-ovflib)
333e3ff
333e3ff
Provides:      golang(%{import_path}/config/shared) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/shared/errors) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/shared/validations) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/util) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v1) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v1/types) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v2_0) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v2_0/types) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v2_1) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v2_1/types) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v2_2) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v2_2/types) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v2_3_experimental) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/v2_3_experimental/types) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/validate) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/validate/astjson) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/validate/astnode) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/config/validate/report) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/negative/files) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/negative/filesystems) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/negative/general) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/negative/networkd) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/negative/partitions) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/negative/regression) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/negative/security) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/negative/timeouts) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/files) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/filesystems) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/general) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/networkd) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/oem) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/partitions) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/passwd) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/regression) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/security) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/systemd) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/positive/timeouts) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/register) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/registry) = %{version}-%{release}
333e3ff
Provides:      golang(%{import_path}/tests/types) = %{version}-%{release}
333e3ff
333e3ff
%description devel
333e3ff
%{summary}
333e3ff
333e3ff
This package contains library source intended for
333e3ff
building other packages which use import path with
333e3ff
%{import_path} prefix.
333e3ff
%endif
333e3ff
333e3ff
%if 0%{?with_unit_test} && 0%{?with_devel}
333e3ff
%package unit-test-devel
333e3ff
Summary:         Unit tests for %{name} package
333e3ff
%if 0%{?with_check}
333e3ff
#Here comes all BuildRequires: PACKAGE the unit tests
333e3ff
#in %%check section need for running
333e3ff
%endif
333e3ff
333e3ff
# test subpackage tests code from devel subpackage
333e3ff
Requires:        %{name}-devel = %{version}-%{release}
333e3ff
333e3ff
%if 0%{?with_check} && ! 0%{?with_bundled}
333e3ff
BuildRequires: golang(github.com/stretchr/testify/assert)
333e3ff
%endif
333e3ff
333e3ff
Requires:      golang(github.com/stretchr/testify/assert)
333e3ff
333e3ff
%description unit-test-devel
333e3ff
%{summary}
333e3ff
333e3ff
This package contains unit tests for project
333e3ff
providing packages with %{import_path} prefix.
333e3ff
%endif
333e3ff
333e3ff
%prep
333e3ff
%setup -q -n %{repo}-%{commit}
333e3ff
333e3ff
%build
333e3ff
mkdir -p src/%{provider}.%{provider_tld}/%{project}
333e3ff
ln -s ../../../ src/%{import_path}
333e3ff
333e3ff
%if ! 0%{?with_bundled}
333e3ff
export GOPATH=$(pwd):%{gopath}
333e3ff
%else
333e3ff
# No dependency directories so far
333e3ff
export GOPATH=$(pwd):%{gopath}
333e3ff
%endif
333e3ff
333e3ff
#%gobuild -o bin/internal %{import_path}/internal
333e3ff
#%gobuild -o bin/internal/util/tools/docs %{import_path}/internal/util/tools/docs
333e3ff
#%gobuild -o bin/tests/stubs/id-stub %{import_path}/tests/stubs/id-stub
333e3ff
#%gobuild -o bin/tests/stubs/useradd-stub %{import_path}/tests/stubs/useradd-stub
333e3ff
#%gobuild -o bin/tests/stubs/usermod-stub %{import_path}/tests/stubs/usermod-stub
333e3ff
#%gobuild -o bin/validate %{import_path}/validate
333e3ff
333e3ff
%install
333e3ff
install -d -p %{buildroot}%{_bindir}
333e3ff
#install -p -m 0755 bin/internal %{buildroot}%{_bindir}
333e3ff
#install -p -m 0755 bin/internal/util/tools/docs %{buildroot}%{_bindir}
333e3ff
#install -p -m 0755 bin/tests/stubs/id-stub %{buildroot}%{_bindir}
333e3ff
#install -p -m 0755 bin/tests/stubs/useradd-stub %{buildroot}%{_bindir}
333e3ff
#install -p -m 0755 bin/tests/stubs/usermod-stub %{buildroot}%{_bindir}
333e3ff
#install -p -m 0755 bin/validate %{buildroot}%{_bindir}
333e3ff
333e3ff
# source codes for building projects
333e3ff
%if 0%{?with_devel}
333e3ff
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
333e3ff
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
333e3ff
# find all *.go but no *_test.go files and generate devel.file-list
333e3ff
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go" | grep -v "vendor") ; do
333e3ff
    dirprefix=$(dirname $file)
333e3ff
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
333e3ff
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
333e3ff
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
333e3ff
333e3ff
    while [ "$dirprefix" != "." ]; do
333e3ff
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
333e3ff
        dirprefix=$(dirname $dirprefix)
333e3ff
    done
333e3ff
done
333e3ff
%endif
333e3ff
333e3ff
# testing files for this project
333e3ff
%if 0%{?with_unit_test} && 0%{?with_devel}
333e3ff
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
333e3ff
# find all *_test.go files and generate unit-test-devel.file-list
333e3ff
for file in $(find . -iname "*_test.go" | grep -v "vendor") ; do
333e3ff
    dirprefix=$(dirname $file)
333e3ff
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
333e3ff
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
333e3ff
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
333e3ff
333e3ff
    while [ "$dirprefix" != "." ]; do
333e3ff
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
333e3ff
        dirprefix=$(dirname $dirprefix)
333e3ff
    done
333e3ff
done
333e3ff
%endif
333e3ff
333e3ff
%if 0%{?with_devel}
333e3ff
sort -u -o devel.file-list devel.file-list
333e3ff
%endif
333e3ff
333e3ff
%check
333e3ff
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
333e3ff
%if ! 0%{?with_bundled}
333e3ff
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
333e3ff
%else
333e3ff
# Since we aren't packaging up the vendor directory we need to link
333e3ff
# back to it somehow. Hack it up so that we can add the vendor
333e3ff
# directory from BUILD dir as a gopath to be searched when executing
333e3ff
# tests from the BUILDROOT dir.
333e3ff
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor
333e3ff
333e3ff
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
333e3ff
%endif
333e3ff
333e3ff
%if ! 0%{?gotest:1}
333e3ff
%global gotest go test
333e3ff
%endif
333e3ff
333e3ff
%gotest %{import_path}/config/v1
333e3ff
%gotest %{import_path}/config/v1/types
333e3ff
%gotest %{import_path}/config/v2_0
333e3ff
%gotest %{import_path}/config/v2_0/types
333e3ff
%gotest %{import_path}/config/v2_1
333e3ff
%gotest %{import_path}/config/v2_1/types
333e3ff
%gotest %{import_path}/config/v2_2
333e3ff
%gotest %{import_path}/config/v2_2/types
333e3ff
%gotest %{import_path}/config/v2_3_experimental
333e3ff
%gotest %{import_path}/config/v2_3_experimental/types
333e3ff
%gotest %{import_path}/config/validate
333e3ff
%gotest %{import_path}/internal/config
333e3ff
%gotest %{import_path}/internal/exec/stages/files
333e3ff
%gotest %{import_path}/internal/exec/util
333e3ff
%gotest %{import_path}/internal/registry
333e3ff
%gotest %{import_path}/internal/util
333e3ff
%gotest %{import_path}/tests
333e3ff
%endif
333e3ff
333e3ff
#define license tag if not already defined
333e3ff
%{!?_licensedir:%global license %doc}
333e3ff
333e3ff
%files
333e3ff
%license LICENSE
Andrew Jeddeloh c14ed24
%doc README.md code-of-conduct.md CONTRIBUTING.md
333e3ff
#%{_bindir}/internal
333e3ff
#%{_bindir}/internal/util/tools/docs
333e3ff
#%{_bindir}/tests/stubs/id-stub
333e3ff
#%{_bindir}/tests/stubs/useradd-stub
333e3ff
#%{_bindir}/tests/stubs/usermod-stub
333e3ff
#%{_bindir}/validate
333e3ff
333e3ff
%if 0%{?with_devel}
333e3ff
%files devel -f devel.file-list
333e3ff
%license LICENSE
Andrew Jeddeloh c14ed24
%doc README.md code-of-conduct.md CONTRIBUTING.md
333e3ff
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
333e3ff
%endif
333e3ff
333e3ff
%if 0%{?with_unit_test} && 0%{?with_devel}
333e3ff
%files unit-test-devel -f unit-test-devel.file-list
333e3ff
%license LICENSE
Andrew Jeddeloh c14ed24
%doc README.md code-of-conduct.md CONTRIBUTING.md
333e3ff
%endif
333e3ff
Andrew Jeddeloh c14ed24
%changelog* Thu Aug 30 2018 root - 0-0.1.gitf707912
333e3ff
- First package for Fedora
333e3ff