1 %define subver 2017-02-08
2 %define ver %(echo %{subver} | tr -d -)
4 %define php_min_version 5.3.0
5 %include /usr/lib/rpm/macros.php
6 Summary: DokuWiki Structured Data Plugin
7 Name: dokuwiki-plugin-%{plugin}
11 Group: Applications/WWW
12 Source0: https://github.com/splitbrain/dokuwiki-plugin-%{plugin}/archive/%{subver}/%{plugin}-%{subver}.tar.gz
13 # Source0-md5: 0ec0720f8b4430377b66db1c9f57b9ea
14 URL: https://www.dokuwiki.org/plugin:data
15 Patch2: separator-style.patch
16 Patch3: separate-rpmdb.patch
17 Patch4: cache-enable.patch
18 BuildRequires: rpm-php-pearprov
19 BuildRequires: rpmbuild(macros) >= 1.520
20 Requires: php(core) >= %{php_min_version}
21 Requires(triggerun): sqlite
22 Requires(triggerun): sqlite3
23 Requires: dokuwiki >= 20090214b-5
24 Requires: dokuwiki-plugin-sqlite >= 20130508
27 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
29 %define dokuconf /etc/webapps/dokuwiki
30 %define dokudir /usr/share/dokuwiki
31 %define metadir /var/lib/dokuwiki/meta
32 %define plugindir %{dokudir}/lib/plugins/%{plugin}
33 %define find_lang %{_usrlibrpm}/dokuwiki-find-lang.sh %{buildroot}
36 %define _noautopear pear
38 # sqlite is dokuwiki-plugin-sqlite dep, not ours
39 %define _noautophp php-sqlite
41 # put it together for rpmbuild
42 %define _noautoreq %{?_noautophp} %{?_noautopear}
45 This plugin allows you to add structured data to any DokuWiki page.
46 Think about this data as additional named attributes. Those attributes
47 can then be queried and aggregated. The plugin is similar to what was
48 done here for the repository plugin but its internals are very
49 different to the repository plugin.
53 mv *-%{plugin}-*/{.??*,*} .
58 # nothing to do with tests
62 # cleanup backups after patching
63 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
66 version=$(awk '/date/{print $2}' plugin.info.txt)
67 if [ $(echo "$version" | tr -d -) != %{version} ]; then
68 : %%{version} mismatch
73 rm -rf $RPM_BUILD_ROOT
74 install -d $RPM_BUILD_ROOT{%{plugindir},%{metadir}}
75 cp -a . $RPM_BUILD_ROOT%{plugindir}
76 %{__rm} $RPM_BUILD_ROOT%{plugindir}/README
78 touch $RPM_BUILD_ROOT%{metadir}/data.sqlite
79 # sqlite3: php-pdo-sqlite
80 touch $RPM_BUILD_ROOT%{metadir}/data.sqlite3
83 %find_lang %{name}.lang
86 rm -rf $RPM_BUILD_ROOT
89 # force css cache refresh
90 if [ -f %{dokuconf}/local.php ]; then
91 touch %{dokuconf}/local.php
94 %triggerun -- %{name} < 20100322-0.5
95 # move to new location
96 mv /var/lib/dokuwiki/cache/dataplugin.sqlite %{metadir}/data.sqlite
98 # perform new indexes add manually
99 sqlite %{metadir}/data.sqlite <<'EOF'
100 CREATE TABLE opts (opt,val);
101 CREATE UNIQUE INDEX idx_opt ON opts(opt);
102 INSERT INTO opts VALUES ('dbversion', 1);
104 chown root:http %{metadir}/data.sqlite
105 chmod 660 %{metadir}/data.sqlite
107 %triggerun -- %{name} < 20120716-3
108 if [ -f %{metadir}/data.sqlite3 ]; then
112 # perform sqlite2 -> sqlite3 migration of both tools present
113 if [ ! -x /usr/bin/sqlite ] || [ ! -x /usr/bin/sqlite3 ]; then
114 echo >&2 "data plugin: To migrate db from sqlite2 to sqlite3 you need to install 'sqlite' and 'sqlite3' packages"
118 sqlite %{metadir}/data.sqlite .dump > %{metadir}/data.dump
119 sqlite3 %{metadir}/data.dump.new < %{metadir}/data.dump
120 mv %{metadir}/data.sqlite3{.new,}
121 chown root:http %{metadir}/data.sqlite3
122 chmod 660 %{metadir}/data.sqlite3
124 %files -f %{name}.lang
125 %defattr(644,root,root,755)
137 %attr(660,http,http) %ghost %{metadir}/data.sqlite
138 %attr(660,http,http) %ghost %{metadir}/data.sqlite3