Merge lp:~aptdaemon-developers/aptdaemon/update-cache-partially into lp:aptdaemon/0.3

Proposed by Sebastian Heinlein
Status: Merged
Merged at revision: 484
Proposed branch: lp:~aptdaemon-developers/aptdaemon/update-cache-partially
Merge into: lp:aptdaemon/0.3
Diff against target: 122 lines (+48/-9)
4 files modified
aptdaemon/client.py (+11/-3)
aptdaemon/core.py (+25/-3)
aptdaemon/worker.py (+3/-3)
doc/org.debian.apt.7 (+9/-0)
To merge this branch: bzr merge lp:~aptdaemon-developers/aptdaemon/update-cache-partially
Reviewer Review Type Date Requested Status
Aptdaemon Developers Pending
Review via email: mp+34949@code.launchpad.net

Description of the change

Support updating only repositories specified in a separate sources.list snippet

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'aptdaemon/client.py'
2--- aptdaemon/client.py 2010-09-04 06:56:08 +0000
3+++ aptdaemon/client.py 2010-09-09 06:27:42 +0000
4@@ -907,11 +907,15 @@
5
6 @defer.deferable
7 @convert_dbus_exception
8- def update_cache(self, wait=False, reply_handler=None, error_handler=None):
9+ def update_cache(self, sources_list=None, wait=False,
10+ reply_handler=None, error_handler=None):
11 """Return a transaction which queries the software sources
12 (package repositories) for available packages.
13
14 Keyword arguments:
15+ sources_list - Path to a sources.list which contains repositories
16+ that should be updated only. The other repositories will
17+ be ignored in this case.
18 wait - if True run the transaction immediately and return its exit
19 state instead of the transaction itself.
20 reply_handler - callback function. If specified in combination with
21@@ -919,8 +923,12 @@
22 error_handler - in case of an error the given callback gets the
23 corresponding DBus exception instance
24 """
25- return self._run_transaction("UpdateCache", [], wait, reply_handler,
26- error_handler)
27+ if sources_list:
28+ return self._run_transaction("UpdateCachePartially", [sources_list],
29+ wait, reply_handler, error_handler)
30+ else:
31+ return self._run_transaction("UpdateCache", [], wait, reply_handler,
32+ error_handler)
33
34 @defer.deferable
35 @convert_dbus_exception
36
37=== modified file 'aptdaemon/core.py'
38--- aptdaemon/core.py 2010-09-09 05:54:04 +0000
39+++ aptdaemon/core.py 2010-09-09 06:27:42 +0000
40@@ -1126,9 +1126,31 @@
41 sender -- the unique D-Bus name of the sender (provided by D-Bus)
42 """
43 log.info("UpdateCache() was called")
44- return self._create_trans(enums.ROLE_UPDATE_CACHE,
45- policykit1.PK_ACTION_UPDATE_CACHE,
46- sender)
47+ kwargs = {"sources_list": None}
48+ return self._create_trans(enums.ROLE_UPDATE_CACHE,
49+ policykit1.PK_ACTION_UPDATE_CACHE, sender,
50+ kwargs=kwargs)
51+
52+ @dbus_deferred_method(APTDAEMON_DBUS_INTERFACE,
53+ in_signature="s", out_signature="s",
54+ sender_keyword="sender")
55+ def UpdateCachePartially(self, sources_list, sender):
56+ """Return the id of a newly create transaction which will update
57+ cache from the repositories defined in the given sources.list.
58+
59+ Downloads the latest information about available packages from the
60+ repositories.
61+
62+ Keyword argument:
63+ sources_list -- path to a sources.list, e.g.
64+ /etc/apt/sources.list.d/ppa-aptdaemon.list
65+ sender -- the unique D-Bus name of the sender (provided by D-Bus)
66+ """
67+ log.info("UpdateCachePartially() was called")
68+ kwargs = {"sources_list": sources_list}
69+ return self._create_trans(enums.ROLE_UPDATE_CACHE,
70+ policykit1.PK_ACTION_UPDATE_CACHE, sender,
71+ kwargs=kwargs)
72
73 @dbus_deferred_method(APTDAEMON_DBUS_INTERFACE,
74 in_signature="as", out_signature="s",
75
76=== modified file 'aptdaemon/worker.py'
77--- aptdaemon/worker.py 2010-09-04 06:56:08 +0000
78+++ aptdaemon/worker.py 2010-09-09 06:27:42 +0000
79@@ -159,7 +159,7 @@
80 if self.trans.role == ROLE_FIX_BROKEN_DEPENDS:
81 self.fix_broken_depends()
82 elif self.trans.role == ROLE_UPDATE_CACHE:
83- self.update_cache()
84+ self.update_cache(**self.trans.kwargs)
85 # Process the transactions which require a consistent cache
86 elif self._cache and self._cache.broken_count:
87 broken = [pkg.name for pkg in self._cache if pkg.is_now_broken]
88@@ -563,12 +563,12 @@
89 resolver.clear(pkg)
90 resolver.protect(pkg)
91
92- def update_cache(self):
93+ def update_cache(self, sources_list):
94 """Update the cache."""
95 log.info("Updating cache")
96 progress = DaemonAcquireProgress(self.trans, begin=10, end=95)
97 try:
98- self._cache.update(progress)
99+ self._cache.update(progress, sources_list=sources_list)
100 except apt.cache.FetchFailedException, error:
101 raise TransactionFailed(ERROR_REPO_DOWNLOAD_FAILED,
102 str(error.message))
103
104=== modified file 'doc/org.debian.apt.7'
105--- doc/org.debian.apt.7 2010-07-14 07:16:44 +0000
106+++ doc/org.debian.apt.7 2010-09-09 06:27:42 +0000
107@@ -70,6 +70,15 @@
108 Return the id of a newly created transaction which will fetch the latest meta data from the repositories an rebuild the cache of available and installed packages.
109 .RE
110 .TP
111+.B UpdateCachePartially
112+.BI "UpdateCachePartially\t(in 's' " sources_list ,
113+.br
114+.BI "\t\tout 's' " tid )
115+.RS
116+.PP
117+Return the id of a newly created transaction which will fetch the latest meta data from the repositories specified in the given sources.list snippet only and rebuild the cache of available and installed packages.
118+.RE
119+.TP
120 .B InstallPackages
121 .BI "InstallPackages\t(in 'as' " package_names ,
122 .br

Subscribers

People subscribed via source and target branches

to all changes: