5ba1c44d6c00ca773cde4db77b58940889a3d630
[packages/bash-completion.git] / bash-completion.spec
1 # vim:ft=spec
2 # TODO
3 # - use mkinitrd and update for geninitrd
4 # - fix vim not to mark this file as bash
5 Summary:        bash-completion offers programmable completion for bash
6 Summary(pl.UTF-8):      Programowalne uzupełnianie nazw dla basha
7 Name:           bash-completion
8 Version:        2.1
9 Release:        5
10 Epoch:          1
11 License:        GPL v2+
12 Group:          Applications/Shells
13 Source0:        http://bash-completion.alioth.debian.org/files/%{name}-%{version}.tar.bz2
14 # Source0-md5:  4e2a9f11a4042a38ee79ddcd048e8b9e
15 Source1:        %{name}-poldek.sh
16 # https://bugs.launchpad.net/ubuntu/+source/mysql-dfsg-5.0/+bug/106975
17 Source3:        http://launchpadlibrarian.net/19164189/mysqldump
18 # Source3-md5:  09e4885be92e032400ed702f39925d85
19 Source4:        pear
20 # Source4-md5:  8ce77e4459e2c45e2096da8d03c8f43d
21 Patch0:         %{name}-rpm-cache.patch
22 Patch1:         pear.patch
23 URL:            http://bash-completion.alioth.debian.org/
24 BuildRequires:  sed >= 4.0
25 Requires(triggerpostun):        sed >= 4.0
26 Requires:       bash >= 4.1
27 Requires:       issue >= 2013.01
28 Obsoletes:      bash-completion-rpm-cache
29 Conflicts:      rpm < 4.4.9-44
30 BuildArch:      noarch
31 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
32
33 %description
34 bash-completion is a collection of shell functions that take advantage
35 of the programmable completion feature of bash 4.1 and later.
36
37 %description -l pl.UTF-8
38 bash-completion jest kolekcją funkcji shella, które opierają się na
39 wbudowanych rozszerzeniach basha 4.1 lub późniejszego umożliwiającego
40 dopełnianie parametrów linii poleceń.
41
42 %prep
43 %setup -q
44 cp -p '%{SOURCE4}' completions/pear
45 %patch0 -p1
46 %patch1 -p1
47
48 # cleanup backups after patching
49 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
50
51 # update path
52 %{__sed} -i -e 's#${BASH_SOURCE\[0\]%/\*}#%{_datadir}/%{name}#' completions/perl
53
54 %build
55 %configure
56 %{__make}
57
58 %install
59 rm -rf $RPM_BUILD_ROOT
60 install -d $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
61
62 %{__make} install -j1 \
63         INSTALL="install -p" \
64         profiledir=/etc/shrc.d \
65         DESTDIR=$RPM_BUILD_ROOT
66
67 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/poldek
68 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/mysqldump
69 cp -p completions/pear $RPM_BUILD_ROOT%{_datadir}/%{name}/completions
70
71 # util-linux
72 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/{cal,chsh,dmesg,eject,hexdump,hwclock,ionice,look,newgrp,renice,rtcwake,su}
73 # No package matches '*/apache2ctl'
74 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/apache2ctl
75 # No TLD package or no such binary to complete on
76 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/{larch,lisp,monodevelop,[pg]4,cowsay,cowthink,cpan2dist}
77 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/{mkinitrd,rpmcheck}
78 # FreeBSD stuff
79 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/{kldload,portupgrade}
80 # Debian stuff
81 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/{apt-build,dselect,reportbug,alternatives,update-alternatives,lintian,lintian-info}
82 # NetworkManager stuff
83 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/nmcli
84
85
86 # do not generate autodeps
87 chmod a-x $RPM_BUILD_ROOT%{_datadir}/%{name}/helpers/perl
88
89 %clean
90 rm -rf $RPM_BUILD_ROOT
91
92 %triggerpostun -- %{name} < 20050721-3.9
93 sed -i -e '/^# START bash completion/,/^# END bash completion/d' /etc/bashrc
94
95 %files
96 %defattr(644,root,root,755)
97 %doc AUTHORS CHANGES README
98 /etc/shrc.d/bash_completion.sh
99 %dir %{_sysconfdir}/bash_completion.d
100 %dir %{_datadir}/%{name}
101 %{_datadir}/%{name}/bash_completion
102 %dir %{_datadir}/%{name}/completions
103 %{_datadir}/%{name}/completions/*
104 %dir %{_datadir}/%{name}/helpers
105 %attr(755,root,root) %{_datadir}/%{name}/helpers/perl
106 %{_npkgconfigdir}/bash-completion.pc