From 1442e9ecdc2a38e769c8b2766070db485088cb52 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Fri, 2 Jun 2006 20:09:03 +0000 Subject: [PATCH] fixes #2879 --- pisi/api.py | 2 ++ pisi/build.py | 2 ++ pisi/context.py | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/pisi/api.py b/pisi/api.py index 094a8d51..9eb7215f 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -142,6 +142,8 @@ def finalize(): if ctx.dbenv: ctx.dbenv.close() ctx.dbenv_lock.close() + if ctx.build_leftover and os.path.exists(ctx.build_leftover): + os.unlink(ctx.build_leftover) ctx.ui.debug('PISI API finalized') ctx.ui.close() diff --git a/pisi/build.py b/pisi/build.py index 03e549af..51df491d 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -814,6 +814,7 @@ class Builder: pkg.add_to_package(orgname, arcname) pkg.close() else: # default package format is 1.1, so make it fallback. + ctx.build_leftover = join(self.pkg_dir(), "install.tar.lzma") tar = archive.ArchiveTar("install.tar.lzma", "tarlzma") for finfo in files.list: orgname = arcname = join("install", finfo.path) @@ -824,6 +825,7 @@ class Builder: pkg.add_to_package("install.tar.lzma") pkg.close() os.unlink("install.tar.lzma") + ctx.build_leftover = None os.chdir(c) self.set_state("buildpackages") diff --git a/pisi/context.py b/pisi/context.py index d19df3d8..ea30bd59 100644 --- a/pisi/context.py +++ b/pisi/context.py @@ -48,6 +48,12 @@ comar_sockname = None initialized = False +# Bug #2879 +# FIXME: Maybe we can create a simple rollback mechanism. There are other +# places which need this, too. +# this is needed in build process to clean after if something goes wrong. +build_leftover = None + #def register(_impl): # """ Register a UI implementation""" # ui = _impl