rpm-software-management / spec-cleaner

spec-cleaner
BSD 3-Clause "New" or "Revised" License
28 stars 34 forks source link

spec-cleaner crashes when 'cleaning' bundle-lang-common spec files #196

Closed DimStar77 closed 7 years ago

DimStar77 commented 7 years ago

Spec-cleaner is being used in order to get the bundle-lang-common (autogenerated) spec files somewhat readable.

Since a recent update this seems no longer to work. My history of spec-cleaner:

2017-05-22 14:33:43|install|spec-cleaner|0.9.5-1.1|noarch||repo-oss|c6b8e5b39062beaa7784c0abd569b636027940aa| 2017-06-13 13:41:24|install|spec-cleaner|0.9.6-1.1|noarch||repo-oss|877daf3bd821540723b3957b42e2660764c67e44| 2017-06-17 15:52:02|install|spec-cleaner|0.9.7-1.1|noarch||repo-oss|5229d346319f696e06a1d6620e7a5fdd7283ec37|

The last time I can claim that this was working must be June 12 (when the package was last updated)

How to reproduce:

osc co openSUSE:Factory/bundle-lang-common cd openSUSE:Factory/bundle-lang-common spec-cleaner bundle-lang-common.spec usually the script is started with -i, but it makes no difference)

This leads to this error:

Traceback (most recent call last):
  File "/usr/bin/spec-cleaner", line 11, in <module>
    load_entry_point('spec-cleaner==0.9.7', 'console_scripts', 'spec-cleaner')()
  File "/usr/lib/python3.6/site-packages/spec_cleaner/__init__.py", line 114, in main
    cleaner.run()
  File "/usr/lib/python3.6/site-packages/spec_cleaner/rpmcleaner.py", line 277, in run
    self.current_section.output(self.fout, self._check_for_newline(new_class, line), new_class.__name__)
  File "/usr/lib/python3.6/site-packages/spec_cleaner/rpmpreamble.py", line 486, in output
    lines = self.paragraph.flatten_output(self.subpkglicense)
  File "/usr/lib/python3.6/site-packages/spec_cleaner/rpmpreambleelements.py", line 314, in flatten_output
    self.items[i] = self._remove_duplicates(self.items[i])
  File "/usr/lib/python3.6/site-packages/spec_cleaner/rpmpreambleelements.py", line 229, in _remove_duplicates
    if item.name == element.name and item.prefix == element.prefix:
AttributeError: 'str' object has no attribute 'name'
DimStar77 commented 7 years ago

Thanks! Hot-patched my local install based on your diff and this indeed works now