juhp / cabal-rpm

Haskell Cabal RPM packaging tool
https://hackage.haskell.org/package/cabal-rpm
GNU General Public License v3.0
25 stars 8 forks source link

Don't duplicate data files in %doc statement. #38

Closed peti closed 8 years ago

peti commented 8 years ago

Don't consider declared data-files when guessing the set of %doc files to avoid installing them twice.

Cc: @mimi1vx

juhp commented 8 years ago

Okay, let me test how this affects Fedora - it might be better to do this only for SUSE I am not sure.

juhp commented 8 years ago

Again some example would be helpful, if you have any?

peti commented 8 years ago

I am not sure what you mean. When a file is installed as a data-file already, then it seems redundant to install it again into the %doc directory, no? The use case seems obvious to me and I'm not sure how to motivate this change any further beyond "don't install the same file twice".

juhp commented 8 years ago

I just meant if you have any examples of packages where this patch has an effect, to understand the problem better and to test the change. Also behind my question is the concern whether some of those files are really data files or doc files. Cabal packaging has had a tendency just to put misc/doc files into datadir which I don't particularly like. I do agree duplicating files is not good, but just want to make sure they end up in the right place.

peti commented 8 years ago

Ah, I misunderstood your question. I am sorry. An example package where this patch makes a difference is siphash. Without this patch, the files section looks like this:

%files -f %{name}.files
%defattr(-,root,root,-)
%doc LICENSE
%dir %{_datadir}/%{pkg_name}-%{version}
%{_datadir}/%{pkg_name}-%{version}/README.md

%files devel -f %{name}-devel.files
%defattr(-,root,root,-)
%doc README.md

So README.md installed both as a data file and as part of the documentation. With the patch applied, that becomes:

%files -f %{name}.files
%defattr(-,root,root,-)
%doc LICENSE
%dir %{_datadir}/%{pkg_name}-%{version}
%{_datadir}/%{pkg_name}-%{version}/README.md

%files devel -f %{name}-devel.files
%defattr(-,root,root,-)
juhp commented 8 years ago

Okay, but then i would argue it is the wrong solution since the README file should be docdir IMHO. Maybe SUSE is more relaxed about this perhaps. Then I would prefer to filter docdir files from datadir instead if possible.

mimi1vx commented 8 years ago

+1 for filter docdir from datadir ... all doku should be in %docdir

peti commented 8 years ago

I would prefer to filter docdir files from datadir instead if possible.

Yeah, that's fine. My concern is that these files shouldn't be installed twice. I don't feel strongly about where to install them to.

juhp commented 8 years ago

Untested but I hope the above commit does the right thing.