rpm-software-management / spec-cleaner

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

spec-cleaner destroys multiline %{expand: } macros #280

Closed dcermak closed 4 years ago

dcermak commented 4 years ago

I have tried to run spec-cleaner on a spec file that includes the following %{expand: } macro:

%global _description %{expand:
RStudio is an integrated development environment (IDE) for R. It includes a
console, syntax-highlighting editor that supports direct code execution, as
well as tools for plotting, history, debugging and workspace management.
}

Unfortunately spec-cleaner completely destroys the resulting spec file by splitting the first line from the rest.

The full spec file is this one: https://src.fedoraproject.org/rpms/rstudio/raw/master/f/rstudio.spec

scarabeusiv commented 4 years ago

Feel free to improve the expand parsing. This is really convluted way to do multiline declarations tbh... It should be something like

%define variable blablabla \
   blabla line2 \
   blabla line3
scarabeusiv commented 4 years ago

You can prepare minimal testcase so we can have it in to observe the issue with CI.

dcermak commented 4 years ago

This "spec file" triggers the issue:

Name:           rstudio

%global _description %{expand:
RStudio is an integrated development environment (IDE) for R. It includes a
console, syntax-highlighting editor that supports direct code execution, as
well as tools for plotting, history, debugging and workspace management.
}

%description %_description
This package provides common files for %{name}-desktop and %{name}-server.

spec-cleaner moves creates currently this output:

# spec file for package breaker
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%global _description %{expand:
Name:           rstudio
RStudio is an integrated development environment (IDE) for R. It includes a
console, syntax-highlighting editor that supports direct code execution, as
well as tools for plotting, history, debugging and workspace management.
}

%description %{_description}
This package provides common files for %{name}-desktop and %{name}-server.

%changelog
scarabeusiv commented 4 years ago

I was more thinging about creating PR with the samples as inlined in https://github.com/rpm-software-management/spec-cleaner/blob/master/TESTSUITE.md