summaryrefslogtreecommitdiffstats
path: root/bin/devel-tools/parseSusePatterns.pl
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-09-02 17:50:49 +0200
committerSebastian Schmelzer2010-09-02 17:50:49 +0200
commit416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 (patch)
tree4715f7d742fec50931017f38fe6ff0a89d4ceccc /bin/devel-tools/parseSusePatterns.pl
parentFix for the problem reported on the list (sed filter forgotten for the (diff)
downloadcore-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.gz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.xz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.zip
change dir structure
Diffstat (limited to 'bin/devel-tools/parseSusePatterns.pl')
-rwxr-xr-xbin/devel-tools/parseSusePatterns.pl163
1 files changed, 0 insertions, 163 deletions
diff --git a/bin/devel-tools/parseSusePatterns.pl b/bin/devel-tools/parseSusePatterns.pl
deleted file mode 100755
index a286cd71..00000000
--- a/bin/devel-tools/parseSusePatterns.pl
+++ /dev/null
@@ -1,163 +0,0 @@
-#! /usr/bin/perl
-# -----------------------------------------------------------------------------
-# Copyright (c) 2006, 2007 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your suggestions, praise, or complaints to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org/
-# -----------------------------------------------------------------------------
-# parseSusePatterns.pl
-# - OpenSLX script to extract a package list from a given list of
-# SUSE-pattern-files (*.pat).
-# -----------------------------------------------------------------------------
-use strict;
-use warnings;
-
-my $abstract = q[
-parseSusePatterns.pl
- This script is a tool for OpenSLX developers that allows to extract
- package lists from a given set of SUSE pattern files.
-];
-
-use Getopt::Long;
-use Pod::Usage;
-
-my (
- $helpReq,
- $versionReq,
-
- %patternNames,
- %packageNames,
-);
-
-GetOptions(
- 'help|?' => \$helpReq,
- 'version' => \$versionReq,
-) or pod2usage(2);
-pod2usage(-msg => $abstract, -verbose => 0, -exitval => 1) if $helpReq;
-if ($versionReq) {
- system('slxversion');
- exit 1;
-}
-
-if ($ARGV[0] !~ m[^(\w+)-(.+)$]) {
- die "can't extract architecture from pattern file name '$ARGV[0]'";
-}
-my $arch = $2;
-
-foreach my $patternFile (@ARGV) {
- parsePatternFile($patternFile, 1);
-}
-
-print join("\n", sort keys %packageNames)."\n";
-
-exit;
-
-sub parsePatternFile
-{
- my $patternFile = shift;
- my $outmost = shift;
-
- my $patFH;
- if (!open($patFH, '<', $patternFile)) {
- return unless $outmost;
- die "unable to open $patternFile";
- }
- undef $/;
- my $content = <$patFH>;
- close($patFH);
- $patternNames{$patternFile} = 1;
-
- if ($content =~ m[^\=Sum.de:\s*(.+?)\s*$]ms) {
- print "+ $1\n";
- }
- if ($content =~ m[^\+Sug:\s*?$(.+?)^\-Sug:\s*?$]ms) {
- addSubPatterns($1);
- }
- if ($content =~ m[^\+Req:\s*?$(.+?)^\-Req:\s*?$]ms) {
- addSubPatterns($1);
- }
- if ($content =~ m[^\+Rec:\s*?$(.+?)^\-Rec:\s*?$]ms) {
- addSubPatterns($1);
- }
- if ($content =~ m[^\+Prq:\s*?$(.+?)^\-Prq:\s*?$]ms) {
- addPkgNames($1);
- }
- if ($content =~ m[^\+Prc:\s*?$(.+?)^\-Prc:\s*?$]ms) {
- addPkgNames($1);
- }
- return;
-}
-
-sub addSubPatterns
-{
- my $patternNames = shift;
-
- my @subPatterns
- = grep { length($_) > 0 }
- map {
- my $pattern = $_;
- $pattern =~ s[^\s*(.+?)\s*$][$1];
- $pattern;
- }
- split "\n", $patternNames;
-
- foreach my $subPattern (@subPatterns) {
- my $subPatternFile = "$subPattern-$arch";
- if (!exists $patternNames{$subPatternFile}) {
- parsePatternFile($subPatternFile);
- }
- }
- return;
-}
-
-sub addPkgNames
-{
- my $pkgs = shift;
-
- my @pkgNames
- = grep { length($_) > 0 }
- map {
- my $pkg = $_;
- $pkg =~ s[^\s*(.+?)\s*$][$1];
- $pkg;
- }
- split "\n", $pkgs;
- foreach my $pkgName (@pkgNames) {
- $packageNames{$pkgName} = 1;
- }
- return;
-}
-
-=head1 NAME
-
-parseSusePatterns.pl - OpenSLX script to extract a package list from
-a given list of SUSE-pattern-files (*.pat).
-
-=head1 SYNOPSIS
-
-parseSusePatterns.pl [options] <pattern-file> ...
-
- Options:
- --help brief help message
- --version show version
-
-=head1 OPTIONS
-
-=over 8
-
-=item B<--help>
-
-Prints a brief help message and exits.
-
-=item B<--version>
-
-Prints the version and exits.
-
-=back
-
-=cut \ No newline at end of file