[Piuparts-commits] [piuparts] 01/12: lib/db: Package: add accessors name(), version(), test_versions()
Holger Levsen
holger at layer-acht.org
Wed Oct 11 14:58:44 UTC 2017
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit eb3d78b86a3eb5f0f47916c5e5944bde1f68aed2
Author: Andreas Beckmann <anbe at debian.org>
Date: Sun Sep 17 01:23:17 2017 +0200
lib/db: Package: add accessors name(), version(), test_versions()
Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
debian/changelog | 2 ++
piupartslib/packagesdb.py | 21 +++++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 00182ea..ab3b1e8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ piuparts (0.83) UNRELEASED; urgency=medium
[ Andreas Beckmann ]
* piuparts.conf.anbe: Add some more example sections.
+ * piupartslib/packagesdb.py:
+ - Add new package data accessors name(), version(), test_versions().
-- Holger Levsen <holger at debian.org> Sat, 07 Oct 2017 17:42:12 +0200
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index a0c3d20..eeadb97 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2005 Lars Wirzenius (liw at iki.fi)
-# Copyright © 2011-2015 Andreas Beckmann (anbe at debian.org)
+# Copyright © 2011-2017 Andreas Beckmann (anbe at debian.org)
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -69,6 +69,17 @@ class Package(UserDict.UserDict):
self.waiting_cnt = None
self.rdep_chain_len = None
+ def name(self):
+ return self["Package"]
+
+ def version(self):
+ return self["Version"]
+
+ def test_versions(self):
+ """ToDo: for distupgrade tests test_versions() should return a list
+ of versions in all distros in the upgrade path"""
+ return self.version()
+
def _parse_dependencies(self, header_name):
if header_name in self._parsed_deps:
depends = self._parsed_deps[header_name]
@@ -657,7 +668,13 @@ class PackagesDB:
def get_version(self, name):
self._find_all_packages()
if name in self._packages:
- return self._packages[name]["Version"]
+ return self._packages[name].version()
+ return None
+
+ def get_test_versions(self, name):
+ self._find_all_packages()
+ if name in self._packages:
+ return self._packages[name].test_versions()
return None
def get_source(self, name):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git
More information about the Piuparts-commits
mailing list