bfc63f7
# With Fedora, nothing is bundled. For everything else, bundling is used.
bfc63f7
# To use bundled stuff, use "--with vendorized" on rpmbuild
bfc63f7
%if 0%{?fedora}
bfc63f7
%bcond_with vendorized
bfc63f7
%else
bfc63f7
%bcond_without vendorized
bfc63f7
%endif
bfc63f7
c7ccede
%global with_devel 1
c7ccede
%global with_debug 1
c7ccede
%global with_check 0
c7ccede
%global with_unit_test 0
bfc63f7
71bd7e0
# For the moment, we don't support all golang arches...
71bd7e0
%global with_goarches 0
71bd7e0
bfc63f7
%if ! %{with vendorized}
c7ccede
%global with_bundled 0
bfc63f7
%else
bfc63f7
%global with_bundled 1
c7ccede
%endif
c7ccede
c7ccede
%if 0%{?with_debug}
c7ccede
%global _dwz_low_mem_die_limit 0
c7ccede
%else
c7ccede
%global debug_package   %{nil}
c7ccede
%endif
c7ccede
c7ccede
%global provider        github
c7ccede
%global provider_tld    com
c7ccede
%global project         snapcore
c7ccede
%global repo            snapd
c7ccede
# https://github.com/snapcore/snapd
c7ccede
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
c7ccede
%global import_path     %{provider_prefix}
c7ccede
bfc63f7
%global snappy_svcs     snapd.service snapd.socket snapd.autoimport.service snapd.refresh.timer snapd.refresh.service
c7ccede
c7ccede
Name:           snapd
bfc63f7
Version:        2.23.6
bfc63f7
Release:        1%{?dist}
c7ccede
Summary:        A transactional software package manager
bfc63f7
Group:          System Environment/Base
c7ccede
License:        GPLv3
c7ccede
URL:            https://%{provider_prefix}
bfc63f7
%if ! 0%{?with_bundled}
c7ccede
Source0:        https://%{provider_prefix}/archive/%{version}/%{name}-%{version}.tar.gz
bfc63f7
%else
bfc63f7
Source0:        https://%{provider_prefix}/releases/download/%{version}/%{name}_%{version}.tar.xz
bfc63f7
%endif
aa64e81
bfc63f7
# Upstream proposed PR (supersedes this patch): https://github.com/snapcore/snapd/pull/3039
bfc63f7
Patch0001:      0001-cmd-link-libcap-dynamically.patch
bfc63f7
# Upstream merged: https://github.com/snapcore/snapd/pull/2989
bfc63f7
Patch0002:      0002-cmd-remove-unused-variable.patch
bfc63f7
# Upstream merged: https://github.com/snapcore/snapd/pull/2989
bfc63f7
Patch0003:      0003-cmd-add-directive-for-shellcheck-and-follow-source.patch
1156fbd
# Upstream pproposed PR: https://github.com/snapcore/snapd/pull/3108
bfc63f7
Patch0004:      0004-cmd-use-libtool-for-the-internal-library.patch
bfc63f7
# Upstream merged: https://github.com/snapcore/snapd/pull/2989
bfc63f7
Patch0006:      0006-errtracker-fix-testing-outside-of-ubuntu.patch
bfc63f7
# Upstream proposed PR: https://github.com/snapcore/snapd/pull/3096
bfc63f7
Patch0007:      0007-osutil-HACK-use-usr-bin-true-false.patch
bfc63f7
# Upstream merged: https://github.com/snapcore/snapd/pull/3001
bfc63f7
Patch0008:      0008-partition-skip-some-tests-if-grub-editenv-is-not-ava.patch
a823527
# Upstream merged: https://github.com/snapcore/snapd/pull/3081
a823527
Patch0009:      0001-data-selinux-Add-context-definition-for-snapctl.patch
3f78eaa
# Upstream merged: https://github.com/snapcore/snapd/pull/3094
3f78eaa
Patch0010:      0001-cmd-rework-header-check-for-xfs-xqm.patch
71bd7e0
# No upstream status yet
71bd7e0
Patch0011:      0001-cmd-snap-confine-hardcode-constants-from-xfs-xqm.h-f.patch
bfc63f7
bfc63f7
# Upstream proposed PR: https://github.com/snapcore/snapd/pull/3084
bfc63f7
Patch1001:      PR3084-packaging-use-templates-for-systemd-units.patch
c7ccede
71bd7e0
%if 0%{?with_goarches}
c7ccede
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
c7ccede
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
71bd7e0
%else
71bd7e0
# Verified arches from snapd upstream
71bd7e0
ExclusiveArch:  %{ix86} x86_64 %{arm} aarch64 ppc64le s390x
71bd7e0
%endif
71bd7e0
c7ccede
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
c7ccede
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
c7ccede
# BuildRequires:  systemd-units
c7ccede
BuildRequires:  systemd
c7ccede
%{?systemd_requires}
71bd7e0
bfc63f7
Requires:       snap-confine%{?_isa} = %{version}-%{release}
c7ccede
Requires:       squashfs-tools
c7ccede
# we need squashfs.ko loaded
c7ccede
Requires:       kmod(squashfs.ko)
c7ccede
c7ccede
# Force the SELinux module to be installed
c7ccede
Requires:       %{name}-selinux = %{version}-%{release}
c7ccede
c7ccede
%if ! 0%{?with_bundled}
c7ccede
BuildRequires: golang(github.com/cheggaaa/pb)
c7ccede
BuildRequires: golang(github.com/coreos/go-systemd/activation)
c7ccede
BuildRequires: golang(github.com/gorilla/mux)
c7ccede
BuildRequires: golang(github.com/jessevdk/go-flags)
c7ccede
BuildRequires: golang(github.com/mvo5/uboot-go/uenv)
bfc63f7
BuildRequires: golang(github.com/ojii/gettext.go)
bfc63f7
BuildRequires: golang(golang.org/x/crypto/openpgp/armor)
bfc63f7
BuildRequires: golang(golang.org/x/crypto/openpgp/packet)
bfc63f7
BuildRequires: golang(golang.org/x/crypto/sha3)
c7ccede
BuildRequires: golang(golang.org/x/crypto/ssh/terminal)
bfc63f7
BuildRequires: golang(golang.org/x/net/context)
bfc63f7
BuildRequires: golang(golang.org/x/net/context/ctxhttp)
c7ccede
BuildRequires: golang(gopkg.in/check.v1)
bfc63f7
BuildRequires: golang(gopkg.in/macaroon.v1)
bfc63f7
BuildRequires: golang(gopkg.in/mgo.v2/bson)
bfc63f7
BuildRequires: golang(gopkg.in/retry.v1)
c7ccede
BuildRequires: golang(gopkg.in/tomb.v2)
c7ccede
BuildRequires: golang(gopkg.in/yaml.v2)
c7ccede
%endif
c7ccede
c7ccede
%description
c7ccede
Snappy is a modern, cross-distribution, transactional package manager designed for
c7ccede
working with self-contained, immutable packages.
c7ccede
bfc63f7
%package -n snap-confine
bfc63f7
Summary:        Confinement system for snap applications
bfc63f7
License:        GPLv3
bfc63f7
Group:          System Environment/Base
bfc63f7
BuildRequires:  autoconf
bfc63f7
BuildRequires:  automake
bfc63f7
BuildRequires:  libtool
bfc63f7
BuildRequires:  gcc
bfc63f7
BuildRequires:  indent
bfc63f7
BuildRequires:  pkgconfig(glib-2.0)
bfc63f7
BuildRequires:  pkgconfig(libcap)
bfc63f7
BuildRequires:  pkgconfig(libseccomp)
bfc63f7
BuildRequires:  pkgconfig(libudev)
bfc63f7
BuildRequires:  pkgconfig(systemd)
bfc63f7
BuildRequires:  pkgconfig(udev)
bfc63f7
BuildRequires:  xfsprogs-devel
bfc63f7
BuildRequires:  glibc-static
bfc63f7
BuildRequires:  valgrind
bfc63f7
BuildRequires:  %{_bindir}/rst2man
bfc63f7
BuildRequires:  %{_bindir}/shellcheck
bfc63f7
bfc63f7
# Ensures older version from split packaging is replaced
bfc63f7
Obsoletes:      snap-confine < 2.19
bfc63f7
bfc63f7
%description -n snap-confine
bfc63f7
The package is used internally by snapd to apply confinement to the started
bfc63f7
snap applications.
bfc63f7
c7ccede
%package selinux
c7ccede
Summary:        SELinux module for snapd
bfc63f7
Group:          System Environment/Base
c7ccede
License:        GPLv2+
c7ccede
BuildArch:      noarch
c7ccede
BuildRequires:  selinux-policy, selinux-policy-devel
c7ccede
Requires(post): selinux-policy-base >= %{_selinux_policy_version}
c7ccede
Requires(post): policycoreutils
c7ccede
Requires(post): policycoreutils-python-utils
c7ccede
Requires(pre):  libselinux-utils
c7ccede
Requires(post): libselinux-utils
c7ccede
c7ccede
%description selinux
c7ccede
This package provides the SELinux policy module to ensure snapd runs properly
c7ccede
under an environment with SELinux enabled.
c7ccede
c7ccede
c7ccede
%if 0%{?with_devel}
c7ccede
%package devel
c7ccede
Summary:       %{summary}
c7ccede
BuildArch:     noarch
c7ccede
c7ccede
%if 0%{?with_check} && ! 0%{?with_bundled}
c7ccede
%endif
c7ccede
bfc63f7
%if ! 0%{?with_bundled}
bfc63f7
Requires:      golang(github.com/cheggaaa/pb)
bfc63f7
Requires:      golang(github.com/coreos/go-systemd/activation)
bfc63f7
Requires:      golang(github.com/gorilla/mux)
bfc63f7
Requires:      golang(github.com/jessevdk/go-flags)
bfc63f7
Requires:      golang(github.com/mvo5/uboot-go/uenv)
bfc63f7
Requires:      golang(github.com/ojii/gettext.go)
bfc63f7
Requires:      golang(golang.org/x/crypto/openpgp/armor)
bfc63f7
Requires:      golang(golang.org/x/crypto/openpgp/packet)
bfc63f7
Requires:      golang(golang.org/x/crypto/sha3)
bfc63f7
Requires:      golang(golang.org/x/crypto/ssh/terminal)
bfc63f7
Requires:      golang(golang.org/x/net/context)
bfc63f7
Requires:      golang(golang.org/x/net/context/ctxhttp)
bfc63f7
Requires:      golang(gopkg.in/check.v1)
bfc63f7
Requires:      golang(gopkg.in/macaroon.v1)
bfc63f7
Requires:      golang(gopkg.in/mgo.v2/bson)
bfc63f7
Requires:      golang(gopkg.in/retry.v1)
bfc63f7
Requires:      golang(gopkg.in/tomb.v2)
bfc63f7
Requires:      golang(gopkg.in/yaml.v2)
bfc63f7
%else
bfc63f7
# These Provides are unversioned because the sources in
bfc63f7
# the bundled tarball are unversioned (they go by git commit)
bfc63f7
# *sigh*... I hate golang...
bfc63f7
Provides:      bundled(golang(github.com/cheggaaa/pb))
bfc63f7
Provides:      bundled(golang(github.com/coreos/go-systemd/activation))
bfc63f7
Provides:      bundled(golang(github.com/gorilla/mux))
bfc63f7
Provides:      bundled(golang(github.com/jessevdk/go-flags))
bfc63f7
Provides:      bundled(golang(github.com/mvo5/uboot-go/uenv))
bfc63f7
Provides:      bundled(golang(github.com/ojii/gettext.go))
bfc63f7
Provides:      bundled(golang(golang.org/x/crypto/openpgp/armor))
bfc63f7
Provides:      bundled(golang(golang.org/x/crypto/openpgp/packet))
bfc63f7
Provides:      bundled(golang(golang.org/x/crypto/sha3))
bfc63f7
Provides:      bundled(golang(golang.org/x/crypto/ssh/terminal))
bfc63f7
Provides:      bundled(golang(golang.org/x/net/context))
bfc63f7
Provides:      bundled(golang(golang.org/x/net/context/ctxhttp))
bfc63f7
Provides:      bundled(golang(gopkg.in/check.v1))
bfc63f7
Provides:      bundled(golang(gopkg.in/macaroon.v1))
bfc63f7
Provides:      bundled(golang(gopkg.in/mgo.v2/bson))
bfc63f7
Provides:      bundled(golang(gopkg.in/retry.v1))
bfc63f7
Provides:      bundled(golang(gopkg.in/tomb.v2))
bfc63f7
Provides:      bundled(golang(gopkg.in/yaml.v2))
bfc63f7
%endif
bfc63f7
bfc63f7
# Generated by gofed
bfc63f7
Provides:      golang(%{import_path}/arch) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/asserts) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/asserts/assertstest) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/asserts/signtool) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/asserts/snapasserts) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/asserts/sysdb) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/asserts/systestkeys) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/boot) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/boot/boottest) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/client) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/cmd) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/daemon) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/dirs) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/errtracker) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/httputil) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/i18n) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/i18n/dumb) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/image) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/apparmor) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/backends) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/builtin) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/dbus) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/ifacetest) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/kmod) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/mount) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/policy) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/seccomp) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/systemd) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/interfaces/udev) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/logger) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/osutil) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/assertstate) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/auth) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/configstate) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/configstate/config) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/devicestate) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/hookstate) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/hookstate/ctlcmd) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/hookstate/hooktest) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/ifacestate) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/patch) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/snapstate) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/snapstate/backend) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/overlord/state) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/partition) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/partition/grubenv) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/progress) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/provisioning) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/release) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/snap) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/snap/snapdir) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/snap/snapenv) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/snap/snaptest) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/snap/squashfs) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/store) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/strutil) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/systemd) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/tests/lib/fakestore/refresh) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/tests/lib/fakestore/store) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/testutil) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/timeout) = %{version}-%{release}
bfc63f7
Provides:      golang(%{import_path}/wrappers) = %{version}-%{release}
bfc63f7
c7ccede
c7ccede
%description devel
c7ccede
%{summary}
c7ccede
c7ccede
This package contains library source intended for
c7ccede
building other packages which use import path with
c7ccede
%{import_path} prefix.
c7ccede
%endif
c7ccede
c7ccede
%if 0%{?with_unit_test} && 0%{?with_devel}
c7ccede
%package unit-test-devel
c7ccede
Summary:         Unit tests for %{name} package
bfc63f7
c7ccede
%if 0%{?with_check}
c7ccede
#Here comes all BuildRequires: PACKAGE the unit tests
c7ccede
#in %%check section need for running
c7ccede
%endif
c7ccede
bfc63f7
%if 0%{?with_check} && ! 0%{?with_bundled}
bfc63f7
BuildRequires: golang(github.com/mvo5/goconfigparser)
bfc63f7
%endif
bfc63f7
bfc63f7
%if ! 0%{?with_bundled}
bfc63f7
Requires:      golang(github.com/mvo5/goconfigparser)
bfc63f7
%else
bfc63f7
Provides:      bundled(golang(github.com/mvo5/goconfigparser))
bfc63f7
%endif
bfc63f7
c7ccede
# test subpackage tests code from devel subpackage
c7ccede
Requires:        %{name}-devel = %{version}-%{release}
c7ccede
c7ccede
%description unit-test-devel
c7ccede
%{summary}
c7ccede
c7ccede
This package contains unit tests for project
c7ccede
providing packages with %{import_path} prefix.
c7ccede
%endif
c7ccede
c7ccede
%prep
bfc63f7
%autosetup -p1
aa64e81
c7ccede
c7ccede
%build
bfc63f7
# Generate version files
bfc63f7
./mkversion.sh "%{version}-%{release}"
c7ccede
c7ccede
# Build snapd
c7ccede
mkdir -p src/github.com/snapcore
c7ccede
ln -s ../../../ src/github.com/snapcore/snapd
c7ccede
c7ccede
%if ! 0%{?with_bundled}
c7ccede
export GOPATH=$(pwd):%{gopath}
c7ccede
%else
c7ccede
export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
c7ccede
%endif
c7ccede
c7ccede
%gobuild -o bin/snap %{import_path}/cmd/snap
c7ccede
%gobuild -o bin/snap-exec %{import_path}/cmd/snap-exec
bfc63f7
%gobuild -o bin/snapctl %{import_path}/cmd/snapctl
c7ccede
%gobuild -o bin/snapd %{import_path}/cmd/snapd
c7ccede
bfc63f7
# Build SELinux module
bfc63f7
pushd ./data/selinux
bfc63f7
make SHARE="%{_datadir}" TARGETS="snappy"
bfc63f7
popd
bfc63f7
bfc63f7
# Build snap-confine
bfc63f7
pushd ./cmd
bfc63f7
autoreconf --force --install --verbose
bfc63f7
# selinux support is not yet available, for now just disable apparmor
bfc63f7
# FIXME: add --enable-caps-over-setuid as soon as possible (setuid discouraged!)
bfc63f7
%configure \
bfc63f7
    --disable-apparmor \
bfc63f7
    --libexecdir=%{_libexecdir}/snapd/ \
bfc63f7
    --with-snap-mount-dir=%{_sharedstatedir}/snapd/snap \
bfc63f7
    --with-merged-usr
bfc63f7
bfc63f7
%make_build
bfc63f7
popd
bfc63f7
bfc63f7
# Build systemd units
bfc63f7
pushd ./data/systemd
bfc63f7
make BINDIR="%{_bindir}" LIBEXECDIR="%{_libexecdir}" \
bfc63f7
     SNAP_MOUNTDIR="%{_sharedstatedir}/snapd/snap" \
bfc63f7
     SNAPD_ENVIRONMENT_FILE="%{_sysconfdir}/sysconfig/snapd"
bfc63f7
popd
c7ccede
c7ccede
%install
c7ccede
install -d -p %{buildroot}%{_bindir}
c7ccede
install -d -p %{buildroot}%{_libexecdir}/snapd
c7ccede
install -d -p %{buildroot}%{_mandir}/man1
c7ccede
install -d -p %{buildroot}%{_unitdir}
c7ccede
install -d -p %{buildroot}%{_sysconfdir}/profile.d
c7ccede
install -d -p %{buildroot}%{_sysconfdir}/sysconfig
c7ccede
install -d -p %{buildroot}%{_sharedstatedir}/snapd/assertions
c7ccede
install -d -p %{buildroot}%{_sharedstatedir}/snapd/desktop
c7ccede
install -d -p %{buildroot}%{_sharedstatedir}/snapd/mount
c7ccede
install -d -p %{buildroot}%{_sharedstatedir}/snapd/seccomp
c7ccede
install -d -p %{buildroot}%{_sharedstatedir}/snapd/snaps
c7ccede
install -d -p %{buildroot}%{_sharedstatedir}/snapd/snap
c7ccede
install -d -p %{buildroot}%{_localstatedir}/snap
c7ccede
install -d -p %{buildroot}%{_datadir}/selinux/devel/include/contrib
c7ccede
install -d -p %{buildroot}%{_datadir}/selinux/packages
c7ccede
c7ccede
# Install snap and snapd
c7ccede
install -p -m 0755 bin/snap %{buildroot}%{_bindir}
c7ccede
install -p -m 0755 bin/snap-exec %{buildroot}%{_libexecdir}/snapd
bfc63f7
install -p -m 0755 bin/snapctl %{buildroot}%{_bindir}/snapctl
c7ccede
install -p -m 0755 bin/snapd %{buildroot}%{_libexecdir}/snapd
c7ccede
bfc63f7
# Install SELinux module
bfc63f7
install -p -m 0644 data/selinux/snappy.if %{buildroot}%{_datadir}/selinux/devel/include/contrib
bfc63f7
install -p -m 0644 data/selinux/snappy.pp.bz2 %{buildroot}%{_datadir}/selinux/packages
bfc63f7
c7ccede
# Install snap(1) man page
c7ccede
bin/snap help --man > %{buildroot}%{_mandir}/man1/snap.1
c7ccede
bfc63f7
# Install snap-confine
bfc63f7
pushd ./cmd
bfc63f7
%make_install
bfc63f7
# Undo the 0000 permissions, they are restored in the %%files section below
bfc63f7
chmod 0755 %{buildroot}%{_sharedstatedir}/snapd/void
bfc63f7
# We don't use AppArmor
bfc63f7
rm -rfv %{buildroot}%{_sysconfdir}/apparmor.d
bfc63f7
# ubuntu-core-launcher is dead
bfc63f7
rm -fv %{buildroot}%{_bindir}/ubuntu-core-launcher
bfc63f7
popd
bfc63f7
c7ccede
# Install all systemd units
bfc63f7
pushd ./data/systemd
bfc63f7
%make_install SYSTEMDSYSTEMUNITDIR="%{_unitdir}"
bfc63f7
# Remove snappy core specific units
bfc63f7
rm -fv %{buildroot}%{_unitdir}/snapd.system-shutdown.service
bfc63f7
popd
c7ccede
c7ccede
# Put /var/lib/snapd/snap/bin on PATH
c7ccede
# Put /var/lib/snapd/desktop on XDG_DATA_DIRS
c7ccede
cat << __SNAPD_SH__ > %{buildroot}%{_sysconfdir}/profile.d/snapd.sh
c7ccede
PATH=$PATH:/var/lib/snapd/snap/bin
c7ccede
if [ -z "$XDG_DATA_DIRS" ]; then
c7ccede
    XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
c7ccede
else
c7ccede
    XDG_DATA_DIRS="$XDG_DATA_DIRS":/var/lib/snapd/desktop
c7ccede
fi
c7ccede
export XDG_DATA_DIRS
c7ccede
__SNAPD_SH__
c7ccede
c7ccede
# Disable re-exec by default
c7ccede
echo 'SNAP_REEXEC=0' > %{buildroot}%{_sysconfdir}/sysconfig/snapd
c7ccede
c7ccede
# source codes for building projects
c7ccede
%if 0%{?with_devel}
c7ccede
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
c7ccede
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
c7ccede
# find all *.go but no *_test.go files and generate devel.file-list
c7ccede
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
c7ccede
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
c7ccede
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
c7ccede
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
c7ccede
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
c7ccede
done
c7ccede
%endif
c7ccede
c7ccede
# testing files for this project
c7ccede
%if 0%{?with_unit_test} && 0%{?with_devel}
c7ccede
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
c7ccede
# find all *_test.go files and generate unit-test.file-list
c7ccede
for file in $(find . -iname "*_test.go"); do
c7ccede
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
c7ccede
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
c7ccede
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
c7ccede
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
c7ccede
done
c7ccede
%endif
c7ccede
c7ccede
%if 0%{?with_devel}
c7ccede
sort -u -o devel.file-list devel.file-list
c7ccede
%endif
c7ccede
c7ccede
%check
bfc63f7
# snapd tests
c7ccede
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
c7ccede
%if ! 0%{?with_bundled}
c7ccede
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
c7ccede
%else
c7ccede
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
c7ccede
%endif
c7ccede
%gotest %{import_path}
c7ccede
%endif
c7ccede
bfc63f7
# snap-confine tests (these always run!)
bfc63f7
pushd ./cmd
bfc63f7
make check
bfc63f7
popd
c7ccede
c7ccede
%files
bfc63f7
#define license tag if not already defined
bfc63f7
%{!?_licensedir:%global license %doc}
c7ccede
%license COPYING 
c7ccede
%doc README.md docs/*
c7ccede
%{_bindir}/snap
bfc63f7
%{_bindir}/snapctl
bfc63f7
%{_libexecdir}/snapd/
c7ccede
%{_mandir}/man1/snap.1*
c7ccede
%{_sysconfdir}/profile.d/snapd.sh
c7ccede
%{_unitdir}/snapd.socket
c7ccede
%{_unitdir}/snapd.service
bfc63f7
%{_unitdir}/snapd.autoimport.service
c7ccede
%{_unitdir}/snapd.refresh.service
c7ccede
%{_unitdir}/snapd.refresh.timer
c7ccede
%config(noreplace) %{_sysconfdir}/sysconfig/snapd
c7ccede
%dir %{_sharedstatedir}/snapd
c7ccede
%dir %{_sharedstatedir}/snapd/assertions
c7ccede
%dir %{_sharedstatedir}/snapd/desktop
c7ccede
%dir %{_sharedstatedir}/snapd/mount
c7ccede
%dir %{_sharedstatedir}/snapd/seccomp
c7ccede
%dir %{_sharedstatedir}/snapd/snaps
c7ccede
%dir %{_sharedstatedir}/snapd/snap
c7ccede
%dir %{_localstatedir}/snap
c7ccede
bfc63f7
%files -n snap-confine
bfc63f7
%doc cmd/snap-confine/PORTING
bfc63f7
%license COPYING
bfc63f7
# For now, we can't use caps
bfc63f7
# FIXME: Switch to "%%attr(0755,root,root) %%caps(cap_sys_admin=pe)" asap!
bfc63f7
%attr(4755,root,root) %{_libexecdir}/snapd/snap-confine
bfc63f7
%{_libexecdir}/snapd/snap-discard-ns
bfc63f7
%{_mandir}/man5/snap-confine.5*
bfc63f7
%{_mandir}/man5/snap-discard-ns.5*
bfc63f7
%{_mandir}/man5/snap-update-ns.5*
bfc63f7
%{_prefix}/lib/udev/snappy-app-dev
bfc63f7
%{_udevrulesdir}/80-snappy-assign.rules
bfc63f7
%attr(0000,root,root) %{_sharedstatedir}/snapd/void
bfc63f7
bfc63f7
bfc63f7
%files selinux
bfc63f7
%license data/selinux/COPYING
bfc63f7
%doc data/selinux/README.md
bfc63f7
%{_datadir}/selinux/packages/snappy.pp.bz2
bfc63f7
%{_datadir}/selinux/devel/include/contrib/snappy.if
bfc63f7
c7ccede
%if 0%{?with_devel}
c7ccede
%files devel -f devel.file-list
c7ccede
%license COPYING
c7ccede
%doc README.md
c7ccede
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
c7ccede
%endif
c7ccede
c7ccede
%if 0%{?with_unit_test} && 0%{?with_devel}
c7ccede
%files unit-test-devel -f unit-test-devel.file-list
c7ccede
%license COPYING
c7ccede
%doc README.md
c7ccede
%endif
c7ccede
c7ccede
%post
bfc63f7
%systemd_post %{snappy_svcs}
c7ccede
c7ccede
%preun
bfc63f7
%systemd_preun %{snappy_svcs}
c7ccede
c7ccede
%postun
bfc63f7
%systemd_postun_with_restart %{snappy_svcs}
c7ccede
c7ccede
%pre selinux
c7ccede
%selinux_relabel_pre
c7ccede
c7ccede
%post selinux
c7ccede
%selinux_modules_install %{_datadir}/selinux/packages/snappy.pp.bz2
c7ccede
%selinux_relabel_post
c7ccede
c7ccede
%postun selinux
c7ccede
%selinux_modules_uninstall snappy
c7ccede
if [ $1 -eq 0 ]; then
c7ccede
    %selinux_relabel_post
c7ccede
fi
c7ccede
c7ccede
c7ccede
%changelog
bfc63f7
* Thu Mar 30 2017 Neal Gompa <ngompa13@gmail.com> - 2.23.6-1
bfc63f7
- Rebase to snapd 2.23.6
bfc63f7
- Rediff patches
bfc63f7
- Re-enable seccomp
3f78eaa
- Fix building snap-confine on 32-bit arches
71bd7e0
- Set ExclusiveArch based on upstream supported arch list
bfc63f7
bfc63f7
* Wed Mar 29 2017 Neal Gompa <ngompa13@gmail.com> - 2.23.5-1
bfc63f7
- Rebase to snapd 2.23.5
bfc63f7
- Disable seccomp temporarily avoid snap-confine bugs (LP#1674193)
bfc63f7
- Use vendorized build for non-Fedora
bfc63f7
bfc63f7
* Mon Mar 13 2017 Neal Gompa <ngompa13@gmail.com> - 2.23.1-1
bfc63f7
- Rebase to snapd 2.23.1
bfc63f7
- Add support for vendored tarball for non-Fedora targets
bfc63f7
- Use merged in SELinux policy module
bfc63f7
8ccd819
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.16-2
8ccd819
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
8ccd819
c7ccede
* Wed Oct 19 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.16-1
c7ccede
- New upstream release
bfc63f7
c7ccede
* Tue Oct 18 2016 Neal Gompa <ngompa13@gmail.com> - 2.14-2
c7ccede
- Add SELinux policy module subpackage
bfc63f7
c7ccede
* Tue Aug 30 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.14-1
c7ccede
- New upstream release
bfc63f7
c7ccede
* Tue Aug 23 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.13-1
c7ccede
- New upstream release
bfc63f7
c7ccede
* Thu Aug 18 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.12-2
c7ccede
- Correct license identifier
bfc63f7
c7ccede
* Thu Aug 18 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.12-1
c7ccede
- New upstream release
bfc63f7
c7ccede
* Thu Aug 18 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-8
c7ccede
- Add %%dir entries for various snapd directories
c7ccede
- Tweak Source0 URL
bfc63f7
c7ccede
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-7
c7ccede
- Disable snapd re-exec feature by default
bfc63f7
c7ccede
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-6
c7ccede
- Don't auto-start snapd.socket and snapd.refresh.timer
bfc63f7
c7ccede
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-5
c7ccede
- Don't touch snapd state on removal
bfc63f7
c7ccede
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-4
c7ccede
- Use ExecStartPre to load squashfs.ko before snapd starts
c7ccede
- Use dedicated systemd units for Fedora
bfc63f7
c7ccede
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-3
c7ccede
- Remove systemd preset (will be requested separately according to distribution
c7ccede
  standards).
bfc63f7
c7ccede
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-2
c7ccede
- Use Requires: kmod(squashfs.ko) instead of Requires: kernel-modules
bfc63f7
c7ccede
* Tue Aug 16 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.11-1
c7ccede
- New upstream release
c7ccede
- Move private executables to /usr/libexec/snapd/
bfc63f7
bfc63f7
* Fri Jun 24 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.0.9-2
c7ccede
- Depend on kernel-modules to ensure that squashfs can be loaded. Load it afer
c7ccede
  installing the package. This hopefully fixes
c7ccede
  https://github.com/zyga/snapcore-fedora/issues/2
bfc63f7
bfc63f7
* Fri Jun 17 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.0.9
c7ccede
- New upstream release
c7ccede
  https://github.com/snapcore/snapd/releases/tag/2.0.9
bfc63f7
bfc63f7
* Tue Jun 14 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.0.8.1
c7ccede
- New upstream release
bfc63f7
bfc63f7
* Fri Jun 10 2016 Zygmunt Krynicki <me@zygoon.pl> - 2.0.8
c7ccede
- First package for Fedora