Hello community,
here is the log from the commit of package obs-service-format_spec_file for
openSUSE:Factory checked in at 2012-02-20 16:15:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-format_spec_file (Old)
and /work/SRC/openSUSE:Factory/.obs-service-format_spec_file.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "obs-service-format_spec_file", Maintainer is ""
Changes:
--------
---
/work/SRC/openSUSE:Factory/obs-service-format_spec_file/obs-service-format_spec_file.changes
2012-02-16 16:21:22.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.obs-service-format_spec_file.new/obs-service-format_spec_file.changes
2012-02-20 16:15:40.000000000 +0100
@@ -1,0 +2,11 @@
+Mon Feb 20 13:19:09 UTC 2012 - [email protected]
+
+- fix sorting of tag lines that are not on the beginning of the file
+
+-------------------------------------------------------------------
+Mon Feb 20 08:15:52 UTC 2012 - [email protected]
+
+- not only break buildrequires per (sorted) line, but also
+ Requires and Provides
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ prepare_spec ++++++
--- /var/tmp/diff_new_pack.YrpFOF/_old 2012-02-20 16:15:40.000000000 +0100
+++ /var/tmp/diff_new_pack.YrpFOF/_new 2012-02-20 16:15:40.000000000 +0100
@@ -230,7 +230,7 @@
return ($curpack, $curlang);
}
-sub sort_buildrequires_helper {
+sub sort_tags_helper {
if (($a =~ /^[^#]*\(/) != ($b =~ /^[^#]*\(/)) {
if ($a =~ /^[^#]*\(/) {
1;
@@ -317,18 +317,23 @@
$_ =~ s/%{?epoch}?[:-]//g;
$_ =~ s/ 0:/ /g if ( /^requires/i || /^buildreq/i );
- if ( /^BuildRequires:/ ) {
- my $cur_buildreq = $_;
- $cur_buildreq =~ s/^BuildRequires:\s*//;
+ if ( /^BuildRequires:/i || /^Requires:/i || /^Provides:/i ) {
+ my $cur_tag = $_;
+ my $tag = '';
+ if (m/^(\S+):\s*(.*)$/) {
+ $tag = $1;
+ $cur_tag = $2;
+ }
+
my %aa;
- while ($cur_buildreq =~ m{([^,\s]+(\s*[<=>]+\s*[^,\s]+)?)}g) {
+ while ($cur_tag =~ m{([^,\s]+(\s*[<=>]+\s*[^,\s]+)?)}g) {
$aa{$1}=1;
}
# ignore line if it looks like a "usedforbuild" line, i.e.
# if it contains too many base packages
next if (grep {$aa{$_}} qw{gcc rpm glibc bash}) > 2;
- for my $br (sort keys(%aa)) {
- push @oldspec, "BuildRequires: $br";
+ for my $value (sort keys(%aa)) {
+ push (@oldspec, sprintf("%-16s%s", capitalize_case($tag) . ":",
$value));
}
next;
}
@@ -617,30 +622,38 @@
read_and_parse_old_spec ( $specfile, $base_package );
-my $linesmoved = 1;
-while ($linesmoved) {
+for my $tag (qw(BuildRequires Requires Provides)) {
+ my $linesmoved = 1;
+ sortcycle: while ($linesmoved) {
$linesmoved = 0;
my @firstlines = ();
- my @buildrequires = ();
+ my @tags = ();
while ($oldspec[0]) {
my $l = shift @oldspec;
- if ($l =~ m/^BuildRequires:/ ) {
- push(@buildrequires, $l);
+ if ($l =~ m/^$tag:/ ) {
+ push(@tags, $l);
} else {
- # if there are already buildrequires, we need to sort and exit
- if (@buildrequires > 0) {
- my @sortedbrs = sort sort_buildrequires_helper @buildrequires;
- $linesmoved = !compare_arrays(\@buildrequires, \@sortedbrs);
- @oldspec = (@firstlines, @sortedbrs, $l, @oldspec);
- @firstlines = ();
- @buildrequires = ();
- last;
+ # if there are already tags, we need to sort and exit
+ if (@tags > 0) {
+ my @sortedtags = sort sort_tags_helper @tags;
+ $linesmoved = !compare_arrays(\@tags, \@sortedtags);
+ if ($linesmoved) {
+ @oldspec = (@firstlines, @sortedtags, $l, @oldspec);
+ @firstlines = ();
+ @tags = ();
+ next sortcycle;
+ } else {
+ @firstlines = (@firstlines, @tags, $l);
+ @tags = ();
+ next;
+ }
} else {
push(@firstlines, $l);
}
}
}
@oldspec = (@firstlines, @oldspec);
+ }
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]