From ce7f717bcaf0375bf6ee181ee311621e37bcf155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 3 Oct 2005 13:55:05 +0000 Subject: [PATCH] * forgot to add --- pisi/comariface.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 pisi/comariface.py diff --git a/pisi/comariface.py b/pisi/comariface.py new file mode 100644 index 00000000..43d71012 --- /dev/null +++ b/pisi/comariface.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2005, TUBITAK/UEKAE +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# Please read the COPYING file. +# +# Authors: Baris Metin +# Gurer Ozen + +import comar + +import gettext +__trans = gettext.translation('pisi', fallback=True) +_ = __trans.ugettext + +import pisi.context as ctx + +def run_postinstall(package_name): + "run postinstall scripts trough COMAR" + + com = ctx.comard + assert(com) + ctx.ui.info(_("Running postinstall script for %s") % package_name) + com.call_package("System.Package.postInstall", package_name) + while 1: + reply = com.read_cmd() + if reply[0] == com.RESULT: + break + elif reply[0] == com.NONE: # package has no postInstall script + break + elif reply[0] == com.FAIL: + e = _("COMAR.call_package(System.Pakcage.postInstall, %s) failed!: %s") % ( + self.metadata.package.name, reply[2]) + raise InstallError, e + else: + raise InstallError, _("COMAR.call_package ERROR: %d") % reply[0] + +def run_preremove(package_name): + com = ctx.comard + assert(com) + com.remove(package_name) + while 1: + reply = com.read_cmd() + if reply[0] == com.RESULT: + break + elif reply[1] == com.ERROR: + raise Error, "COMAR.remove failed!"