AndresVargas

Hi!, my nickName is zodman, im a Computer science Engineering. love the FLOSS and FreeSoftware. Python ninja and php coder. On left my love Aisha and me.

Interest links
seen more



Powered by Django.

Update a app with conary-lib

Yeah im add a method for a simple: conary update app<=repo@tag:label>

Reading the documentation and seen some code im understand some things....

  • For conary update a package ( called installing a package) need to create a Job
  • With this job its a empty for begining. You must attach some task like (Update)
  • If job created the update must Apply for install it.
  • for update a package needs be a ChangeSpec Format:
    (troveName, (oldVersionSpec, oldFlavor), (newVersionSpec, newFlavor)
  • conary.conary.ConaryClient its the base of conary Structure on Conary API.

From command line:

[zodman@cosmogirl conary-lib]$ conary q iftop
iftop was not found
[zodman@cosmogirl conary-lib]$ sudo python conarypk.py
Update Success of iftop=/zodyrepo.rpath.org@rpl:devel/0.17-3-1
[zodman@cosmogirl conary-lib]$ conary q iftop --labels
iftop=zodyrepo.rpath.org@rpl:devel/0.17-3-1

the new method:

def update(self, name, installLabel= None):
        cli = self.cli
        #get a trove
        troves = self.request_query(name, installLabel)
        for trove in troves:
            trovespec =  self.trove_to_spec( trove )
        try:
            # create a Job
            job = cli.newUpdateJob()
            # Add Update task to Job
            cli.prepareUpdateJob(job, cmdline.parseChangeList(trovespec))
            # Apply the Job
            cli.applyUpdateJob(job)
            # im rulz
            return "Update Success of %s" %  trovespec
        except NoNewTrovesError:
            return "no new Troves Found by %s " % trovespec

    def trove_to_spec(self, trove ):
        return cmdline.toTroveSpec( trove[0], str(trove[1]), None)

Using conary-lib:

    conary = ConaryPk()
    print conary.update("iftop","zodyrepo.rpath.org@rpl:devel")

Code Python Conary
BACK