Merge release-0.27.4 from 'tools/mic'
[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.27.4
13 Release:    0
14 Group:      Development/Tools
15 License:    GPLv2
16 BuildArch:  noarch
17 URL:        http://www.tizen.org
18 Source0:    %{name}_%{version}.tar.gz
19 %if 0%{?tizen_version:1}
20 Source1001: mic.manifest
21 %endif
22
23 Requires:   python >= 2.6
24 Requires:   python-urlgrabber >= 3.9.0
25 %if 0%{?suse_version} || 0%{?tizen_version:1}
26 Requires:   python-xml
27 %endif
28
29 %if "%{?python_version}" < "2.7"
30 Requires:   python-argparse
31 %endif
32
33 %if 0%{?tizen_version:1}
34 Requires:   python-rpm
35 %else
36 Requires:   rpm-python
37 %endif
38
39 Requires:   cpio
40 # not neccessary
41 Requires:   gzip
42 Requires:   bzip2
43
44 %if 0%{?tizen_version:1}
45 Requires:   qemu-linux-user
46 %else
47 Requires:   qemu-arm-static
48 %endif
49
50 BuildRequires:  python-devel
51 %if ! 0%{?tizen_version:1}
52 BuildRequires:  python-docutils
53 %endif
54
55 %if ! 0%{?centos_version}
56 BuildRequires:fdupes
57 %endif
58
59 %description
60 The tool mic is used to create and manipulate images for Linux distributions.
61 It is composed of three subcommand\: create, convert, chroot. Subcommand create
62 is used to create images with different types; subcommand convert is used to
63 convert an image to a specified type; subcommand chroot is used to chroot into
64 an image.
65
66 %prep
67 %setup -q -n %{name}-%{version}
68 %if 0%{?tizen_version:1}
69 cp %{SOURCE1001} .
70 %endif
71
72 %build
73 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
74 %if ! 0%{?tizen_version:1}
75 make man
76 %endif
77
78 %install
79 rm -rf %{buildroot}
80 %if 0%{?suse_version}
81 %{__python} setup.py install --root=%{buildroot} --prefix=%{_prefix}
82 %else
83 %{__python} setup.py install --root=%{buildroot} -O1
84 %endif
85
86 # install man page
87 mkdir -p %{buildroot}/%{_prefix}/share/man/man1
88 %if ! 0%{?tizen_version:1}
89 install -m644 doc/mic.1 %{buildroot}/%{_prefix}/share/man/man1
90 %endif
91
92 # install bash completion
93 install -d -m0755 %{buildroot}/%{_sysconfdir}/bash_completion.d/
94 install -Dp -m0755 etc/bash_completion.d/%{name}.sh %{buildroot}/%{_sysconfdir}/bash_completion.d/
95
96 # install zsh completion
97 install -d -m0755 %{buildroot}/%{_sysconfdir}/zsh_completion.d/
98 install -Dp -m0755 etc/zsh_completion.d/_%{name} %{buildroot}/%{_sysconfdir}/zsh_completion.d/
99
100 %if ! 0%{?centos_version}
101 %fdupes %{buildroot}
102 %endif
103
104
105 %files
106 %if 0%{?tizen_version:1}
107 %manifest %{name}.manifest
108 %endif
109 %defattr(-,root,root,-)
110 %if ! (0%{?suse_version} || 0%{?centos_version})
111 %license COPYING
112 %endif
113 %doc doc/*
114 %doc README.rst AUTHORS ChangeLog
115 %if ! 0%{?tizen_version:1}
116 %{_mandir}/man1/*
117 %endif
118 %dir %{_sysconfdir}/%{name}
119 %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
120 %{python_sitelib}/*
121 %dir %{_prefix}/lib/%{name}
122 %{_prefix}/lib/%{name}/*
123 %{_bindir}/mic
124 %{_sysconfdir}/bash_completion.d
125 %{_sysconfdir}/zsh_completion.d
126