Stephan Kulow 2011-12-21 09:01:37 +00:00 committed by Git OBS Bridge
commit bc2d8f5822
4 changed files with 94 additions and 3 deletions

View File

@ -0,0 +1,63 @@
#
# spec file for package obs-service-format_spec_file
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
Name: obs-service-format_spec_file
Summary: An OBS source service: reformats a spec file to SUSE standard
License: GPL-2.0+
Group: Development/Tools/Building
Version: 0.4
Release: 0
Url: https://github.com/openSUSE/obs-service-format_spec_file
Source: format_spec_file
Source1: format_spec_file.service
Source2: prepare_spec
Source3: patch_license
Source4: licenses_changes.txt
Requires: osc-source_validator
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
This is a source service for openSUSE Build Service.
This source service is formating the spec file to SUSE standard. The rational
behind is to make it easier to review spec files from unknown packagers.
This should be used in "trylocal" mode, so that osc is adapting the existing
spec file instead of creating a new one.
%prep
%setup -q -D -T 0 -n .
%build
%install
mkdir -p $RPM_BUILD_ROOT/usr/lib/obs/service/format_spec_file.files
install -m 0755 %{SOURCE0} $RPM_BUILD_ROOT/usr/lib/obs/service
install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/usr/lib/obs/service
install -m 0755 %{SOURCE2} %{SOURCE3} $RPM_BUILD_ROOT/usr/lib/obs/service/format_spec_file.files
install -m 0644 %{SOURCE4} $RPM_BUILD_ROOT/usr/lib/obs/service/format_spec_file.files
%files
%defattr(-,root,root)
%dir /usr/lib/obs
/usr/lib/obs/service
%changelog

View File

@ -1,4 +1,4 @@
SPDX Name in Spec File
SPDX Name in Spec File
AAL AAL
AFL-2.1 Academic Free License 2.1
AGPL-3.0 Affero GPL
@ -138,6 +138,7 @@ EUPL-1.1 EUPL-1.1
MIT Expat
MIT Expat License
Fair Fair
SUSE-FLTK Fltk
SUSE-GFDL-1.1 FDL v1.1 or later
SUSE-GFDL-1.2+ FDL-1.2+
SUSE-GFDL-1.3+ FDL-1.3+
@ -221,7 +222,9 @@ GPL-2.0+ GPLv2+
GPL-3.0 GPLv3
GPL-3.0+ GPLv3+
gSOAP-1.3b gSOAP-1.3b
SUSE-Gnuplot Gnuplot
HPND HPND
SUSE-IJG JPEG License
IPL-1.0 IBM PL
IPL-1.0 IBM Public License
IPL-1.0 IBM Public License ..
@ -364,3 +367,5 @@ ZPL-2.1 ZPL 2.1
ZPL-1.1 ZPL-1.1
ZPL-2.0 ZPL-2.0
ZPL-2.1 ZPL-2.1
SUSE-Firmware Firmware license, redistributable unmodified
SUSE-Permissive Must not be copyleft. Must not contain patent clauses of any nature. Most not limit ability to copy, modifiy, distribute (through multiple tiers of distribution) and distribute modified versions. Must not impose obligations such as 'advertising clauses' or anything that could be viewed as an 'additional restriction' under GPL-2.0+ or GPL-3.0+. Must not impose obligations such as modification by patch only, or reciprocal clauses.

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Mon Dec 19 08:40:02 UTC 2011 - coolo@suse.com
- put groups in subpackages unconditionally to leave sle11 support
intact
-------------------------------------------------------------------
Thu Dec 15 13:59:55 UTC 2011 - coolo@suse.com
- more licenses for SUSE-*
-------------------------------------------------------------------
Mon Dec 12 10:28:57 UTC 2011 - coolo@suse.com
- preserve release tag if it's more than a number
-------------------------------------------------------------------
Wed Dec 7 14:04:46 UTC 2011 - coolo@suse.com

View File

@ -24,7 +24,6 @@ my $vim_modeline;
my $nosrc_result = 0;
my $current_section = "header";
my $had_debug_package = 0;
my %pkg_version = ();
my $main_license;
my %seen_licenses = ();
my $main_group;
@ -490,6 +489,10 @@ sub read_and_parse_old_spec {
}
# reset Release
if ( /^Release\s*:\s*(.*)/i ) {
if ($1 !~ m/^[0-9]*$/ && $oldspec[-1] eq "XXXRELEASE") {
pop @oldspec;
push @oldspec, sprintf("%-16s%s","Release:", $1);
}
# will be after Version
next;
}
@ -535,7 +538,7 @@ sub read_and_parse_old_spec {
$version{$c_pack} = $_;
$version{$c_pack} =~ s/^Version:\s*(.*)\s*/$1/;
push @oldspec, sprintf("%-16s%s","Version:",$version{$c_pack});
push @oldspec, sprintf("%-16s%s","Release:", "0");
push @oldspec, "XXXRELEASE";
next;
}
}
@ -679,6 +682,8 @@ while ($oldspec[0] eq "XXXBLANKLINE") {
my $license_unique = !grep { $_ ne $main_license } values %seen_licenses;
my $groups_unique = !grep { $_ ne $main_group } values %seen_groups;
# we need to have unique groups in the spec file as long as we support SLE11 ;(
$groups_unique = 0;
my $first_summary = 1;
my $line;
@ -688,6 +693,8 @@ while (@oldspec) {
print "\n" unless $oldspec[0] && ($oldspec[0] =~ m/^XXX.*LINE/ || $oldspec[0] =~ /^\s*$/ || $oldspec[0] =~ /^\n/);
} elsif ($line eq "XXXDOUBLELINE") {
print "\n\n" unless $oldspec[0] && ($oldspec[0] =~ m/^XXX.*LINE/ || $oldspec[0] =~ /^\s*$/ || $oldspec[0] =~ /^\n/);
} elsif ($line eq "XXXRELEASE") {
printf("%-16s%s\n", "Release:", "0") ;
} elsif ($line =~ m/XXXPOSTSUMMARY (.*)$/) {
my $current_package = $1;
my $license = $seen_licenses{$current_package} || $main_license;