From 01120c6661c2f01131dcc3f9b271e5156ca759a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Tue, 28 Jun 2005 16:02:04 +0000 Subject: [PATCH] =?UTF-8?q?Samples=20i=C3=A7ine=20logrotate=20eklendi,=20p?= =?UTF-8?q?isitools=20geni=C5=9Fliyor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/actionsapi/pisitools.py | 39 ++++++++++++++- samples/logrotate/actions.py | 16 ++++++ samples/logrotate/files/logrotate.conf | 34 +++++++++++++ samples/logrotate/files/logrotate.cron | 3 ++ samples/logrotate/logrotate.pspec | 69 ++++++++++++++++++++++++++ tools/Makefile | 2 +- 6 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 samples/logrotate/actions.py create mode 100644 samples/logrotate/files/logrotate.conf create mode 100755 samples/logrotate/files/logrotate.cron create mode 100644 samples/logrotate/logrotate.pspec diff --git a/pisi/actionsapi/pisitools.py b/pisi/actionsapi/pisitools.py index f8b6fe8d..730aad34 100644 --- a/pisi/actionsapi/pisitools.py +++ b/pisi/actionsapi/pisitools.py @@ -2,8 +2,10 @@ # -*- coding: utf-8 -*- import os, shutil +import gzip def dodoc(*documentList): + install_dir = os.getenv('INSTALL_DIR') src_name = os.getenv('SRC_NAME') src_version = os.getenv('SRC_VERSION') @@ -20,4 +22,39 @@ def dodoc(*documentList): if os.access(document, os.F_OK): shutil.copyfile(document, os.path.join(install_dir, \ 'usr/share/doc/' + srcTag + '/' + os.path.basename(document))) - + +def dosed(filename, *sedPattern): + #FIXME: Convert to python + for pattern in sedPattern: + os.system('sed -i -e \'' + pattern + '\' ' + filename) + +def dosbin(filename, destination='/usr/sbin'): + install_dir = os.getenv('INSTALL_DIR') + + try: + os.makedirs(install_dir + destination) + except OSError: + pass + + if os.access(filename, os.F_OK): + shutil.copyfile(filename, install_dir + destination + '/' \ + + os.path.basename(filename)) + +def doman(filename): + install_dir = os.getenv('INSTALL_DIR') + + man, postfix = filename.split('.') + + try: + os.makedirs(install_dir + '/usr/share/man/man' + postfix) + except OSError: + pass + + gzfile = gzip.GzipFile(filename + '.gz', 'w', 9) + gzfile.writelines(file(filename).xreadlines()) + gzfile.close() + + if os.access(filename, os.F_OK): + shutil.copyfile(filename + '.gz', install_dir + '/usr/share/man/man' \ + + postfix + '/' + os.path.basename(filename)) + diff --git a/samples/logrotate/actions.py b/samples/logrotate/actions.py new file mode 100644 index 00000000..03d2ece1 --- /dev/null +++ b/samples/logrotate/actions.py @@ -0,0 +1,16 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +from pisi.actionsapi import autotools +from pisi.actionsapi import pisitools +import os + +def setup(): + pisitools.dosed('Makefile', 's:CFLAGS += -g:CFLAGS += -g -mcpu=i686 -O2 -pipe -fomit-frame-pointer:', '/CVSROOT =/d') + +def build(): + autotools.make() + +def install(): + pisitools.dosbin('logrotate') + pisitools.doman('logrotate.8') diff --git a/samples/logrotate/files/logrotate.conf b/samples/logrotate/files/logrotate.conf new file mode 100644 index 00000000..f8fb039f --- /dev/null +++ b/samples/logrotate/files/logrotate.conf @@ -0,0 +1,34 @@ +# $Header: /var/cvsroot/gentoo-x86/app-admin/logrotate/files/logrotate.conf,v 1.2 2004/07/18 01:58:24 dragonheart Exp $ +# +# Logrotate default configuration file for Gentoo Linux +# +# See "man logrotate" for details + +# rotate log files weekly +weekly +#daily + +# keep 4 weeks worth of backlogs +rotate 4 + +# create new (empty) log files after rotating old ones +create + +# uncomment this if you want your log files compressed +compress + +# packages can drop log rotation information into this directory +include /etc/logrotate.d + +notifempty +nomail +noolddir + +# no packages own lastlog or wtmp -- we'll rotate them here +/var/log/wtmp { + monthly + create 0664 root utmp + rotate 1 +} + +# system-specific logs may be also be configured here. diff --git a/samples/logrotate/files/logrotate.cron b/samples/logrotate/files/logrotate.cron new file mode 100755 index 00000000..63cbe968 --- /dev/null +++ b/samples/logrotate/files/logrotate.cron @@ -0,0 +1,3 @@ +#! /bin/sh + +/usr/sbin/logrotate /etc/logrotate.conf diff --git a/samples/logrotate/logrotate.pspec b/samples/logrotate/logrotate.pspec new file mode 100644 index 00000000..41904dc0 --- /dev/null +++ b/samples/logrotate/logrotate.pspec @@ -0,0 +1,69 @@ + + + + + + + logrotate + http://packages.debian.org/unstable/admin/logrotate.html + + PACKAGER + PACKAGER_EMAIL + + GPL-2 + ISA + PARTOF + Rotates, compresses, and mails system logs + ftp://ftp.linux.org.tr/pub/mirrors/gentoo/distfiles/logrotate_3.6.5.orig.tar.gz + + + >=sys-apps/portage-2.0.47-r10 + >=dev-libs/popt-1.5 + >=sys-apps/sed-4 + selinux? + sys-libs/libselinux + !bootstrap? + sys-devel/patch + userland_GNU? + sys-apps/shadow + + + + + 2005-06-28 + 3.6.5 + 1 + + + + + + logrotate + Rotates, compresses, and mails system logs + + + >=sys-apps/portage-2.0.47-r10 + >=dev-libs/popt-1.5 + >=sys-apps/sed-4 + selinux? + sys-libs/libselinux + selinux? + sec-policy/selinux-logrotate + + + Rotates, compresses, and mails system logs + + /usr/sbin + /usr/share/doc + /usr/share/man + + + + 2005-06-28 + 3.6.5 + 1 + + + + + diff --git a/tools/Makefile b/tools/Makefile index ed4d760d..94767139 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,5 +1,5 @@ all: python main.py - PORTDIR=PORTDIR_OVERLAY_KLASÖRÜ sudo python portage2pisi.py + PORTDIR=~caglar/svn/paketler/trunk/ sudo python portage2pisi.py clean: sudo rm -rf packages