a14f0a99f27ce6f1db83e790813734374301bbab
[platform/upstream/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.3
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 %if 0%{?suse_version} || 0%{?tizen_version:1}
23 Requires:   python-xml
24 %endif
25
26 %if "%{?python_version}" < "2.7"
27 Requires:   python-argparse
28 %endif
29
30 %if 0%{?tizen_version:1}
31 Requires:   python-rpm
32 %else
33 Requires:   rpm-python
34 %endif
35
36 Requires:   cpio
37 # not neccessary
38 Requires:   gzip
39 Requires:   bzip2
40
41 BuildRequires:  python-devel
42 %if ! 0%{?tizen_version:1}
43 BuildRequires:  python-docutils
44 %endif
45
46 Obsoletes:  mic2
47
48 BuildRoot:  %{_tmppath}/%{name}_%{version}-build
49
50 %description
51 The tool mic is used to create and manipulate images for Linux distributions.
52 It is composed of three subcommand\: create, convert, chroot. Subcommand create
53 is used to create images with different types; subcommand convert is used to
54 convert an image to a specified type; subcommand chroot is used to chroot into
55 an image.
56
57 %prep
58 %setup -q -n %{name}-%{version}
59
60 %build
61 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
62 make man
63
64 %install
65 rm -rf $RPM_BUILD_ROOT
66 %if 0%{?suse_version}
67 %{__python} setup.py install --root=$RPM_BUILD_ROOT --prefix=%{_prefix}
68 %else
69 %{__python} setup.py install --root=$RPM_BUILD_ROOT -O1
70 %endif
71
72 # install man page
73 mkdir -p %{buildroot}/%{_prefix}/share/man/man1
74 install -m644 doc/mic.1 %{buildroot}/%{_prefix}/share/man/man1
75
76 # install bash completion
77 install -d -m0755 %{buildroot}/%{_sysconfdir}/bash_completion.d/
78 install -Dp -m0755 etc/bash_completion.d/%{name}.sh %{buildroot}/%{_sysconfdir}/bash_completion.d/
79
80 # install zsh completion
81 install -d -m0755 %{buildroot}/%{_sysconfdir}/zsh_completion.d/
82 install -Dp -m0755 etc/zsh_completion.d/_%{name} %{buildroot}/%{_sysconfdir}/zsh_completion.d/
83
84 %files
85 %defattr(-,root,root,-)
86 %doc doc/*
87 %doc README.rst AUTHORS COPYING ChangeLog
88 %if ! 0%{?tizen_version:1}
89 %{_mandir}/man1/*
90 %endif
91 %dir %{_sysconfdir}/%{name}
92 %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
93 %{python_sitelib}/*
94 %dir %{_prefix}/lib/%{name}
95 %{_prefix}/lib/%{name}/*
96 %{_bindir}/mic
97 %{_sysconfdir}/bash_completion.d
98 %{_sysconfdir}/zsh_completion.d
99