Example #1
0
    def remove(self, trv):
        SingleCapsuleOperation.remove(self, trv)

        # make sure everything was erased which should have been; RPM's
        # shared file handling means it may not erase things which we think
        # ought to be
        for trv in self.removes:
            dbFileObjs = self.db.getFileVersions(
                        [ (x[0], x[2], x[3]) for x in trv.iterFileList() ] )

            for (pathId, path, fileId, version), fileObj in \
                    itertools.izip(trv.iterFileList(), dbFileObjs):
                hasCapsule = trv.troveInfo.capsule.type() or False
                fullPath = util.joinPaths(self.root,  path)
                if not os.path.exists(fullPath):
                    continue

                if (fileObj.flags.isCapsuleAddition()):
                    # this was added to the package outside of the RPM;
                    # we don't have any responsibility for it
                    continue
                elif (fileObj.hasContents and
                      trove.conaryContents(hasCapsule, pathId, fileObj)):
                    # this content isn't part of the capsule; remember to put
                    # it back when RPM is done
                    self.preservePath(path)
                    continue

                fsFileObj = files.FileFromFilesystem(fullPath, pathId,
                                                     possibleMatch = fileObj)
                self.fsJob._remove(fsFileObj, path, fullPath,
                                   'removing rpm owned file %s',
                                   ignoreMissing = True)
Example #2
0
    def remove(self, trv):
        SingleCapsuleOperation.remove(self, trv)

        # make sure everything was erased which should have been; RPM's
        # shared file handling means it may not erase things which we think
        # ought to be
        for trv in self.removes:
            dbFileObjs = self.db.getFileVersions([(x[0], x[2], x[3])
                                                  for x in trv.iterFileList()])

            for (pathId, path, fileId, version), fileObj in \
                    itertools.izip(trv.iterFileList(), dbFileObjs):
                hasCapsule = trv.troveInfo.capsule.type() or False
                fullPath = util.joinPaths(self.root, path)
                if not os.path.exists(fullPath):
                    continue

                if (fileObj.flags.isCapsuleAddition()):
                    # this was added to the package outside of the RPM;
                    # we don't have any responsibility for it
                    continue
                elif (fileObj.hasContents
                      and trove.conaryContents(hasCapsule, pathId, fileObj)):
                    # this content isn't part of the capsule; remember to put
                    # it back when RPM is done
                    self.preservePath(path, unlink=True)
                    continue

                fsFileObj = files.FileFromFilesystem(fullPath,
                                                     pathId,
                                                     possibleMatch=fileObj)
                self.fsJob._remove(fsFileObj,
                                   path,
                                   fullPath,
                                   'removing rpm owned file %s',
                                   ignoreMissing=True)