- merged 2.11 from PLD
[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.11
9 Release:        2
10 Epoch:          1
11 License:        GPL v2+
12 Group:          Applications/Shells
13 #Source0Download: https://github.com/scop/bash-completion/releases
14 Source0:        https://github.com/scop/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
15 # Source0-md5:  2514c6772d0de6254758b98c53f91861
16 Source1:        %{name}-poldek.sh
17 # https://bugs.launchpad.net/ubuntu/+source/mysql-dfsg-5.0/+bug/106975
18 Source3:        http://launchpadlibrarian.net/19164189/mysqldump
19 # Source3-md5:  09e4885be92e032400ed702f39925d85
20 Source4:        http://svn.php.net/viewvc/pear2/sandbox/PEAR_BashCompletion/trunk/pear?revision=285425&view=co?/pear
21 # Source4-md5:  8ce77e4459e2c45e2096da8d03c8f43d
22 Patch0:         %{name}-rpm-cache.patch
23 Patch1:         pear.patch
24 Patch2:         %{name}-ip_addresses.patch
25 Patch3:         %{name}-no_mtr.patch
26 URL:            https://github.com/scop/bash-completion
27 BuildRequires:  sed >= 4.0
28 Requires(post): sed >= 4.0
29 Requires:       bash >= 4.1
30 Requires:       issue >= 2013.01
31 Obsoletes:      bash-completion-rpm-cache
32 Conflicts:      rpm < 4.4.9-44
33 BuildArch:      noarch
34 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35
36 %description
37 bash-completion is a collection of shell functions that take advantage
38 of the programmable completion feature of bash 4.1 and later.
39
40 %description -l pl.UTF-8
41 bash-completion jest kolekcją funkcji shella, które opierają się na
42 wbudowanych rozszerzeniach basha 4.1 lub późniejszego umożliwiającego
43 dopełnianie parametrów linii poleceń.
44
45 %package devel
46 Summary:        Development files for bash-completion
47 Summary(pl.UTF-8):      Pliki programistyczne do pakietu bash-completion
48 Group:          Development/Tools
49 # doesn't require base: it just contain paths configuration
50 Conflicts:      bash-completion < 1:2.11
51
52 %description devel
53 pkg-config and cmake files for bash-completion packages development.
54
55 %description devel -l pl.UTF-8
56 Pliki pkg-configa i cmake'a do tworzenia pakietów bash-completion.
57
58 %prep
59 %setup -q
60 cp -p '%{SOURCE4}' completions/pear
61 %patch0 -p1
62 %patch1 -p1
63 %patch2 -p1
64 %patch3 -p1
65
66 # cleanup backups after patching
67 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
68
69 # update path
70 %{__sed} -i -e 's#${BASH_SOURCE\[0\]%/\*}#%{_datadir}/%{name}#' completions/perl
71
72 %build
73 %configure
74 %{__make}
75
76 %install
77 rm -rf $RPM_BUILD_ROOT
78 install -d $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
79
80 %{__make} install -j1 \
81         INSTALL="install -p" \
82         profiledir=/etc/shrc.d \
83         DESTDIR=$RPM_BUILD_ROOT
84
85 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/poldek
86 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/mysqldump
87 cp -p completions/pear $RPM_BUILD_ROOT%{_datadir}/%{name}/completions
88
89 # No package matches '*/apache2ctl'
90 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/apache2ctl
91 # No PLD package or no such binary to complete on
92 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/{larch,lisp,monodevelop,[pg]4,cowsay,cowthink,cpan2dist}
93 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/{mkinitrd,rpmcheck}
94 # FreeBSD stuff
95 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/{kldload,portupgrade}
96 # Debian stuff
97 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/completions/{apt-build,bts,dselect,reportbug,alternatives,update-alternatives,lintian,lintian-info}
98
99 # do not generate autodeps
100 chmod a-x $RPM_BUILD_ROOT%{_datadir}/%{name}/helpers/perl
101
102 %clean
103 rm -rf $RPM_BUILD_ROOT
104
105 %triggerpostun -- %{name} < 20050721-3.9
106 sed -i -e '/^# START bash completion/,/^# END bash completion/d' /etc/bashrc
107
108 %files
109 %defattr(644,root,root,755)
110 %doc AUTHORS CHANGES README.md
111 /etc/shrc.d/bash_completion.sh
112 %dir %{_sysconfdir}/bash_completion.d
113 %dir %{_datadir}/%{name}
114 %{_datadir}/%{name}/bash_completion
115 %dir %{_datadir}/%{name}/completions
116 %{_datadir}/%{name}/completions/*
117 %dir %{_datadir}/%{name}/helpers
118 %attr(755,root,root) %{_datadir}/%{name}/helpers/perl
119 %attr(755,root,root) %{_datadir}/%{name}/helpers/python
120
121 %files devel
122 %defattr(644,root,root,755)
123 %{_npkgconfigdir}/bash-completion.pc
124 %{_datadir}/cmake/bash-completion