github.com/rigado/snapd@v2.42.5-go-mod+incompatible/packaging/opensuse/snapd.spec (about) 1 # spec file for package snapd 2 # 3 # Copyright (c) 2017 Zygmunt Krynicki <zygmunt.krynicki@canonical.com> 4 # Copyright (c) 2018 Neal Gompa <ngompa13@gmail.com> 5 # 6 # All modifications and additions to the file contributed by third parties 7 # remain the property of their copyright owners, unless otherwise agreed 8 # upon. The license for this file, and modifications and additions to the 9 # file, is the same license as for the pristine package itself (unless the 10 # license for the pristine package is not an Open Source License, in which 11 # case the license is the MIT License). An "Open Source License" is a 12 # license that conforms to the Open Source Definition (Version 1.9) 13 # published by the Open Source Initiative. 14 15 # Please submit bugfixes or comments via http://bugs.opensuse.org/ 16 17 # Test keys: used for internal testing in snapd. 18 %bcond_with testkeys 19 20 # Enable AppArmor on openSUSE Tumbleweed (post 15.0) or higher 21 # N.B.: Prior to openSUSE Tumbleweed in May 2018, the AppArmor userspace in SUSE 22 # did not support what we needed to be able to turn on basic integration. 23 %if 0%{?suse_version} >= 1550 24 %bcond_without apparmor 25 %else 26 %bcond_with apparmor 27 %endif 28 29 # The list of systemd services we are expected to ship. Note that this does 30 # not include services that are only required on core systems. 31 %global systemd_services_list snapd.socket snapd.service snapd.seeded.service snapd.failure.service %{?with_apparmor:snapd.apparmor.service} 32 %global systemd_user_services_list snapd.session-agent.socket 33 34 # Alternate snap mount directory: not used by openSUSE. 35 # If this spec file is integrated into Fedora then consider 36 # adding global with_alt_snap_mount_dir 1 then. 37 %global snap_mount_dir /snap 38 39 # Compat macros 40 %{!?make_build: %global make_build %{__make} %{?_smp_mflags}} 41 %{?!_environmentdir: %global _environmentdir %{_prefix}/lib/environment.d} 42 %{?!_userunitdir: %global _userunitdir %{_prefix}/lib/systemd/user} 43 44 # Define the variable for systemd generators, if missing. 45 %{?!_systemdgeneratordir: %global _systemdgeneratordir %{_prefix}/lib/systemd/system-generators} 46 %{?!_systemdusergeneratordir: %global _systemdusergeneratordir %{_prefix}/lib/systemd/user-generators} 47 %{?!_systemd_system_env_generator_dir: %global _systemd_system_env_generator_dir %{_prefix}/lib/systemd/system-environment-generators} 48 %{?!_systemd_user_env_generator_dir: %global _systemd_user_env_generator_dir %{_prefix}/lib/systemd/user-environment-generators} 49 50 # This is fixed in SUSE Linux 15 51 # Cf. https://build.opensuse.org/package/rdiff/Base:System/rpm?linkrev=base&rev=396 52 %if 0%{?suse_version} < 1500 53 %global _sharedstatedir %{_localstatedir}/lib 54 %endif 55 56 %global provider github 57 %global provider_tld com 58 %global project snapcore 59 %global repo snapd 60 %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} 61 %global import_path %{provider_prefix} 62 63 # Additional entry of $GOPATH during the build process. 64 # This is designed to be a sub-directory of {_builddir}/{name}-{version} 65 # because that directory is automatically cleaned-up by the build process. 66 %global indigo_gopath %{_builddir}/%{name}-%{version}/gopath 67 68 # Directory where "name-version" directory from upstream taball is unpacked to. 69 # This directory is arranged so that it is already contained inside the future 70 # GOPATH so that nothing needs to be moved or copied for "go build" to work. 71 %global indigo_srcdir %{indigo_gopath}/src/%{import_path} 72 73 # Set if multilib is enabled for supported arches 74 %ifarch x86_64 aarch64 %{power64} s390x 75 %global with_multilib 1 76 %endif 77 78 79 Name: snapd 80 Version: 2.42.5 81 Release: 0 82 Summary: Tools enabling systems to work with .snap files 83 License: GPL-3.0 84 Group: System/Packages 85 Url: https://%{import_path} 86 Source0: https://github.com/snapcore/snapd/releases/download/%{version}/%{name}_%{version}.vendor.tar.xz 87 Source1: snapd-rpmlintrc 88 %if (0%{?sle_version} >= 120200 || 0%{?suse_version} >= 1500) && 0%{?is_opensuse} 89 BuildRequires: ShellCheck 90 %endif 91 BuildRequires: autoconf 92 BuildRequires: automake 93 BuildRequires: glib2-devel 94 BuildRequires: glibc-devel-static 95 BuildRequires: go >= 1.9 96 BuildRequires: gpg2 97 BuildRequires: indent 98 BuildRequires: libcap-devel 99 BuildRequires: libseccomp-devel 100 BuildRequires: libtool 101 BuildRequires: libudev-devel 102 BuildRequires: libuuid-devel 103 BuildRequires: make 104 BuildRequires: openssh 105 BuildRequires: pkg-config 106 BuildRequires: python-docutils 107 BuildRequires: python3-docutils 108 BuildRequires: squashfs 109 # Due to: rpm -q --whatprovides /usr/share/pkgconfig/systemd.pc 110 BuildRequires: systemd 111 BuildRequires: systemd-rpm-macros 112 BuildRequires: timezone 113 BuildRequires: udev 114 BuildRequires: xfsprogs-devel 115 BuildRequires: xz 116 %ifarch x86_64 117 # This is needed for seccomp tests 118 BuildRequires: glibc-devel-32bit 119 BuildRequires: glibc-devel-static-32bit 120 BuildRequires: gcc-32bit 121 %endif 122 123 %if %{with apparmor} 124 BuildRequires: libapparmor-devel 125 BuildRequires: apparmor-rpm-macros 126 %endif 127 128 PreReq: permissions 129 130 Requires(post): permissions 131 %if %{with apparmor} 132 Requires: apparmor-parser 133 Requires: apparmor-profiles 134 %endif 135 Requires: gpg2 136 Requires: openssh 137 Requires: squashfs 138 139 # Old versions of xdg-document-portal can expose data belonging to 140 # other confied apps. Older OpenSUSE releases are unlikely to change, 141 # so for now limit this to Tumbleweed. 142 %if 0%{?suse_version} >= 1550 143 Conflicts: xdg-desktop-portal < 0.11 144 %endif 145 146 %{?systemd_requires} 147 148 %description 149 This package contains that snapd daemon and the snap command line tool. 150 Together they can be used to install, refresh (update), remove and configure 151 snap packages on a system. Snap packages are a novel format based on simple 152 principles. Bundle your dependencies, run in a predictable environment, use 153 modern kernel features for setting up the execution environment and security. 154 The same binary snap package can be installed and used on many diverse systems 155 such as Debian, Fedora and OpenSUSE as well as their multiple derivatives. 156 157 This package contains the official build, endorsed by snapd developers. It is 158 updated as soon as new upstream releases are made and is designed to live in 159 the system:snappy repository. 160 161 %prep 162 # NOTE: Instead of using setup -q we are unpacking a subdirectory of the source 163 # tarball into a directory that is automatically on the future GOPATH. This 164 # means that while go doesn't care at all the current working directory is not 165 # the top-level directory of the source tarball which some people may find 166 # unusual. 167 168 # Create indigo compatible build layout. 169 mkdir -p %{indigo_srcdir} 170 tar -axf %{_sourcedir}/%{name}_%{version}.vendor.tar.xz --strip-components=1 -C %{indigo_srcdir} 171 172 # Patch the source in the place it got extracted to. 173 pushd %{indigo_srcdir} 174 # Add patch0 -p1 ... as appropriate here. 175 popd 176 177 # Generate snapd.defines.mk, this file is included by snapd.mk. It contains a 178 # number of variable definitions that are set based on their RPM equivalents. 179 # Since we can apply any conditional overrides here in the spec file we can 180 # maintain one consistent set of variables across the spec and makefile worlds. 181 cat >snapd.defines.mk <<__DEFINES__ 182 # This file is generated by openSUSE's snapd.spec 183 # Directory variables. 184 prefix = %{_prefix} 185 bindir = %{_bindir} 186 sbindir = %{_sbindir} 187 libexecdir = %{_libexecdir} 188 mandir = %{_mandir} 189 datadir = %{_datadir} 190 localstatedir = %{_localstatedir} 191 sharedstatedir = %{_sharedstatedir} 192 unitdir = %{_unitdir} 193 # Build configuration 194 with_core_bits = 0 195 with_alt_snap_mount_dir = %{!?with_alt_snap_mount_dir:0}%{?with_alt_snap_mount_dir:1} 196 with_apparmor = %{with apparmor} 197 with_testkeys = %{with_testkeys} 198 __DEFINES__ 199 200 # Set the version that is compiled into the various executables/ 201 pushd %{indigo_srcdir} 202 ./mkversion.sh %{version}-%{release} 203 popd 204 205 # Sanity check, ensure that systemd system generator directory is in agreement between the build system and packaging. 206 if [ "$(pkg-config --variable=systemdsystemgeneratordir systemd)" != "%{_systemdgeneratordir}" ]; then 207 echo "pkg-confing and rpm macros disagree about the location of systemd system generator directory" 208 exit 1 209 fi 210 211 # Enable hardening; Also see https://bugzilla.redhat.com/show_bug.cgi?id=1343892 212 CFLAGS="$RPM_OPT_FLAGS -fPIC -Wl,-z,relro -Wl,-z,now" 213 CXXFLAGS="$RPM_OPT_FLAGS -fPIC -Wl,-z,relro -Wl,-z,now" 214 LDFLAGS="" 215 216 # On openSUSE Leap 15 or more recent build position independent executables. 217 # For a helpful guide about the versions and macros used below, please see: 218 # https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto 219 %if 0%{?suse_version} >= 1500 220 CFLAGS="$CFLAGS -fPIE" 221 CXXFLAGS="$CXXFLAGS -fPIE" 222 LDFLAGS="$LDFLAGS -pie" 223 %endif 224 225 export CFLAGS 226 export CXXFLAGS 227 export LDFLAGS 228 229 # Generate autotools build system files. 230 pushd %{indigo_srcdir}/cmd 231 autoreconf -i -f 232 233 %configure \ 234 %{!?with_apparmor:--disable-apparmor} \ 235 %{?with_apparmor:--enable-apparmor} \ 236 --libexecdir=%{_libexecdir}/snapd \ 237 --enable-nvidia-biarch \ 238 %{?with_multilib:--with-32bit-libdir=%{_prefix}/lib} \ 239 --with-snap-mount-dir=%{snap_mount_dir} \ 240 --enable-merged-usr 241 242 popd 243 244 %build 245 %make_build -C %{indigo_srcdir}/cmd 246 # Use the common packaging helper for building. 247 # 248 # NOTE: indigo_gopath takes priority over GOPATH. This ensures that we 249 # build the code that we intended in case GOPATH points to another copy. 250 %make_build -f %{indigo_srcdir}/packaging/snapd.mk GOPATH=%{indigo_gopath}:$GOPATH all 251 252 %check 253 %make_build -C %{indigo_srcdir}/cmd check 254 # Use the common packaging helper for testing. 255 %make_build -f %{indigo_srcdir}/packaging/snapd.mk GOPATH=%{indigo_gopath}:$GOPATH check 256 257 %install 258 # Install all systemd and dbus units, and env files. 259 %make_install -C %{indigo_srcdir}/data \ 260 BINDIR=%{_bindir} \ 261 LIBEXECDIR=%{_libexecdir} \ 262 SYSTEMDSYSTEMUNITDIR=%{_unitdir} \ 263 SNAP_MOUNT_DIR=%{snap_mount_dir} 264 # Install all the C executables. 265 %make_install -C %{indigo_srcdir}/cmd 266 # Use the common packaging helper for bulk of installation. 267 %make_install -f %{indigo_srcdir}/packaging/snapd.mk install 268 269 # Undo special permissions of the void directory. We handle that in RPM files 270 # section below. 271 chmod 755 %{buildroot}%{_localstatedir}/lib/snapd/void 272 273 # Install local permissions policy for snap-confine. This should be removed 274 # once snap-confine is added to the permissions package. This is done following 275 # the recommendations on 276 # https://en.opensuse.org/openSUSE:Package_security_guidelines 277 install -m 644 -D %{indigo_srcdir}/packaging/opensuse/permissions %{buildroot}%{_sysconfdir}/permissions.d/snapd 278 install -m 644 -D %{indigo_srcdir}/packaging/opensuse/permissions.paranoid %{buildroot}%{_sysconfdir}/permissions.d/snapd.paranoid 279 280 # See https://en.opensuse.org/openSUSE:Packaging_checks#suse-missing-rclink for details 281 install -d %{buildroot}%{_sbindir} 282 ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcsnapd 283 ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcsnapd.seeded 284 %if %{with apparmor} 285 ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcsnapd.apparmor 286 %endif 287 288 # Install Polkit configuration. 289 # TODO: This should be handled by data makefile. 290 install -m 644 -D %{indigo_srcdir}/data/polkit/io.snapcraft.snapd.policy %{buildroot}%{_datadir}/polkit-1/actions 291 292 # Install the "info" data file with snapd version 293 # TODO: This should be handled by data makefile. 294 install -m 644 -D %{indigo_srcdir}/data/info %{buildroot}%{_libexecdir}/snapd/info 295 296 # Install bash completion for "snap" 297 # TODO: This should be handled by data makefile. 298 install -m 644 -D %{indigo_srcdir}/data/completion/snap %{buildroot}%{_datadir}/bash-completion/completions/snap 299 install -m 644 -D %{indigo_srcdir}/data/completion/complete.sh %{buildroot}%{_libexecdir}/snapd 300 install -m 644 -D %{indigo_srcdir}/data/completion/etelpmoc.sh %{buildroot}%{_libexecdir}/snapd 301 302 %verifyscript 303 %verify_permissions -e %{_libexecdir}/snapd/snap-confine 304 305 %pre 306 %service_add_pre %{systemd_services_list} 307 308 %post 309 %set_permissions %{_libexecdir}/snapd/snap-confine 310 %if %{with apparmor} 311 %apparmor_reload /etc/apparmor.d/usr.lib.snapd.snap-confine 312 %endif 313 %service_add_post %{systemd_services_list} 314 %systemd_user_post %{systemd_user_services_list} 315 case ":$PATH:" in 316 *:/snap/bin:*) 317 ;; 318 *) 319 echo "Please reboot, logout/login or source /etc/profile to have /snap/bin added to PATH." 320 echo "On a Tumbleweed system you need to run: systemctl enable snapd.apparmor.service" 321 ;; 322 esac 323 324 %preun 325 %service_del_preun %{systemd_services_list} 326 %systemd_user_preun %{systemd_user_services_list} 327 if [ $1 -eq 0 ]; then 328 %{_libexecdir}/snapd/snap-mgmt --purge || : 329 fi 330 331 %postun 332 %service_del_postun %{systemd_services_list} 333 %systemd_user_postun %{systemd_user_services_list} 334 335 %files 336 337 # Configuration files 338 %config %{_sysconfdir}/permissions.d/snapd 339 %config %{_sysconfdir}/permissions.d/snapd.paranoid 340 %config %{_sysconfdir}/profile.d/snapd.sh 341 342 # Directories 343 %dir %attr(0111,root,root) %{_sharedstatedir}/snapd/void 344 %dir %{_datadir}/dbus-1 345 %dir %{_datadir}/dbus-1/services 346 %dir %{_datadir}/polkit-1 347 %dir %{_datadir}/polkit-1/actions 348 %dir %{_environmentdir} 349 %dir %{_libexecdir}/snapd 350 %dir %{_localstatedir}/cache/snapd 351 %dir %{_sharedstatedir}/snapd 352 %dir %{_sharedstatedir}/snapd/apparmor 353 %dir %{_sharedstatedir}/snapd/apparmor/profiles 354 %dir %{_sharedstatedir}/snapd/apparmor/snap-confine 355 %dir %{_sharedstatedir}/snapd/assertions 356 %dir %{_sharedstatedir}/snapd/cache 357 %dir %{_sharedstatedir}/snapd/cookie 358 %dir %{_sharedstatedir}/snapd/desktop 359 %dir %{_sharedstatedir}/snapd/desktop/applications 360 %dir %{_sharedstatedir}/snapd/device 361 %dir %{_sharedstatedir}/snapd/hostfs 362 %dir %{_sharedstatedir}/snapd/lib 363 %dir %{_sharedstatedir}/snapd/lib/gl 364 %dir %{_sharedstatedir}/snapd/lib/gl32 365 %dir %{_sharedstatedir}/snapd/lib/glvnd 366 %dir %{_sharedstatedir}/snapd/lib/vulkan 367 %dir %{_sharedstatedir}/snapd/mount 368 %dir %{_sharedstatedir}/snapd/seccomp 369 %dir %{_sharedstatedir}/snapd/seccomp/bpf 370 %dir %{_sharedstatedir}/snapd/sequence 371 %dir %{_sharedstatedir}/snapd/snaps 372 %dir %{_systemd_system_env_generator_dir} 373 %dir %{_systemdgeneratordir} 374 %dir %{_userunitdir} 375 %dir %{snap_mount_dir} 376 %dir %{snap_mount_dir}/bin 377 378 # Ghost entries for things created at runtime 379 %ghost %dir %{_localstatedir}/snap 380 %ghost %{_localstatedir}/cache/snapd/commands 381 %ghost %{_localstatedir}/cache/snapd/names 382 %ghost %{_localstatedir}/cache/snapd/sections 383 %ghost %{_sharedstatedir}/snapd/seccomp/bpf/global.bin 384 %ghost %{_sharedstatedir}/snapd/state.json 385 %ghost %{_sharedstatedir}/snapd/system-key 386 %ghost %{snap_mount_dir}/README 387 %verify(not user group mode) %attr(06755,root,root) %{_libexecdir}/snapd/snap-confine 388 %{_bindir}/snap 389 %{_bindir}/snapctl 390 %{_datadir}/applications/snap-handle-link.desktop 391 %{_datadir}/bash-completion/completions/snap 392 %{_datadir}/dbus-1/services/io.snapcraft.Launcher.service 393 %{_datadir}/dbus-1/services/io.snapcraft.Settings.service 394 %{_datadir}/polkit-1/actions/io.snapcraft.snapd.policy 395 %{_environmentdir}/990-snapd.conf 396 %{_libexecdir}/snapd/complete.sh 397 %{_libexecdir}/snapd/etelpmoc.sh 398 %{_libexecdir}/snapd/info 399 %{_libexecdir}/snapd/snap-device-helper 400 %{_libexecdir}/snapd/snap-discard-ns 401 %{_libexecdir}/snapd/snap-exec 402 %{_libexecdir}/snapd/snap-gdb-shim 403 %{_libexecdir}/snapd/snap-mgmt 404 %{_libexecdir}/snapd/snap-seccomp 405 %{_libexecdir}/snapd/snap-update-ns 406 %{_libexecdir}/snapd/snapctl 407 %{_libexecdir}/snapd/snapd 408 %{_libexecdir}/snapd/snapd.run-from-snap 409 %{_mandir}/man8/snap-confine.8* 410 %{_mandir}/man8/snap-discard-ns.8* 411 %{_mandir}/man8/snap.8* 412 %{_mandir}/man8/snapd-env-generator.8* 413 %{_sbindir}/rcsnapd 414 %{_sbindir}/rcsnapd.seeded 415 %{_sysconfdir}/xdg/autostart/snap-userd-autostart.desktop 416 %{_systemd_system_env_generator_dir}/snapd-env-generator 417 %{_systemdgeneratordir}/snapd-generator 418 %{_unitdir}/snapd.failure.service 419 %{_unitdir}/snapd.seeded.service 420 %{_unitdir}/snapd.service 421 %{_unitdir}/snapd.socket 422 %{_userunitdir}/snapd.session-agent.service 423 %{_userunitdir}/snapd.session-agent.socket 424 425 # When apparmor is enabled there are some additional entries. 426 %if %{with apparmor} 427 %config %{_sysconfdir}/apparmor.d 428 %{_libexecdir}/snapd/snapd-apparmor 429 %{_sbindir}/rcsnapd.apparmor 430 %{_sysconfdir}/apparmor.d/usr.lib.snapd.snap-confine 431 %{_unitdir}/snapd.apparmor.service 432 %endif 433 434 %changelog