fixes in EULA accepting
[opensuse:yast-rest-service.git] / plugins / software / package / webyast-software-ws.spec
1 #
2 # spec file for package webyast-software-ws (Version 0.1.x)
3 #
4 # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
5 # This file and all modifications and additions to the pristine
6 # package are under the same license as the package itself.
7 #
8 # Please submit bugfixes or comments via http://bugs.opensuse.org/
9 #
10
11
12 Name:           webyast-software-ws
13 Provides:       WebYaST(org.opensuse.yast.system.repositories)
14 Provides:       WebYaST(org.opensuse.yast.system.patches)
15 Provides:       WebYaST(org.opensuse.yast.system.packages)
16 Provides:       yast2-webservice-patches = %{version}
17 Obsoletes:      yast2-webservice-patches < %{version}
18
19 # for testing
20 BuildRequires:  ruby-dbus >= 0.3.1
21
22 PreReq:         yast2-webservice
23 # ruby-dbus is required by webyast-base-ws already
24 # but here we use a recent feature of on_signal
25 Requires:       ruby-dbus >= 0.3.1
26
27 %if 0%{?suse_version} == 0 || 0%{?suse_version} > 1120
28 # openSUSE-11.3 (Factory) or newer
29 Requires:       PackageKit >= 0.5.1-6
30 %if 0%{?suse_version} == 1120
31 # openSUSE-11.2
32 Requires:       PackageKit >= 0.5.1-4
33 %else
34 # openSUSE-11.1 or SLES11
35 Requires:       PackageKit >= 0.3.14-3
36 %endif
37 %endif
38
39 License:        GPL v2
40 Group:          Productivity/Networking/Web/Utilities
41 URL:            http://en.opensuse.org/Portal:WebYaST
42 Autoreqprov:    on
43 Version:        0.3.7
44 Release:        0
45 Summary:        WebYaST - software management service
46 Source:         www.tar.bz2
47 Source1:        org.opensuse.yast.system.patches.policy
48 Source2:        org.opensuse.yast.system.packages.policy
49 Source3:        org.opensuse.yast.system.repositories.policy
50 Source4:        01-org.opensuse.yast.software.pkla
51 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
52 BuildArch:      noarch
53
54 BuildRequires:  webyast-base-ws-testsuite
55 BuildRequires:  rubygem-test-unit rubygem-mocha
56
57 #
58 %define plugin_dir %{webyast_ws_dir}/vendor/plugins/software
59 #
60
61 %package testsuite
62 Group:    Productivity/Networking/Web/Utilities
63 Requires: %{name} = %{version}
64 Requires: webyast-base-ws-testsuite
65 Summary:  Testsuite for webyast-software-ws package
66
67 %description
68 WebYaST - Plugin providing REST based interface to handle repositories, patches and packages.
69
70 Authors:
71 --------
72     Stefan Schubert <schubi@opensuse.org>
73
74 %description testsuite
75 This package contains complete testsuite for webyast-software-ws package.
76 It's only needed for verifying the functionality of the module and it's not
77 needed at runtime.
78
79 %prep
80 %setup -q -n www
81
82 %build
83
84 #do not package developer doc
85 rm -rf doc
86
87 %check
88 # run the testsuite
89 #
90 # Disabled for now.
91 # PackageKit/DBus need /proc and thus don't run in build environment.
92 # But both are required for testing :-/
93 # reference: bnc#597868
94 # -percent-webyast_ws_check
95
96 %install
97
98 #
99 # Install all web and frontend parts.
100 #
101 mkdir -p $RPM_BUILD_ROOT%{plugin_dir}
102 cp -a * $RPM_BUILD_ROOT%{plugin_dir}
103 rm -f $RPM_BUILD_ROOT%{plugin_dir}/COPYING
104
105 # Policies
106 mkdir -p $RPM_BUILD_ROOT/usr/share/PolicyKit/policy
107 install -m 0644 %SOURCE1 $RPM_BUILD_ROOT/usr/share/PolicyKit/policy/
108 install -m 0644 %SOURCE2 $RPM_BUILD_ROOT/usr/share/PolicyKit/policy/
109 install -m 0644 %SOURCE3 $RPM_BUILD_ROOT/usr/share/PolicyKit/policy/
110
111 %if 0%{?suse_version} == 0 || 0%{?suse_version} > 1130
112 # openSUSE-11.4 has policykit-1 which uses .pkla files
113 mkdir -p $RPM_BUILD_ROOT/var/lib/polkit-1/localauthority/10-vendor.d
114 install -m 0644 %SOURCE4 $RPM_BUILD_ROOT/var/lib/polkit-1/localauthority/10-vendor.d/
115 %if 0%{?suse_version} == 1130
116 # openSUSE-11.3+ has policykit-1 which uses .pkla files
117 mkdir -p $RPM_BUILD_ROOT/etc/polkit-1/localauthority/10-vendor.d
118 install -m 0644 %SOURCE4 $RPM_BUILD_ROOT/etc/polkit-1/localauthority/10-vendor.d/
119 %endif
120 %endif
121
122 mkdir -p $RPM_BUILD_ROOT/var/lib/yastws/software/licenses/accepted
123
124 %clean
125 rm -rf $RPM_BUILD_ROOT
126
127 %post
128 #
129 # granting all permissions for root
130 #
131 /usr/sbin/grantwebyastrights --user root --action grant > /dev/null ||:
132 /usr/sbin/grantwebyastrights --user %{webyast_ws_user} --action grant > /dev/null ||:
133
134
135 # grant the permission for the webservice user
136 polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.packagekit.system-sources-configure >& /dev/null || true
137 polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.packagekit.system-update >& /dev/null || true
138 polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.packagekit.package-eula-accept >& /dev/null || true
139
140 %files
141 %defattr(-,root,root)
142 %dir %{webyast_ws_dir}
143 %dir %{webyast_ws_dir}/vendor
144 %dir %{webyast_ws_dir}/vendor/plugins
145 %dir %{plugin_dir}
146 %dir /usr/share/PolicyKit
147 %dir /usr/share/PolicyKit/policy
148 %{plugin_dir}/README
149 %{plugin_dir}/Rakefile
150 %{plugin_dir}/init.rb
151 %{plugin_dir}/install.rb
152 %{plugin_dir}/uninstall.rb
153 %{plugin_dir}/app
154 %{plugin_dir}/lib
155 %{plugin_dir}/config
156 %attr(644,root,root) %config /usr/share/PolicyKit/policy/org.opensuse.yast.system.patches.policy
157 %attr(644,root,root) %config /usr/share/PolicyKit/policy/org.opensuse.yast.system.packages.policy
158 %attr(644,root,root) %config /usr/share/PolicyKit/policy/org.opensuse.yast.system.repositories.policy
159 %attr(775,%{webyast_ws_user},root) /var/lib/yastws/software
160 %doc COPYING
161 %if 0%{?suse_version} == 0 || 0%{?suse_version} > 1130
162 %dir /var/lib/polkit-1/localauthority
163 %dir /var/lib/polkit-1/localauthority/10-vendor.d
164 %config /var/lib/polkit-1/localauthority/10-vendor.d/*
165 %if 0%{?suse_version} == 1130
166 %config /etc/polkit-1/localauthority/10-vendor.d/*
167 %endif
168 %endif
169
170 %files testsuite
171 %defattr(-,root,root)
172 %{plugin_dir}/test
173
174 %changelog