summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Bogusz2014-11-01 10:36:27 (GMT)
committerJakub Bogusz2014-11-01 10:36:27 (GMT)
commitf391d7c77b0e5dc6426b55efc9b57bdca23fcb8e (patch)
treef5854224d1b0b4d829ee108b0314c83ebeba4981
parentabb94dc3d1d9b10aded0b60b4a8a961dd8c84d33 (diff)
downloadapparmor-utils-f391d7c77b0e5dc6426b55efc9b57bdca23fcb8e.zip
apparmor-utils-f391d7c77b0e5dc6426b55efc9b57bdca23fcb8e.tar.gz
- perl part is deprecated, moved to perl-Immunix.spec
-rw-r--r--Ycp.pm328
-rw-r--r--apparmor-utils.spec24
2 files changed, 6 insertions, 346 deletions
diff --git a/Ycp.pm b/Ycp.pm
deleted file mode 100644
index 4a7e179..0000000
--- a/Ycp.pm
+++ /dev/null
@@ -1,328 +0,0 @@
-# $Id$
-#
-
-# ------------------------------------------------------------------
-#
-# Copyright (C) 2002-2005 Novell/SUSE
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of version 2 of the GNU General Public
-# License published by the Free Software Foundation.
-#
-# ------------------------------------------------------------------
-
-package Immunix::Ycp;
-
-use strict;
-use warnings;
-#use Data::Dumper;
-
-require Exporter;
-our @ISA = qw(Exporter);
-our @EXPORT = qw(y2milestone y2debug ParseCommand Return ycpReturn ycpReturnSkalarAsString ycpReturnHashAsMap ycpGetCommand ycpGetArgType);
-
-sub y2milestone {
-
- my $mesg = shift;
- my $logFile = '/var/log/YaST2/imx-log';
-
- if ( open(LOG, ">>$logFile") ) {
- my $date = localtime;
- print LOG "$date: $mesg\n";
- close LOG;
- }
-
-}
-
-sub y2error {
-
- my $mesg = shift;
- my $logFile = '/var/log/YaST2/imx-errors';
-
- if ( open(LOG, ">>$logFile") ) {
- my $date = localtime;
- print LOG "$date: ERROR: $mesg\n";
- close LOG;
- }
-}
-
-sub y2debug {
-
- my $mesg = shift;
- my $logFile = '/var/log/YaST2/imx-debug';
-
- if ( open(LOG, ">>$logFile") ) {
- my $date = localtime;
- print LOG "$date: DEBUG: $mesg\n";
- close LOG;
- }
-}
-
-sub ycpGetCommand { }
-sub ycpGetArgType { }
-
-sub perlToYcp {
-
- my $ref = shift;
-
- my $string;
-
- if(ref($ref) eq "HASH") {
- $string = '$[';
- for my $key (keys %$ref) {
- if($key =~ m/^\d+$/) {
- $string .= "$key:" . perlToYcp($ref->{$key}) . ",";
- } else {
- $string .= "\"$key\":" . perlToYcp($ref->{$key}) . ",";
- }
- }
- $string .= '] ';
- } elsif(ref($ref) eq "ARRAY") {
- $string = '[';
- for my $element (@$ref) {
- $string .= perlToYcp($element) . ',';
- }
- $string .= '] ';
- } elsif(defined $ref) {
-
- if($ref =~ m/^(true|false|nil|\d+)$/) {
- $string = "$ref";
- } else {
- $string = "\"$ref\"";
- }
- } else {
- $string = "nil";
- }
- return $string;
-}
-
-sub Return {
- my $data = shift;
-
- return ycpReturn($data);
-}
-
-sub ycpReturn {
- my $data = shift;
-
- my $string;
- if(ref($data)) {
- $string = perlToYcp($data);
- } else {
- $string = "(" . perlToYcp($data) . ")";
- }
- $| = 1;
- print $string;
-}
-
-sub ycpReturnHashAsMap {
- my %hash = @_;
-
- return ycpReturn(\%hash);
-}
-
-sub ycpReturnSkalarAsString {
- my $scalar = shift;
-
- return ycpReturn($scalar);
-}
-
-#my $data = { foo => [ "one", "two", "three" ], bar => "foobar" };
-#my $data = [ "foo", [ "one", "two", "three" ], "bar", "foobar" ];
-#Return($data);
-
-sub ycpToPerl {
- my $string = shift || "";
-
- my $original_string = $string;
-
- my @stack = ( "TOPOFSTACK" );
-
- my $tree;
- my $where;
- my $key = "";
-
- # strip leading whitespace
- $string =~ s/^\s+//;
- # strip trailing comma or whitespace if they exist
- $string =~ s/,?\s*$//;
-
- while($string) {
- if($string =~ s/^\$\[//s) { # beginning of a hash
-
- # create a new hash ref
- my $hash = { };
-
- # insert it into the tree at our current location
- if(not $tree) {
- # if tree hasn't been set up yet, create it now as a hash
- $tree = $hash;
- $where = $tree;
- } elsif(ref($where) eq "ARRAY") {
- push @$where, $hash;
- } elsif(ref($where) eq "HASH") {
- if($key) {
- $where->{$key} = $hash;
- } else {
- die "ERROR: trying to insert hash value without a key: $_";
- }
- } else {
- die "ERROR: clowns ate my brain: $_";
- }
-
- # zero out out the key for the new hash...
- $key = "";
-
- # push the parent onto the stack
- push @stack, $where;
-
- # our new "current" location is the newly created hash
- $where = $hash;
-
- } elsif($string =~ s/^\[//s) { # beginning of an array
-
- # create a new array ref
- my $array = [ ];
-
- # insert it into the tree at our current location
- if(not $tree) {
- # if tree hasn't been set up yet, create it now as an array
- $tree = $array;
- $where = $tree;
- } elsif(ref($where) eq "ARRAY") {
- push @$where, $array;
- } elsif(ref($where) eq "HASH") {
- if($key) {
- $where->{$key} = $array;
- } else {
- die "ERROR: trying to insert hash value without a key: $_";
- }
- } else {
- die "ERROR: Can't identify var for translation: $_";
- }
-
- $key = "";
-
- # push the parent onto the stack
- push @stack, $where;
-
- # our new "current" location is the newly created array
- $where = $array;
-
- } elsif($string =~ s/^(true|false|nil)(?=[,:\]])//s) { # true/false
- my $value = $1;
-
- my $realvalue;
- $realvalue = 1 if $value eq "true";
- $realvalue = 0 if $value eq "false";
- $realvalue = undef if $value eq "nil";
-
- # shove it into the right place
- if(ref($where) eq "HASH") {
- if($key) {
- $where->{$key} = $realvalue;
- $key = "";
- } else {
- $key = $value;
- }
- } elsif(ref($where) eq "ARRAY") {
- push @$where, $realvalue;
- } else {
- die "ERROR: awoooga! awooooga!: $string";
- }
- } elsif($string =~ s/^"([^"]*)"//s) { # normal string
- my $value = $1;
-
- # shove it into the right place
- if(not $tree) {
- $tree = $value;
- } elsif(ref($where) eq "HASH") {
- if($key) {
- $where->{$key} = $value;
- $key = "";
- } else {
- $key = $value;
- }
- } elsif(ref($where) eq "ARRAY") {
- push @$where, $value;
- } else {
- die "ERROR: dogs don't know it's not bacon: $string";
- }
- } elsif($string =~ s/^(\d+)(?=[,:\]])//s) { # normal integer
- my $value = $1;
-
- # shove it into the right place
- if(ref($where) eq "HASH") {
- if($key) {
- $where->{$key} = $value;
- $key = "";
- } else {
- $key = $value; # ??? - can we use a bare integer as a hash key?
- }
- } elsif(ref($where) eq "ARRAY") {
- push @$where, $value;
- } else {
- die "ERROR: one by one the penguins steal my sanity: $string";
- }
- } elsif($string =~ s/^\]//) {
- # hit the end of this containing block, move back up a level
- $where = pop @stack;
- if($where eq "TOPOFSTACK") {
- die "ERROR: popped off top of stack: $string";
- }
- } else {
- y2error("ERROR: failed to parse: '$original_string'");
- die "ERROR: failed to parse: '$original_string'";
- }
-
- # strip trailing : or , and any whitespace
- $string=~ s/^[,:]\s*//s;
- }
-
- if(pop(@stack) ne "TOPOFSTACK") {
- die "ERROR: stack depth mismatch";
- }
-
- return $tree;
-}
-
-sub ParseCommand {
- my $string = shift;
-
- chomp $string;
- my $original_string = $string;
-
- if($string=~ m/^`?(\S+)\s*\((.+)\)\s*$/) {
- my ($cmd, $params) = ($1, $2);
-
- if($params =~ m/^(\.\S*),\s*(.+)\s*$/) {
- my ($path, $args) = ($1, ycpToPerl($2));
-
- return ($cmd, $path, $args);
- } elsif($params =~ m/^(\.\S*)$/) {
- my $path = $1;
-
- return ($cmd, $path, "");
- } elsif($cmd eq "result" && $params eq "nil") {
- return ($cmd, "", "");
- } elsif($params eq "") {
- return ($cmd, "", "");
- } else {
- die "ERROR: failed to parse params: $params - $original_string\n";
- }
- } else {
- die "ERROR: failed to parse command: $string";
- }
-
-}
-
-
-#my $foo = ycpToPerl('$["one":"1one", "two":"2two", "three":["foo", $["holy":"catfish", "bacon":"cheese"], "baz"]]');
-
-#my ($ycommand, $ypath, $yargument) = ParseCommand('Read(.foobar, $["one":"1one", "two":"2two", "three":["foo", $["holy":"catfish", "bacon":false], "baz"]])');
-
-#print Data::Dumper->Dump([$ycommand, $ypath, $yargument], [qw(*ycommand *ypath *yargument)]);
-#print Data::Dumper->Dump([$foo]);
-
-1;
-
diff --git a/apparmor-utils.spec b/apparmor-utils.spec
index 12637ae..cd2a310 100644
--- a/apparmor-utils.spec
+++ b/apparmor-utils.spec
@@ -1,27 +1,22 @@
-%include /usr/lib/rpm/macros.perl
-%define _vimdatadir %{_datadir}/vim/vimfiles
Summary: AppArmor userlevel utilities that are useful in creating AppArmor profiles
Summary(pl.UTF-8): Narzędzia przestrzeni użytkownika przydatne do tworzenia profili AppArmor
Name: apparmor-utils
-Version: 2.8.3
+Version: 2.9.0
Release: 1
Epoch: 1
License: GPL v2
Group: Base
-Source0: http://launchpad.net/apparmor/2.8/%{version}/+download/apparmor-%{version}.tar.gz
-# Source0-md5: 43586e5096606e857fef45c49553e468
-Source1: Ycp.pm
+Source0: http://launchpad.net/apparmor/2.9/%{version}/+download/apparmor-%{version}.tar.gz
+# Source0-md5: daaeb859452f793abfdafd33f88d3e90
URL: http://apparmor.wiki.kernel.org/
BuildRequires: gettext-devel
BuildRequires: python
-BuildRequires: rpm-perlprov
-Requires: perl-DBD-SQLite >= 1.08
Provides: subdomain-utils
Obsoletes: subdomain-utils
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define _noautoreq 'perl(ycp)'
+%define _vimdatadir %{_datadir}/vim/vimfiles
%description
This provides some useful programs to help create and manage AppArmor
@@ -49,7 +44,7 @@ Obsługa plików AppArmor dla Vima.
%prep
%setup -q -n apparmor-%{version}
-%{__sed} -i -e '1s, */usr/bin/env python,/usr/bin/python,' utils/aa-easyprof
+%{__sed} -i -e '1s, */usr/bin/env python,/usr/bin/python,' utils/aa-*
%install
rm -rf $RPM_BUILD_ROOT
@@ -58,14 +53,8 @@ cd utils
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT \
BINDIR=$RPM_BUILD_ROOT%{_sbindir} \
- PERLDIR=$RPM_BUILD_ROOT%{perl_vendorlib}/Immunix \
VIM_INSTALL_PATH=$RPM_BUILD_ROOT%{_vimdatadir}/syntax
-install %{SOURCE1} $RPM_BUILD_ROOT%{perl_vendorlib}/Immunix
-
-# outdated version of pt
-%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/locale/pt_PT
-
install -d $RPM_BUILD_ROOT%{_vimdatadir}/ftdetect
cat > $RPM_BUILD_ROOT%{_vimdatadir}/ftdetect/apparmor.vim <<-EOF
au BufNewFile,BufRead /etc/apparmor.d/*,/etc/apparmor/profiles/* set filetype=apparmor
@@ -94,8 +83,6 @@ rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{_sbindir}/apparmor_status
%dir %{_datadir}/apparmor
%{_datadir}/apparmor/easyprof
-%dir %{perl_vendorlib}/Immunix
-%{perl_vendorlib}/Immunix/*.pm
%dir %{py_sitescriptdir}/apparmor
%{py_sitescriptdir}/apparmor/*.py[co]
%{py_sitescriptdir}/apparmor-%{version}-py*.egg-info
@@ -107,3 +94,4 @@ rm -rf $RPM_BUILD_ROOT
%defattr(644,root,root,755)
%{_vimdatadir}/ftdetect/apparmor.vim
%{_vimdatadir}/syntax/apparmor.vim
+%{_mandir}/man5/apparmor.vim.5*