Exemplo n.º 1
0
    def testSystemModelRollbackRace(self):
        util.mkdirChain(self.cfg.root + "/etc/conary")
        sm = self.cfg.root + "/etc/conary/system-model"
        open(sm, "w")

        self.addComponent("foo:runtime=1", fileContents=[("/foo", "1")])
        self.addCollection("foo=1", [":runtime"])
        # does not conflict
        self.addComponent("aaa:runtime=1", fileContents=[("/aaa", "1")])
        self.addCollection("aaa=1", [":runtime"])
        # intentional file conflict with foo:runtime
        self.addComponent("bar:runtime=1", fileContents=[("/foo", "conflict!!!")])
        self.addCollection("bar=1", [":runtime"])

        model = cml.CML(self.cfg)
        modelFile = systemmodel.SystemModelFile(model)

        updatecmd.doModelUpdate(
            self.cfg, model, modelFile, ["+foo:runtime=localhost@rpl:linux/1"], updateByDefault=False
        )
        self.assertRaises(
            update.UpdateError,
            updatecmd.doModelUpdate,
            self.cfg,
            model,
            modelFile,
            ["+bar:runtime=localhost@rpl:linux/1"],
            updateByDefault=False,
        )
        self.verifyNoFile(sm + ".next")

        # force aaa (no conflict) and bar (conflict) into separate jobs
        self.cfg.updateThreshold = 1
        self.assertRaises(
            update.UpdateError,
            updatecmd.doModelUpdate,
            self.cfg,
            model,
            modelFile,
            ["+aaa:runtime=localhost@rpl:linux/1", "+bar:runtime=localhost@rpl:linux/1"],
            updateByDefault=False,
        )
        self.verifyFile(
            sm + ".next",
            "install foo:runtime=localhost@rpl:linux/1\n"
            "install bar:runtime=localhost@rpl:linux/1\n"
            "install aaa:runtime=localhost@rpl:linux/1"
            " bar:runtime=localhost@rpl:linux/1\n",
        )
Exemplo n.º 2
0
    def testSystemModelRollbackRace(self):
        util.mkdirChain(self.cfg.root + '/etc/conary')
        sm = self.cfg.root + '/etc/conary/system-model'
        open(sm, 'w')

        self.addComponent('foo:runtime=1',
                          fileContents = [ ( '/foo', '1') ])
        self.addCollection('foo=1', [ ':runtime' ])
        # does not conflict
        self.addComponent('aaa:runtime=1',
                          fileContents = [ ( '/aaa', '1') ])
        self.addCollection('aaa=1', [ ':runtime' ])
        # intentional file conflict with foo:runtime
        self.addComponent('bar:runtime=1',
                          fileContents = [ ( '/foo', 'conflict!!!') ])
        self.addCollection('bar=1', [ ':runtime' ])


        model = cml.CML(self.cfg)
        modelFile = systemmodel.SystemModelFile(model)

        updatecmd.doModelUpdate(self.cfg, model, modelFile,
            [ '+foo:runtime=localhost@rpl:linux/1' ], updateByDefault = False)
        self.assertRaises(update.UpdateError,
            updatecmd.doModelUpdate, self.cfg, model, modelFile,
            [ '+bar:runtime=localhost@rpl:linux/1' ], updateByDefault = False)
        self.verifyNoFile(sm+'.next')

        # force aaa (no conflict) and bar (conflict) into separate jobs
        self.cfg.updateThreshold = 1
        self.assertRaises(update.UpdateError,
            updatecmd.doModelUpdate, self.cfg, model, modelFile,
            [ '+aaa:runtime=localhost@rpl:linux/1',
              '+bar:runtime=localhost@rpl:linux/1' ], updateByDefault = False)
        self.verifyFile(sm+'.next',
            'install foo:runtime=localhost@rpl:linux/1\n'
            'install bar:runtime=localhost@rpl:linux/1\n'
            'install aaa:runtime=localhost@rpl:linux/1'
            ' bar:runtime=localhost@rpl:linux/1\n')
Exemplo n.º 3
0
    def test08_OverlapConflict(self):
        osA1 = self.addRPMComponent("overlap-same-A:rpm=1.0",
                                    'overlap-same-A-1.0-1.i386.rpm')
        self.addCollection('overlap-same-A', '1.0', [ ':rpm' ])
        osB1 = self.addRPMComponent("overlap-conflict:rpm",
                                    'overlap-conflict-1.0-1.i386.rpm')
        self.addCollection('overlap-conflict', '1.0', [ ':rpm' ])
        self.updatePkg('overlap-same-A:rpm=1.0')
        self.assertRaises(update.UpdateError,
            self.updatePkg, 'overlap-conflict:rpm=1.0', raiseError=True)

        self.updatePkg('overlap-conflict:rpm=1.0', replaceFiles = True)
        self.checkOwners('/file', [ osB1 ])
        self.rollback(1)
        self.checkOwners('/file', [ osA1 ])

        # now test that allowing overlaps via groups pathConflicts is OK
        # in system model
        self.addCollection('group-dist', '1.0', [
            ('overlap-same-A:rpm', '1.0'),
            ('overlap-conflict:rpm', '1.0')],
            pathConflicts=['/file'])

        root = self.cfg.root
        util.mkdirChain(root+'/etc/conary')
        file(root+'/etc/conary/system-model', 'w').write(
            'install group-dist=localhost@rpl:linux/1.0\n')
        model = cml.CML(self.cfg)
        modelFile = systemmodel.SystemModelFile(model)
        updatecmd.doModelUpdate(self.cfg, model, modelFile, [],
            keepExisting=True)



        self.resetRoot()
        self.updatePkg(['overlap-same-A:rpm',
                        'overlap-conflict:rpm=1.0'], replaceFiles = True)
        self.rollback(0)