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