[Bug 891152] New: format_spec_file can damage spec file
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c0 Summary: format_spec_file can damage spec file Classification: openSUSE Product: openSUSE.org Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Major Priority: P5 - None Component: BuildService AssignedTo: ro@suse.com ReportedBy: sbrabec@suse.com QAContact: adrian@suse.com Found By: --- Blocker: --- Created an attachment (id=601758) --> (http://bugzilla.novell.com/attachment.cgi?id=601758) spec file before mangling by format_spec_file (copy it to python-libmount.spec and edit Name: to see what happens after format_spec_file). I created a very special spec file with preamble containing many conditionals. This spec file is intended to be compiled with 3 different names, where only Name tags needs to be edited. The spec file is mangled by format_spec_file: - Group tag is edited to an incorrect value. - License tag is move to incorrect place causes build to fail: [ 5s] error: License field must be present in package: (main package) diff -ur BEFORE_FORMAT/python-libmount.spec AFTER_FORMAT/python-libmount.spec --- BEFORE_FORMAT/python-libmount.spec 2014-08-08 23:19:08.000000000 +0200 +++ AFTER_FORMAT/python-libmount.spec 2014-08-08 23:19:45.000000000 +0200 @@ -109,7 +109,6 @@ # these tools as well #!BuildIgnore: pwdutils Url: https://www.kernel.org/pub/linux/utils/util-linux/ -License: GPL-2.0+ Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.25/%{_name}-%{version}.tar.xz Source1: util-linux-rpmlintrc Source4: raw.init @@ -159,7 +158,8 @@ PreReq: %insserv_prereq %fillup_prereq /bin/sed Recommends: %{name}-lang = %{version} Summary: A collection of basic system utilities -Group: System/Base +License: GPL-2.0+ +Group: System/Filesystems %if %{with enable_eject} Provides: eject = 2.1.0-166.8 %endif @@ -199,13 +199,13 @@ # if condition across preamble and subsequent sections. %if %build_python_libmount # Exact copy of the %%package tag from python-libmount section below: -Group: System/Filesystems Summary: Python bindings for the libmount library +Group: System/Filesystems %else %if %build_util_linux_systemd # Exact copy of the %%package tag from systemd section below: Summary: A collection of basic systemd utilities -Group: System/Base +Group: System/Filesystems Supplements: packageand(util-linux:systemd) # Split-provides for upgrade from SLE < 12 and openSUSE <= 13.1 Provides: util-linux:/usr/lib/systemd/system/fstrim.service diff -ur BEFORE_FORMAT/util-linux.spec AFTER_FORMAT/util-linux.spec --- BEFORE_FORMAT/util-linux.spec 2014-08-08 23:19:08.000000000 +0200 +++ AFTER_FORMAT/util-linux.spec 2014-08-08 23:19:45.000000000 +0200 @@ -109,7 +109,6 @@ # these tools as well #!BuildIgnore: pwdutils Url: https://www.kernel.org/pub/linux/utils/util-linux/ -License: GPL-2.0+ Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.25/%{_name}-%{version}.tar.xz Source1: util-linux-rpmlintrc Source4: raw.init @@ -159,6 +158,7 @@ PreReq: %insserv_prereq %fillup_prereq /bin/sed Recommends: %{name}-lang = %{version} Summary: A collection of basic system utilities +License: GPL-2.0+ Group: System/Base %if %{with enable_eject} Provides: eject = 2.1.0-166.8 @@ -199,8 +199,8 @@ # if condition across preamble and subsequent sections. %if %build_python_libmount # Exact copy of the %%package tag from python-libmount section below: -Group: System/Filesystems Summary: Python bindings for the libmount library +Group: System/Base %else %if %build_util_linux_systemd # Exact copy of the %%package tag from systemd section below: diff -ur BEFORE_FORMAT/util-linux-systemd.spec AFTER_FORMAT/util-linux-systemd.spec --- BEFORE_FORMAT/util-linux-systemd.spec 2014-08-08 23:19:08.000000000 +0200 +++ AFTER_FORMAT/util-linux-systemd.spec 2014-08-08 23:19:45.000000000 +0200 @@ -109,7 +109,6 @@ # these tools as well #!BuildIgnore: pwdutils Url: https://www.kernel.org/pub/linux/utils/util-linux/ -License: GPL-2.0+ Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.25/%{_name}-%{version}.tar.xz Source1: util-linux-rpmlintrc Source4: raw.init @@ -159,6 +158,7 @@ PreReq: %insserv_prereq %fillup_prereq /bin/sed Recommends: %{name}-lang = %{version} Summary: A collection of basic system utilities +License: GPL-2.0+ Group: System/Base %if %{with enable_eject} Provides: eject = 2.1.0-166.8 @@ -199,8 +199,8 @@ # if condition across preamble and subsequent sections. %if %build_python_libmount # Exact copy of the %%package tag from python-libmount section below: -Group: System/Filesystems Summary: Python bindings for the libmount library +Group: System/Base %else %if %build_util_linux_systemd # Exact copy of the %%package tag from systemd section below: -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c3 --- Comment #3 from Ruediger Oertel <ro@suse.com> 2014-08-12 22:02:01 UTC --- well, "License" and "Group" are moved strictly after "Summary", at least this is what's intended. the service lives in https://github.com/openSUSE/obs-service-format_spec_file I'll try to see what I can do to accommodate another specfile that's using quite a few more macros than usual ... -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c4 --- Comment #4 from Ruediger Oertel <ro@suse.com> 2014-08-12 22:37:04 UTC --- the group tag is caused by an inconsistency in the specfile. the last definition of the package "python-libmount" in the specfile defines the group of that package as "System/Filesystems", so this is used in all places where the formatter identifies a section for this package, which is also the case in the main part of python-libmount.spec. Once this is corrected, (line 202 and line 330) the Group definitions are left unchanged. checking the "License" tag handling next -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c5 Ruediger Oertel <ro@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO InfoProvider| |coolo@suse.com --- Comment #5 from Ruediger Oertel <ro@suse.com> 2014-08-12 23:01:33 UTC --- hm, the problem is that the main package's summary is in a %if %else cascade. this patch in prepare_spec (the variant used in obs-service-format_spec_file) would fix the problem without (hopefully) breaking other specfiles: diff --git a/prepare_spec b/prepare_spec index 58c7953..3da3c34 100755 --- a/prepare_spec +++ b/prepare_spec @@ -715,9 +715,9 @@ while (@oldspec) { } elsif ($line =~ m/XXXPOSTSUMMARY (.*)$/) { my $current_package = $1; my $license = $seen_licenses{$current_package} || $main_license; - printf("%-16s%s\n", "License:", $license) if (!$license_unique || $first_summary); + printf("%-16s%s\n", "License:", $license) if (!$license_unique || $first_summary || $current_package eq $base_package); my $group = $seen_groups{$current_package} || $main_group; - printf("%-16s%s\n", "Group:", $group) if (!$groups_unique || $first_summary); + printf("%-16s%s\n", "Group:", $group) if (!$groups_unique || $first_summary || $current_package eq $base_package); $first_summary = 0; } else { print "$line\n"; coolo, this is basically your code from 45d7922f9bca5a00df8c0a2d1c340b543c7938b3, what do you think ? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c6 Ruediger Oertel <ro@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- InfoProvider|coolo@suse.com |lnussel@suse.com --- Comment #6 from Ruediger Oertel <ro@suse.com> 2014-08-13 07:55:33 UTC --- looks like coolo is on vacation ... Ludwig, any comments ? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c7 Ludwig Nussel <lnussel@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW CC| |lnussel@suse.com InfoProvider|lnussel@suse.com | --- Comment #7 from Ludwig Nussel <lnussel@suse.com> 2014-08-13 10:20:42 CEST --- I don't know the first thing about that code. So go ahead if you think it's good. Some reference files as test suite would be nice :-) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c8 Ruediger Oertel <ro@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #8 from Ruediger Oertel <ro@suse.com> 2014-08-13 09:25:53 UTC ---
Some reference files as test suite would be nice :-) yes ...
okay, pushed to GIT, to openSUSE:Tools, sr created for Factory and SLE-12 deployed on service-servers for OBS and IBS -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c10 --- Comment #10 from Bernhard Wiedemann <bwiedemann@suse.com> 2014-08-13 12:00:12 CEST --- This is an autogenerated message for OBS integration: This bug (891152) was mentioned in https://build.opensuse.org/request/show/244526 Factory / obs-service-format_spec_file -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c11 --- Comment #11 from Stanislav Brabec <sbrabec@suse.com> 2014-08-13 22:22:06 CEST --- Created an attachment (id=602297) --> (http://bugzilla.novell.com/attachment.cgi?id=602297) util-linux.spec before calling osc build Reopening. New version edits spec file to an usable form, does not damage it, but it still edits Group to an incorrect value. But what is worse, the spec file edited by format_spec_file triggers another bug, now in check_if_valid_source_dir. Reporting as bug 891829. --- BEFORE/util-linux.spec 2014-08-13 22:00:23.000000000 +0200 +++ AFTER/util-linux.spec 2014-08-13 22:00:50.885106000 +0200 @@ -202,7 +202,7 @@ # Exact copy of the %%package tag from python-libmount section below: Summary: Python bindings for the libmount library License: GPL-2.0+ -Group: System/Filesystems +Group: System/Base %else %if %build_util_linux_systemd # Exact copy of the %%package tag from systemd section below: -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c12 Stanislav Brabec <sbrabec@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | Severity|Major |Minor --- Comment #12 from Stanislav Brabec <sbrabec@suse.com> 2014-08-13 22:24:03 CEST --- Re-opening the bug. It still edits Group tag to an incorrect value. Decreasing Importance to Normal: It does not block work any more. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c13 Ruediger Oertel <ro@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED --- Comment #13 from Ruediger Oertel <ro@suse.com> 2014-08-13 21:31:48 UTC --- as said in a previous comment: the group tag is caused by an inconsistency in the specfile. the last definition of the package "python-libmount" in the specfile defines the group of that package as "System/Filesystems", so this is used in all places where the formatter identifies a section for this package, which is also the case in the main part of python-libmount.spec. fix the specfile to use the same group for all occurrences of the same package and you will see it leaves the group as is. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c14 --- Comment #14 from Bernhard Wiedemann <bwiedemann@suse.com> 2014-08-14 03:00:27 CEST --- This is an autogenerated message for OBS integration: This bug (891152) was mentioned in https://build.opensuse.org/request/show/244638 Factory / obs-service-format_spec_file -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c15 --- Comment #15 from Bernhard Wiedemann <bwiedemann@suse.com> 2014-08-26 17:00:31 CEST --- This is an autogenerated message for OBS integration: This bug (891152) was mentioned in https://build.opensuse.org/request/show/246534 Factory / util-linux -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c16 Togan Muftuoglu <toganm@dinamizm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |toganm@dinamizm.com Resolution|FIXED | Severity|Minor |Normal --- Comment #16 from Togan Muftuoglu <toganm@dinamizm.com> 2014-09-02 07:48:11 UTC --- I have the following version installed from obs://build.opensuse.org/openSUSE:Tools Name : obs-service-format_spec_file Version : 20140825 Release : 191.1 The spec file's relevant portion is as follows Name: sawfish-pager Version: 0.90.4 Release: 0 Summary: Pager for Sawfish window manager License: GPL-2.0 %if 0%{?suse_version} > 1230 Group: User Interface/Desktops %else Group: System/GUI/Other %endif But after I run the format_spec_file the conditional for grouping is lost Name: sawfish-pager Version: 0.90.4 Release: 0 Summary: Pager for Sawfish window manager License: GPL-2.0 Group: System/GUI/Other %if 0%{?suse_version} > 1230 %else %endif -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c17 --- Comment #17 from Stanislav Brabec <sbrabec@suse.com> 2014-09-02 15:02:31 CEST --- Here is a solution (a work-around) invented by Ruediger that passes all checks: %define group_above1230 User Interface/Desktops %define group_below1230 System/GUI/Other %if 0%{?suse_version} > 1230 %define main_group %group_above1230 %else %define main_group %group_below1230 %endif Group: %main_group -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=891152 https://bugzilla.novell.com/show_bug.cgi?id=891152#c18 --- Comment #18 from Ruediger Oertel <ro@suse.com> 2014-09-02 15:12:53 UTC --- note that "Group:" is always the line after "Summary" and "License", so these defines need to happen further above in the specfile. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com