ow to update a minimal local repo

"Muayyad AlSadi" <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
the attached file is my trial,

I need to know how to populate the Sack after enableing/disabling some repos
and where should repos.close() be put

_______________________________________________
Yum mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum
update-local-repo.py (application/octet-stream, 869 B)
#!/usr/bin/python
# update a minimal local repo by [email protected]

import yum
from yum.misc import unique

my = yum.YumBase()

repos_id=map(lambda a: a.id,my.repos.listEnabled()) # save default repos

my.repos.disableRepo('*')
my.repos.enableRepo('local*')
my.repos.getPackageSack()
pkgs=list(my.pkgSack) # the list to be checked for updates
pkgs=unique(pkgs)

# return to default repos
my.repos.disableRepo('*')
for i in repos_id: my.repos.enableRepo(i);

my.repos.disableRepo('local*')

# print the updates
npkgs=[]
my.repos.getPackageSack()
for pkg in pkgs:
  npkg=my.pkgSack.returnNewestByName(pkg.name)[0]
  if npkg>pkg: npkgs.append(npkg); print npkg.version,pkg.version,npkg.remote_url

###############
#my.repos.close() # suggested by skvidal not sure where to put this
#my.doSackFilelistPopulate()
#my.repos.doSetup() # maybe need after adding previous line
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.