bump up to release 0.28.13
[tools/mic.git] / packaging / mic.spec
1 %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
2 %{!?python_version: %define python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")}
3
4 %define rc_version 0
5
6 %if 0%{?rc_version}
7 %define release_prefix 0.rc%{rc_version}.
8 %endif
9
10 Name:       mic
11 Summary:    Image Creator for Linux Distributions
12 Version:    0.28.13
13 Release:    %{?release_prefix}%{?opensuse_bs:<CI_CNT>.<B_CNT>}%{!?opensuse_bs:0}
14 Group:      Development/Tools
15 License:    GPLv2
16 BuildArch:  noarch
17 URL:        http://www.tizen.org
18 Source0:    %{name}_%{version}.tar.gz
19
20 Requires:   python >= 2.6
21 Requires:   python-urlgrabber >= 3.9.0
22 Requires:   yum
23 %if 0%{?suse_version} || 0%{?tizen_version:1}
24 Requires:   python-xml
25 %endif
26
27 %if "%{?python_version}" < "2.7"
28 Requires:   python-argparse
29 %endif
30
31 %if 0%{?tizen_version:1}
32 Requires:   python-rpm
33 %else
34 Requires:   rpm-python
35 %endif
36
37 Requires:   cpio
38 # not neccessary
39 Requires:   gzip
40 Requires:   bzip2
41
42 BuildRequires:  python-devel
43 %if ! 0%{?tizen_version:1}
44 BuildRequires:  python-docutils
45 %endif
46
47 Obsoletes:  mic2
48
49 BuildRoot:  %{_tmppath}/%{name}_%{version}-build
50
51 %description
52 The tool mic is used to create and manipulate images for Linux distributions.
53 It is composed of three subcommand\: create, convert, chroot. Subcommand create
54 is used to create images with different types; subcommand convert is used to
55 convert an image to a specified type; subcommand chroot is used to chroot into
56 an image.
57
58 %prep
59 %setup -q -n %{name}-%{version}
60
61 %build
62 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
63 make man
64
65 %install
66 rm -rf $RPM_BUILD_ROOT
67 %if 0%{?suse_version}
68 %{__python} setup.py install --root=$RPM_BUILD_ROOT --prefix=%{_prefix}
69 %else
70 %{__python} setup.py install --root=$RPM_BUILD_ROOT -O1
71 %endif
72
73 # install man page
74 mkdir -p %{buildroot}/%{_prefix}/share/man/man1
75 install -m644 doc/mic.1 %{buildroot}/%{_prefix}/share/man/man1
76
77 # install bash completion
78 install -d -m0755 %{buildroot}/%{_sysconfdir}/bash_completion.d/
79 install -Dp -m0755 etc/bash_completion.d/%{name}.sh %{buildroot}/%{_sysconfdir}/bash_completion.d/
80
81 # install zsh completion
82 install -d -m0755 %{buildroot}/%{_sysconfdir}/zsh_completion.d/
83 install -Dp -m0755 etc/zsh_completion.d/_%{name} %{buildroot}/%{_sysconfdir}/zsh_completion.d/
84
85 %files
86 %defattr(-,root,root,-)
87 %doc doc/*
88 %doc README.rst AUTHORS COPYING ChangeLog
89 %if ! 0%{?tizen_version:1}
90 %{_mandir}/man1/*
91 %endif
92 %dir %{_sysconfdir}/%{name}
93 %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
94 %{python_sitelib}/*
95 %dir %{_prefix}/lib/%{name}
96 %{_prefix}/lib/%{name}/*
97 %{_bindir}/mic
98 %{_sysconfdir}/bash_completion.d
99 %{_sysconfdir}/zsh_completion.d
100