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
=== modified file 'aptdaemon/client.py'
--- aptdaemon/client.py 2010-09-04 06:56:08 +0000
+++ aptdaemon/client.py 2010-09-09 06:27:42 +0000
@@ -907,11 +907,15 @@
907907
908 @defer.deferable908 @defer.deferable
909 @convert_dbus_exception909 @convert_dbus_exception
910 def update_cache(self, wait=False, reply_handler=None, error_handler=None):910 def update_cache(self, sources_list=None, wait=False,
911 reply_handler=None, error_handler=None):
911 """Return a transaction which queries the software sources912 """Return a transaction which queries the software sources
912 (package repositories) for available packages.913 (package repositories) for available packages.
913914
914 Keyword arguments:915 Keyword arguments:
916 sources_list - Path to a sources.list which contains repositories
917 that should be updated only. The other repositories will
918 be ignored in this case.
915 wait - if True run the transaction immediately and return its exit919 wait - if True run the transaction immediately and return its exit
916 state instead of the transaction itself.920 state instead of the transaction itself.
917 reply_handler - callback function. If specified in combination with921 reply_handler - callback function. If specified in combination with
@@ -919,8 +923,12 @@
919 error_handler - in case of an error the given callback gets the923 error_handler - in case of an error the given callback gets the
920 corresponding DBus exception instance924 corresponding DBus exception instance
921 """925 """
922 return self._run_transaction("UpdateCache", [], wait, reply_handler,926 if sources_list:
923 error_handler)927 return self._run_transaction("UpdateCachePartially", [sources_list],
928 wait, reply_handler, error_handler)
929 else:
930 return self._run_transaction("UpdateCache", [], wait, reply_handler,
931 error_handler)
924932
925 @defer.deferable933 @defer.deferable
926 @convert_dbus_exception934 @convert_dbus_exception
927935
=== modified file 'aptdaemon/core.py'
--- aptdaemon/core.py 2010-09-09 05:54:04 +0000
+++ aptdaemon/core.py 2010-09-09 06:27:42 +0000
@@ -1126,9 +1126,31 @@
1126 sender -- the unique D-Bus name of the sender (provided by D-Bus)1126 sender -- the unique D-Bus name of the sender (provided by D-Bus)
1127 """1127 """
1128 log.info("UpdateCache() was called")1128 log.info("UpdateCache() was called")
1129 return self._create_trans(enums.ROLE_UPDATE_CACHE,1129 kwargs = {"sources_list": None}
1130 policykit1.PK_ACTION_UPDATE_CACHE,1130 return self._create_trans(enums.ROLE_UPDATE_CACHE,
1131 sender)1131 policykit1.PK_ACTION_UPDATE_CACHE, sender,
1132 kwargs=kwargs)
1133
1134 @dbus_deferred_method(APTDAEMON_DBUS_INTERFACE,
1135 in_signature="s", out_signature="s",
1136 sender_keyword="sender")
1137 def UpdateCachePartially(self, sources_list, sender):
1138 """Return the id of a newly create transaction which will update
1139 cache from the repositories defined in the given sources.list.
1140
1141 Downloads the latest information about available packages from the
1142 repositories.
1143
1144 Keyword argument:
1145 sources_list -- path to a sources.list, e.g.
1146 /etc/apt/sources.list.d/ppa-aptdaemon.list
1147 sender -- the unique D-Bus name of the sender (provided by D-Bus)
1148 """
1149 log.info("UpdateCachePartially() was called")
1150 kwargs = {"sources_list": sources_list}
1151 return self._create_trans(enums.ROLE_UPDATE_CACHE,
1152 policykit1.PK_ACTION_UPDATE_CACHE, sender,
1153 kwargs=kwargs)
11321154
1133 @dbus_deferred_method(APTDAEMON_DBUS_INTERFACE,1155 @dbus_deferred_method(APTDAEMON_DBUS_INTERFACE,
1134 in_signature="as", out_signature="s",1156 in_signature="as", out_signature="s",
11351157
=== modified file 'aptdaemon/worker.py'
--- aptdaemon/worker.py 2010-09-04 06:56:08 +0000
+++ aptdaemon/worker.py 2010-09-09 06:27:42 +0000
@@ -159,7 +159,7 @@
159 if self.trans.role == ROLE_FIX_BROKEN_DEPENDS:159 if self.trans.role == ROLE_FIX_BROKEN_DEPENDS:
160 self.fix_broken_depends()160 self.fix_broken_depends()
161 elif self.trans.role == ROLE_UPDATE_CACHE:161 elif self.trans.role == ROLE_UPDATE_CACHE:
162 self.update_cache()162 self.update_cache(**self.trans.kwargs)
163 # Process the transactions which require a consistent cache163 # Process the transactions which require a consistent cache
164 elif self._cache and self._cache.broken_count:164 elif self._cache and self._cache.broken_count:
165 broken = [pkg.name for pkg in self._cache if pkg.is_now_broken]165 broken = [pkg.name for pkg in self._cache if pkg.is_now_broken]
@@ -563,12 +563,12 @@
563 resolver.clear(pkg)563 resolver.clear(pkg)
564 resolver.protect(pkg)564 resolver.protect(pkg)
565565
566 def update_cache(self):566 def update_cache(self, sources_list):
567 """Update the cache."""567 """Update the cache."""
568 log.info("Updating cache")568 log.info("Updating cache")
569 progress = DaemonAcquireProgress(self.trans, begin=10, end=95)569 progress = DaemonAcquireProgress(self.trans, begin=10, end=95)
570 try:570 try:
571 self._cache.update(progress)571 self._cache.update(progress, sources_list=sources_list)
572 except apt.cache.FetchFailedException, error:572 except apt.cache.FetchFailedException, error:
573 raise TransactionFailed(ERROR_REPO_DOWNLOAD_FAILED,573 raise TransactionFailed(ERROR_REPO_DOWNLOAD_FAILED,
574 str(error.message))574 str(error.message))
575575
=== modified file 'doc/org.debian.apt.7'
--- doc/org.debian.apt.7 2010-07-14 07:16:44 +0000
+++ doc/org.debian.apt.7 2010-09-09 06:27:42 +0000
@@ -70,6 +70,15 @@
70Return 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.70Return 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.
71.RE71.RE
72.TP72.TP
73.B UpdateCachePartially
74.BI "UpdateCachePartially\t(in 's' " sources_list ,
75.br
76.BI "\t\tout 's' " tid )
77.RS
78.PP
79Return 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.
80.RE
81.TP
73.B InstallPackages82.B InstallPackages
74.BI "InstallPackages\t(in 'as' " package_names ,83.BI "InstallPackages\t(in 'as' " package_names ,
75.br84.br

Subscribers

People subscribed via source and target branches

to all changes: