From 0a11a545b12ae7f1288a9a242daaec386241f26c7b47057836624a150e577726 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Mon, 23 Jul 2018 08:58:45 +0000 Subject: [PATCH] Accepting request 621297 from SUSE:SLE-15:GA boo#1100248 OBS-URL: https://build.opensuse.org/request/show/621297 OBS-URL: https://build.opensuse.org/package/show/system:install:head/patterns-devel-base?expand=0&rev=9 --- create_32bit-patterns_file.pl | 173 ++++++++++++++++++++++++++++++++++ pattern-definition-32bit.txt | 81 ++++++++++++++++ patterns-devel-base.changes | 12 +++ patterns-devel-base.spec | 30 +++++- pre_checkin.sh | 4 + 5 files changed, 299 insertions(+), 1 deletion(-) create mode 100644 create_32bit-patterns_file.pl create mode 100644 pattern-definition-32bit.txt create mode 100644 pre_checkin.sh diff --git a/create_32bit-patterns_file.pl b/create_32bit-patterns_file.pl new file mode 100644 index 0000000..bc743a7 --- /dev/null +++ b/create_32bit-patterns_file.pl @@ -0,0 +1,173 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my $verbose = 0; +my $pat_ext = "32bit"; +my $product = ""; +my @skip_pat = (); + +sub get_file { + my $file_to_get = shift; + my $content = ""; + + open FILE, "<$file_to_get" or return "\n"; + while (defined (my $line = )) { + next if ($line =~ m/^#/); + $content .= $line; + } + close FILE; + return $content; +} + +sub print_usage { + print "$0 [-v] [-h]\n"; + exit 0; +} + +sub print_debug { + my ($txt, $lvl) = @_; + print (STDERR "DBG: ${txt}\n") if($verbose >= $lvl); +} + +sub parse_line { + my $to_parse = shift; + my $tmp = ""; + if ($to_parse =~ /%include/) { + # TBD + print "%include at unexpected position, exiting\n"; + exit (1); + } + if ($to_parse =~ /Summary:/) { + return "$to_parse\n"; + } + # XXX simplify me + if ($to_parse =~ /Recommends:\s*([^\s]*)\s*/) { + $tmp = "$1"; + return "" if ($tmp =~ m/.*-64bit\s*$/); + $tmp = "${tmp}-32bit" if($tmp !~ m/.*-32bit/); + return "Recommends: ${tmp}\n"; + } + if ($to_parse =~ /Requires:\s*([^\s]*)\s*/) { + $tmp = "$1"; + return "" if ($tmp =~ m/pattern()/); + return "" if ($tmp =~ m/.*-64bit\s*$/); + $tmp = "${tmp}-32bit" if($tmp !~ m/.*-32bit/); + return "Recommends: ${tmp}\n"; + } + return ""; +} + +sub parse_main_file { + my $main_file = shift; + my $spec_file = ""; + my $cur_pattern = ""; + my $skip_it = 1; + my %skip_pat_hash; + if(! open (MAIN_FILE, "<$main_file")) { + print STDERR "${main_file} not found, exiting\n"; + exit 1; + } + while (defined (my $line = )) { + chomp($line); + next if ($line =~ m/^#/); + if ($line =~ m/\%package/) { + if(($line =~ m/32bit/) or + ($line =~ m/64bit/) + ) { + $skip_it = 1; + } else { + %skip_pat_hash = map { $_ => 1 } @skip_pat; + if($skip_it==0&&!exists($skip_pat_hash{$cur_pattern})) { + $spec_file .= "" + ."Provides: pattern() = ${cur_pattern}-32bit\n" + ."Group: Metapackages\n" + ."Supplements: packageand(patterns-${pat_ext}:patterns-${cur_pattern})\n" + ."\n" + ."%files ${cur_pattern}-32bit\n" + ."%defattr(-,root,root)\n" + ."%dir /usr/share/doc/packages/patterns\n" + ."/usr/share/doc/packages/patterns/${cur_pattern}-${pat_ext}.txt\n" + ."\n" + ."%description ${cur_pattern}-${pat_ext}\n" + ."The ${pat_ext} pattern complementing ${cur_pattern}.\n" + ."#\n" + ."#-------------------------------------------------------------------\n" + ."#\n"; + } + $skip_it = 0 ; + $line =~ m/package\s*([^\s]*)\s*/; + $cur_pattern = $1; + if (!exists($skip_pat_hash{$cur_pattern})) { + $spec_file .= "%package ${cur_pattern}-32bit\n"; + } + } + } + next if($skip_it == 1 ); + if ($line =~ /%include/) { + my $file_to_check = ($line =~ m/%include.*?([^\/\s]*)$/)[0]; # beware the non-greedy '?' + next if($file_to_check =~ m/32bit/); + if( open TMP_FILE, "<$file_to_check") { + print_debug(" Checking INCLUDE: $file_to_check", 2); + while (defined (my $include_line = )) { + if (!exists($skip_pat_hash{$cur_pattern})) { + $spec_file .= parse_line($include_line); + } + } + close TMP_FILE; + } + next; + } + if (!exists($skip_pat_hash{$cur_pattern})) { + $spec_file .= parse_line($line); + } + } + + %skip_pat_hash = map { $_ => 1 } @skip_pat; + if (!exists($skip_pat_hash{$cur_pattern})) { + # I hate this, but need a fast workaround + $spec_file .= "Provides: pattern-invisible()\n" + ."Provides: pattern() = ${cur_pattern}-${pat_ext}\n" + ."Group: Metapackages\n" + ."Supplements: packageand(patterns-${pat_ext}:patterns-${cur_pattern})\n" + ."\n" + ."%files ${cur_pattern}-32bit\n" + ."%defattr(-,root,root)\n" + ."%dir /usr/share/doc/packages/patterns\n" + ."/usr/share/doc/packages/patterns/${cur_pattern}-${pat_ext}.txt\n" + ."\n" + ."%description ${cur_pattern}-${pat_ext}\n" + ."The ${pat_ext} pattern complementing ${cur_pattern}.\n" + ."\n"; + } + + close MAIN_FILE; + + my $new_file = $spec_file; + + return $new_file; +} + +while ($ARGV[0] && $ARGV[0] =~ /^-/) { + my $arg = shift; + if ($arg =~ /-v/) { + $verbose += 1; + } elsif($arg =~ /-h/) { + print_usage(); + exit(); + } elsif($arg =~ /-p/) { + $product=shift; + } elsif($arg =~ /-e/) { + $pat_ext=shift; + } elsif($arg =~ /-s/) { + push @skip_pat, shift; + } + +} + +print_debug("product = ${product}\n pat_ext=${pat_ext}\n", 1); +my $result = parse_main_file("patterns-${product}.spec"); +print "${result}\n"; +exit 0; + diff --git a/pattern-definition-32bit.txt b/pattern-definition-32bit.txt new file mode 100644 index 0000000..dc24cfa --- /dev/null +++ b/pattern-definition-32bit.txt @@ -0,0 +1,81 @@ +%package devel_basis-32bit +Summary: Base Development +Recommends: autoconf-32bit +Recommends: automake-32bit +Recommends: binutils-32bit +Recommends: bison-32bit +Recommends: cpp-32bit +Recommends: flex-32bit +Recommends: gcc-32bit +Recommends: gdbm-devel-32bit +Recommends: gettext-tools-32bit +Recommends: glibc-devel-32bit +Recommends: libtool-32bit +Recommends: m4-32bit +Recommends: make-32bit +Recommends: makeinfo-32bit +Recommends: ncurses-devel-32bit +Recommends: patch-32bit +Recommends: zlib-devel-32bit +Recommends: bin86-32bit +Recommends: db-devel-32bit +Recommends: gcc-c++-32bit +Recommends: gcc-info-32bit +Recommends: git-32bit +Recommends: glibc-info-32bit +Recommends: gmp-devel-32bit +Recommends: gperf-32bit +Recommends: libaio-devel-32bit +Recommends: libgcj-devel-32bit +Recommends: libstdc++-devel-32bit +Recommends: openldap2-devel-32bit +Recommends: pam-devel-32bit +Recommends: pkg-config-32bit +Recommends: subversion-32bit +Recommends: fdupes-32bit +Recommends: patch-32bit +Recommends: binutils-devel-32bit +Recommends: e2fsprogs-devel-32bit +Recommends: libapparmor-devel-32bit +Recommends: libosip2-devel-32bit +Provides: pattern() = devel_basis-32bit +Group: Metapackages +Supplements: packageand(patterns-32bit:patterns-devel_basis) + +%files devel_basis-32bit +%defattr(-,root,root) +%dir /usr/share/doc/packages/patterns +/usr/share/doc/packages/patterns/devel_basis-32bit.txt + +%description devel_basis-32bit +The 32bit pattern complementing devel_basis. +# +#------------------------------------------------------------------- +# +%package devel_kernel-32bit +Summary: Linux Kernel Development +Recommends: kernel-source-32bit +Recommends: ctags-32bit +Recommends: diffstat-32bit +Recommends: git-core-32bit +Recommends: indent-32bit +Recommends: patchutils-32bit +Recommends: quilt-32bit +Recommends: gitk-32bit +Recommends: git-email-32bit +Recommends: kernel-syms-32bit +Provides: pattern() = devel_kernel-32bit +Group: Metapackages +Supplements: packageand(patterns-32bit:patterns-devel_kernel) + +%files devel_kernel-32bit +%defattr(-,root,root) +%dir /usr/share/doc/packages/patterns +/usr/share/doc/packages/patterns/devel_kernel-32bit.txt + +%description devel_kernel-32bit +The 32bit pattern complementing devel_kernel. +# +#------------------------------------------------------------------- +# + diff --git a/patterns-devel-base.changes b/patterns-devel-base.changes index f99d369..ca9dc4c 100644 --- a/patterns-devel-base.changes +++ b/patterns-devel-base.changes @@ -1,7 +1,19 @@ +------------------------------------------------------------------- +Mon Dec 11 11:25:36 UTC 2017 - simonf.lees@suse.com + +- correctly source the files for 32bit patterns + +------------------------------------------------------------------- +Mon Dec 4 09:38:25 UTC 2017 - sflees@suse.de + +- obsolete old SLES/SLED development patterns (bsc#1070151) + ------------------------------------------------------------------- Thu Sep 21 10:52:11 UTC 2017 - sflees@suse.de - Swap web pattern from php5 to php7 +- Add 32bit patterns +- Only build certain patterns for openSUSE ------------------------------------------------------------------- Mon Jul 17 06:32:17 UTC 2017 - sflees@suse.de diff --git a/patterns-devel-base.spec b/patterns-devel-base.spec index ef7068e..f044413 100644 --- a/patterns-devel-base.spec +++ b/patterns-devel-base.spec @@ -26,6 +26,8 @@ License: MIT Group: Metapackages Url: https://github.com/openSUSE/patterns Source0: %{name}-rpmlintrc +Source1: pattern-definition-32bit.txt +Source2: create_32bit-patterns_file.pl BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: patterns-rpm-macros @@ -48,6 +50,12 @@ Provides: pattern() = devel_basis Provides: pattern-icon() = pattern-basis-devel Provides: pattern-order() = 3140 Provides: pattern-visible() +%if ! 0%{?is_opensuse} +Provides: patterns-sles-Basis-Devel = %{version} +Provides: patterns-sled-Basis-Devel = %{version} +Obsoletes: patterns-sles-Basis-Devel < %{version} +Obsoletes: patterns-sled-Basis-Devel < %{version} +%endif Requires: pattern() = basesystem Requires: autoconf @@ -150,6 +158,7 @@ Tools for Linux kernel development. ################################################################################ +%if 0%{?is_opensuse} %package devel_rpm_build %pattern_development Summary: RPM Build Environment @@ -174,9 +183,11 @@ Minimal set of tools and libraries for building packages using the RPM package m %files devel_rpm_build %dir /usr/share/doc/packages/patterns /usr/share/doc/packages/patterns/devel_rpm_build.txt +%endif ################################################################################ +%if 0%{?is_opensuse} %package devel_web %pattern_development Summary: Web Development @@ -259,6 +270,7 @@ Tools and libraries for Web application development. %files devel_web %dir /usr/share/doc/packages/patterns /usr/share/doc/packages/patterns/devel_web.txt +%endif ################################################################################ @@ -268,7 +280,23 @@ Tools and libraries for Web application development. %install mkdir -p "%{buildroot}/usr/share/doc/packages/patterns" -for i in devel_basis devel_kernel devel_rpm_build devel_web; do +%if 0%{?is_opensuse} +for i in devel_rpm_build devel_web; do echo "This file marks the pattern $i to be installed." \ >"%{buildroot}/usr/share/doc/packages/patterns/$i.txt" done +%endif + +for i in devel_basis devel_kernel; do + echo "This file marks the pattern $i to be installed." \ + >"%{buildroot}/usr/share/doc/packages/patterns/$i.txt" + echo "This file marks the pattern $i-32bit to be installed." \ + >"%{buildroot}/usr/share/doc/packages/patterns/$i-32bit.txt" +done + +# +# This file is created at check-in time. Sorry for the inconsistent workflow :( +# +%include %{SOURCE1} + +%changelog diff --git a/pre_checkin.sh b/pre_checkin.sh new file mode 100644 index 0000000..e823000 --- /dev/null +++ b/pre_checkin.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +./create_32bit-patterns_file.pl -p devel-base -s devel_rpm_build -s devel_web > pattern-definition-32bit.txt +