]> git.pld-linux.org Git - packages/dokuwiki-plugin-data.git/blob - dokuwiki-plugin-data.spec
require newer sqlite plugin
[packages/dokuwiki-plugin-data.git] / dokuwiki-plugin-data.spec
1 %define         subver  2016-03-11
2 %define         ver             %(echo %{subver} | tr -d -)
3 %define         plugin          data
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}
8 Version:        %{ver}
9 Release:        0.1
10 License:        GPL v2
11 Group:          Applications/WWW
12 # using master snapshot, upstream doesn't tag their code
13 # https://github.com/splitbrain/dokuwiki-plugin-data/issues/206
14 Source0:        https://github.com/splitbrain/dokuwiki-plugin-%{plugin}/archive/master/%{plugin}-%{subver}.tar.gz
15 # Source0-md5:  eea5c5398f01db4f2b4f22c71d601aea
16 URL:            https://www.dokuwiki.org/plugin:data
17 Patch2:         separator-style.patch
18 Patch3:         separate-rpmdb.patch
19 Patch4:         cache-enable.patch
20 BuildRequires:  rpm-php-pearprov
21 BuildRequires:  rpmbuild(macros) >= 1.520
22 Requires:       php(core) >= %{php_min_version}
23 Requires(triggerun):    sqlite
24 Requires(triggerun):    sqlite3
25 Requires:       dokuwiki >= 20090214b-5
26 Requires:       dokuwiki-plugin-sqlite >= 20130508
27 Requires:       php(pcre)
28 BuildArch:      noarch
29 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
31 %define         dokuconf        /etc/webapps/dokuwiki
32 %define         dokudir         /usr/share/dokuwiki
33 %define         metadir         /var/lib/dokuwiki/meta
34 %define         plugindir       %{dokudir}/lib/plugins/%{plugin}
35 %define         find_lang       %{_usrlibrpm}/dokuwiki-find-lang.sh %{buildroot}
36
37 # no pear deps
38 %define         _noautopear     pear
39
40 # sqlite is dokuwiki-plugin-sqlite dep, not ours
41 %define         _noautophp      php-sqlite
42
43 # put it together for rpmbuild
44 %define         _noautoreq      %{?_noautophp} %{?_noautopear}
45
46 %description
47 This plugin allows you to add structured data to any DokuWiki page.
48 Think about this data as additional named attributes. Those attributes
49 can then be queried and aggregated. The plugin is similar to what was
50 done here for the repository plugin but its internals are very
51 different to the repository plugin.
52
53 %prep
54 %setup -qc
55 mv *-%{plugin}-*/{.??*,*} .
56 %patch2 -p1
57 %patch3 -p1
58 %patch4 -p1
59
60 # nothing to do with tests
61 rm -rf _test
62 rm .travis.yml
63
64 # cleanup backups after patching
65 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
66
67 %build
68 version=$(awk '/date/{print $2}' plugin.info.txt)
69 if [ $(echo "$version" | tr -d -) != %{version} ]; then
70         : %%{version} mismatch
71         exit 1
72 fi
73
74 %install
75 rm -rf $RPM_BUILD_ROOT
76 install -d $RPM_BUILD_ROOT{%{plugindir},%{metadir}}
77 cp -a . $RPM_BUILD_ROOT%{plugindir}
78 %{__rm} $RPM_BUILD_ROOT%{plugindir}/README
79 # sqlite2: php-sqlite
80 touch $RPM_BUILD_ROOT%{metadir}/data.sqlite
81 # sqlite3: php-pdo-sqlite
82 touch $RPM_BUILD_ROOT%{metadir}/data.sqlite3
83
84 # find locales
85 %find_lang %{name}.lang
86
87 %clean
88 rm -rf $RPM_BUILD_ROOT
89
90 %post
91 # force css cache refresh
92 if [ -f %{dokuconf}/local.php ]; then
93         touch %{dokuconf}/local.php
94 fi
95
96 %triggerun -- %{name} < 20100322-0.5
97 # move to new location
98 mv /var/lib/dokuwiki/cache/dataplugin.sqlite %{metadir}/data.sqlite
99
100 # perform new indexes add manually
101 sqlite %{metadir}/data.sqlite <<'EOF'
102 CREATE TABLE opts (opt,val);
103 CREATE UNIQUE INDEX idx_opt ON opts(opt);
104 INSERT INTO opts VALUES ('dbversion', 1);
105 EOF
106 chown root:http %{metadir}/data.sqlite
107 chmod 660 %{metadir}/data.sqlite
108
109 %triggerun -- %{name} < 20120716-3
110 if [ -f %{metadir}/data.sqlite3 ]; then
111         # already migrated
112         exit 0
113 fi
114 # perform sqlite2 -> sqlite3 migration of both tools present
115 if [ ! -x /usr/bin/sqlite ] || [ ! -x /usr/bin/sqlite3 ]; then
116         echo >&2 "data plugin: To migrate db from sqlite2 to sqlite3 you need to install 'sqlite' and 'sqlite3' packages"
117         exit 0
118 fi
119
120 sqlite %{metadir}/data.sqlite .dump > %{metadir}/data.dump
121 sqlite3 %{metadir}/data.dump.new < %{metadir}/data.dump
122 mv %{metadir}/data.sqlite3{.new,}
123 chown root:http %{metadir}/data.sqlite3
124 chmod 660 %{metadir}/data.sqlite3
125
126 %files -f %{name}.lang
127 %defattr(644,root,root,755)
128 %doc README
129 %dir %{plugindir}
130 %{plugindir}/*.js
131 %{plugindir}/*.php
132 %{plugindir}/*.txt
133 %{plugindir}/*.css
134 %{plugindir}/admin
135 %{plugindir}/conf
136 %{plugindir}/db
137 %{plugindir}/helper
138 %{plugindir}/syntax
139 %attr(660,http,http) %ghost %{metadir}/data.sqlite
140 %attr(660,http,http) %ghost %{metadir}/data.sqlite3
This page took 0.085836 seconds and 3 git commands to generate.