Merge lp:~mac9416/keryx/1.0 into lp:~keryx-admins/keryx/1.0

Proposed by mac9416
Status: Merged
Merge reported by: Chris Oliver
Merged at revision: not available
Proposed branch: lp:~mac9416/keryx/1.0
Merge into: lp:~keryx-admins/keryx/1.0
Diff against target: 125 lines (+35/-2)
6 files modified
doc/TODO (+1/-0)
src/cli.py (+6/-0)
src/libkeryx/definition.py (+8/-0)
src/libkeryx/definitions/apt_def/__init__.py (+18/-0)
src/libkeryx/definitions/apt_def/minideblib/AptRepoClient.py (+1/-1)
src/libkeryx/factory.py (+1/-1)
To merge this branch: bzr merge lp:~mac9416/keryx/1.0
Reviewer Review Type Date Requested Status
Chris Oliver Approve
Review via email: mp+17075@code.launchpad.net
To post a comment you must log in.
Revision history for this message
mac9416 (mac9416) wrote :

AptRepoClient.update_local now defaults to loading from /var/lib/apt/lists.
Implemented listsources command.
Download now fails if package is already installed and up-to-date.

Revision history for this message
Chris Oliver (excid3) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/TODO'
2--- doc/TODO 2009-12-26 04:18:56 +0000
3+++ doc/TODO 2010-01-09 15:35:24 +0000
4@@ -34,6 +34,7 @@
5 keryx-cli
6 =========
7 - Use proper python documentation of functions and classes so that documenation can be dynamically created
8+- Sources editor
9 - Command-line only
10 - takes parameters as well as interactive prompts
11 - ncurses for graphical CLI usage? (future version)
12
13=== modified file 'src/cli.py'
14--- src/cli.py 2010-01-08 03:31:53 +0000
15+++ src/cli.py 2010-01-09 15:35:24 +0000
16@@ -211,6 +211,9 @@
17 'install': [self.install, -1,
18 "Usage: install, or install <packages>",
19 "Installs packages to the offline machine"],
20+ 'listsources': [self.listsources, 0,
21+ "Usage: listsources",
22+ "Lists software sources in use"],
23 }
24 self.register(functions)
25
26@@ -230,3 +233,6 @@
27 def install(self, *packages):
28 self.project.Install(packages)
29
30+ def listsources(self):
31+ self.project.ListSources()
32+
33
34=== modified file 'src/libkeryx/definition.py'
35--- src/libkeryx/definition.py 2010-01-08 04:16:07 +0000
36+++ src/libkeryx/definition.py 2010-01-09 15:35:24 +0000
37@@ -127,6 +127,12 @@
38 raise AttributeError, "Project does not exist"
39 self.OnPkgNames()
40
41+ def ListSources(self):
42+ if not self.Exists():
43+ raise AttributeError, "Project does not exist"
44+ self.OnListSources()
45+
46+
47 ###############################################################################
48 # Overridable functions
49
50@@ -150,4 +156,6 @@
51 logging.error("OnSearch not implemented yet")
52 def OnPkgNames(self):
53 logging.error("OnPkgNames not implemented yet")
54+ def OnListSources(self):
55+ logging.error("OnPkgNames not implemented yet")
56
57
58=== modified file 'src/libkeryx/definitions/apt_def/__init__.py'
59--- src/libkeryx/definitions/apt_def/__init__.py 2010-01-08 04:16:07 +0000
60+++ src/libkeryx/definitions/apt_def/__init__.py 2010-01-09 15:35:24 +0000
61@@ -230,6 +230,22 @@
62 print "Finished installing.\n" \
63 "Orange you glad you used %s?" % (keryx.__appname__.capitalize())
64
65+
66+ def OnListSources(self):
67+ """Prints a numbered list of software source lines"""
68+ # Get project's repo relationships
69+ rels = self.session.query(Relation). \
70+ filter(Relation.project_id==self.project_ref.id). \
71+ filter(Relation.type=="repo").all()
72+
73+ # Get items out of each repo
74+ repos = [" ".join(self.session.query(Repo). \
75+ filter(Repo.id==i.target_id).one().items()) for i in rels]
76+
77+ # Make a numbered list of repo lines
78+ repos = ["%i\t%s" % (x, y) for x, y in zip(xrange(len(repos)), repos)]
79+ print "\n".join(repos)
80+
81 ###############################################################################
82
83 def __add_repositories(self, folder="/etc/apt/"):
84@@ -336,6 +352,7 @@
85 if not ver:
86 url, ver = self.apt_client.get_best_binary_version(package)
87
88+ # Get package info (depends, description, etc.)
89 pkg = self.apt_client.get_binary_name_version(package, ver)
90 if pkg:
91 pkg = pkg[0]
92@@ -355,6 +372,7 @@
93
94 # Iterate through each package
95 for dep in dependencies:
96+ # Get "or" packages
97 dep = dep.split('|')
98
99 # Build (name, version) tuples for each in this section
100
101=== modified file 'src/libkeryx/definitions/apt_def/minideblib/AptRepoClient.py'
102--- src/libkeryx/definitions/apt_def/minideblib/AptRepoClient.py 2010-01-04 22:19:41 +0000
103+++ src/libkeryx/definitions/apt_def/minideblib/AptRepoClient.py 2010-01-09 15:35:24 +0000
104@@ -328,7 +328,7 @@
105 # Alias for load_repos(). Just to make commandline apt-get users happy
106 update = load_repos
107
108- def load_local(self, folder, repoline = None, ignore_errors = True, clear = True):
109+ def load_local(self, folder="/var/lib/apt/lists", repoline = None, ignore_errors = True, clear = True):
110 """Loads repositories into internal data structures from a local cache. Replaces previous content if clear = True (default)"""
111 self.load_repos(repoline, ignore_errors, clear, folder)
112
113
114=== modified file 'src/libkeryx/factory.py'
115--- src/libkeryx/factory.py 2010-01-06 14:34:53 +0000
116+++ src/libkeryx/factory.py 2010-01-09 15:35:24 +0000
117@@ -51,7 +51,7 @@
118 try:
119 return getattr(definitions[0], definitions[0].__name__)(name, db_file)
120 except Exception, e:
121- print e
122+ logging.error(e)
123
124
125 # Entry point

Subscribers

People subscribed via source and target branches

to all changes: