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