Skip to content

Commit

Permalink
2011-02-25 Christos Triantafyllidis,ctria@grid.auth.gr
Browse files Browse the repository at this point in the history
	* Release: 1.0.4
	- Added support for modern distributions (RHEL6, Fedora etc).



git-svn-id: https://quattor.svn.sourceforge.net/svnroot/quattor/trunk/rpmt-py@2568 b8b08b4b-6333-482b-9f54-fdf6c5fb3d79
  • Loading branch information
ctria committed Feb 25, 2011
1 parent 7e54fea commit e49d9ca
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 18 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2011-02-25 Christos Triantafyllidis,ctria@grid.auth.gr

* Release: 1.0.4
- Added support for modern distributions (RHEL6, Fedora etc).

2008-10-17 "Luis Fernando"

* Release: 1.0.3
Expand Down
4 changes: 2 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COMP=rpmt-py

NAME=$(COMP)
DESCR=RPMT - RPM Transactional (Python version)
VERSION=1.0.3
VERSION=1.0.4
RELEASE=1

AUTHOR=Nicolas Pinto <Nicolas.Pinto@cern.ch>
Expand All @@ -17,4 +17,4 @@ RPMT_CACHE=/var/cache/rpmt

MANSECT=8

DATE=17/10/08 15:04
DATE=25/02/11 16:24
6 changes: 3 additions & 3 deletions rpmt-py.cin
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ if __name__=="__main__":
sys.exit("No action file specified (use -i<FILE> or --in=<FILE>)")

try:
as = rpmt_ActionsSet.rpmtActionsSet(str(file))
rpmt_as = rpmt_ActionsSet.rpmtActionsSet(str(file))
except IOError, error:
sys.exit(error)

t = rpmt_Transaction.rpmtTransaction(verbose, interface_flags, rpmts_flags, rpmprob_filter, vsflags, rootdir, cachedir, revproxylist, proxy_info)

# Process each action
action = as.nextAction()
action = rpmt_as.nextAction()
while action:
if action.has_key('error'):
sys.stderr.write("%s\n" % action['error'])
Expand All @@ -168,7 +168,7 @@ if __name__=="__main__":
except rpm.error, err:
sys.exit("rpm.error: with package %s :\n %s" % (action['package'] , err))

action = as.nextAction()
action = rpmt_as.nextAction()

##############################################
# 3. run the transaction set
Expand Down
6 changes: 3 additions & 3 deletions rpmt_ActionsSet.py.cin
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ class rpmtActionsSet:
# Module Test
if __name__=="__main__":
try:
as = rpmtActionsSet('test.rpmta')
rpmt_as = rpmtActionsSet('test.rpmta')
except IOError, error:
sys.exit(error)

# Process each action
action = as.nextAction()
action = rpmt_as.nextAction()
while action:
try:
print action['action'], action['package'], action['options']
except KeyError:
print action['error']

action = as.nextAction()
action = rpmt_as.nextAction()


53 changes: 43 additions & 10 deletions rpmt_Transaction.py.cin
Original file line number Diff line number Diff line change
Expand Up @@ -270,21 +270,40 @@ class rpmtTransaction:

if errors:
sys.stderr.write("Errors found:\n")
for ((name, version, release), (reqname, reqversion), \
flags, suggest, sense) in errors:
# After 4.8.0 RPM version the rpm-python bindings change
if self._rpm_version() > '4.8':
for ((name, version, release), (reqname, reqversion), \
flags, sense, suggest) in errors:

if sense == rpm.RPMDEP_SENSE_REQUIRES:
deperrors += 1
msgs += (" depcheck: package %s %s-%s needs %s\n") % \
if sense == rpm.RPMDEP_SENSE_REQUIRES:
deperrors += 1
msgs += (" depcheck: package %s %s-%s needs %s\n") % \
(name, version, release, self._formatRequire(reqname, reqversion, flags))

elif sense == rpm.RPMDEP_SENSE_CONFLICTS:
conferrors += 1
msgs += (" depcheck: package %s %s-%s conflicts with %s\n") % \
elif sense == rpm.RPMDEP_SENSE_CONFLICTS:
conferrors += 1
msgs += (" depcheck: package %s %s-%s conflicts with %s\n") % \
(name, version, release, reqname)

if self._verbose and suggest:
print suggest
if self._verbose and suggest:
print suggest

else:
for ((name, version, release), (reqname, reqversion), \
flags, suggest, sense) in errors:

if sense == rpm.RPMDEP_SENSE_REQUIRES:
deperrors += 1
msgs += (" depcheck: package %s %s-%s needs %s\n") % \
(name, version, release, self._formatRequire(reqname, reqversion, flags))

elif sense == rpm.RPMDEP_SENSE_CONFLICTS:
conferrors += 1
msgs += (" depcheck: package %s %s-%s conflicts with %s\n") % \
(name, version, release, reqname)

if self._verbose and suggest:
print suggest

msgs += (" there were %d dependency problem(s) and %d conflict(s)\n") % (deperrors, conferrors)

Expand Down Expand Up @@ -392,6 +411,20 @@ class rpmtTransaction:
if self._verbose:
print "Removing cache file %s" % (self._cachedir + file)
os.remove(self._cachedir + file)

def _rpm_version(self):
""" This method returns the version of rpm package.
"""

try:
rpm_ver=rpm.__version__
except AttributeError:
ts = rpm.TransactionSet()
mi = ts.dbMatch( 'name', 'rpm')
for h in mi:
rpm_ver = h['version']
return rpm_ver


# Module Test
if __name__=="__main__":
Expand Down

0 comments on commit e49d9ca

Please sign in to comment.