From 996a0af0afece3eaec228abc49f7f372d34c87f97b726fd2eca219716c02b217 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Wed, 7 Dec 2011 14:05:00 +0000 Subject: [PATCH] - move pkgconfig() and co to the end of the buildrequires OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-format_spec_file?expand=0&rev=29 --- licenses_changes.txt | 2 +- obs-service-format_spec_file.changes | 5 +++++ prepare_spec | 16 ++++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/licenses_changes.txt b/licenses_changes.txt index 7aeebb7..c2ee98a 100644 --- a/licenses_changes.txt +++ b/licenses_changes.txt @@ -1,3 +1,4 @@ +SPDX Name in Spec File AAL AAL AFL-2.1 Academic Free License 2.1 AGPL-3.0 Affero GPL @@ -288,7 +289,6 @@ MS-PL Ms-Pl MS-PL MS-PL MS-RL MS-RL Multics Multics -SPDX Name in Spec File NASA-1.3 NASA-1.3 Naumen Naumen NCSA NCSA diff --git a/obs-service-format_spec_file.changes b/obs-service-format_spec_file.changes index 3e8307b..b3b8073 100644 --- a/obs-service-format_spec_file.changes +++ b/obs-service-format_spec_file.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Dec 7 14:04:46 UTC 2011 - coolo@suse.com + +- move pkgconfig() and co to the end of the buildrequires + ------------------------------------------------------------------- Wed Dec 7 08:22:29 UTC 2011 - coolo@suse.com diff --git a/prepare_spec b/prepare_spec index c954a9d..6393469 100644 --- a/prepare_spec +++ b/prepare_spec @@ -231,6 +231,18 @@ sub set_current_pkg { return ($curpack, $curlang); } +sub sort_buildrequires_helper { + if (($a =~ /^[^#]*\(/) != ($b =~ /^[^#]*\(/)) { + if ($a =~ /^[^#]*\(/) { + 1; + } else { + -1; + } + } else { + $a cmp $b; + } +} + sub read_and_parse_old_spec { my ( $specfile, $base_package ) = @_; my $current_package = $base_package; @@ -614,9 +626,9 @@ while ($linesmoved) { } else { # if there are already buildrequires, we need to sort and exit if (@buildrequires > 0) { - my @sortedbrs = sort(@buildrequires); + my @sortedbrs = sort sort_buildrequires_helper @buildrequires; $linesmoved = !compare_arrays(\@buildrequires, \@sortedbrs); - @oldspec = (@firstlines, sort(@buildrequires), $l, @oldspec); + @oldspec = (@firstlines, @sortedbrs, $l, @oldspec); @firstlines = (); @buildrequires = (); last;