~ubuntu-branches/ubuntu/utopic/unattended-upgrades/utopic

« back to all changes in this revision

Viewing changes to unattended-upgrade

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2009-06-25 16:07:29 UTC
  • mfrom: (4.1.24 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090625160729-hpyuup2gha525ilp
Tags: 0.42debian1
* debian/po/sk.po:
  - new translation, thanks to helix84, closes: #532959
* debian/po/ru.po:
  - updated, thanks to Yuri Kozlov, closes: #527111
* debian/po/eu.po:
  - updated, thanks to Piarres Beobide, closes: #513436
* debian/links
  - add symlink to make binary name and package name match, 
    closes: #428965

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
 
#
3
 
# (c) 2005-2008 Canonical
4
 
# Author: Michael Vogt <michael.vogt@ubuntu.com>
5
 
#
6
 
# Released under the GPL
 
2
# Copyright (c) 2005-2009 Canonical Ltd
 
3
#
 
4
# AUTHOR:
 
5
# Michael Vogt <mvo@ubuntu.com>
 
6
#
 
7
# This file is part of unattended-upgrades
 
8
#
 
9
# unattended-upgrades is free software; you can redistribute it and/or
 
10
# modify it under the terms of the GNU General Public License as published
 
11
# by the Free Software Foundation; either version 2 of the License, or (at
 
12
# your option) any later version.
 
13
#
 
14
# unattended-upgrades is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
# General Public License for more details.
 
18
#
 
19
# You should have received a copy of the GNU General Public License
 
20
# along with unattended-upgrades; if not, write to the Free Software
 
21
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
#
7
23
 
8
24
import apt_inst
9
25
import apt_pkg
198
214
                else:
199
215
                    logging.debug("sanity check failed")
200
216
                    rewind_cache(cache, pkgs_to_upgrade)
201
 
                    pkgs_kept_back.append(pkg)
 
217
                    pkgs_kept_back.append(pkg.name)
202
218
            except SystemError, e:
203
219
                # can't upgrade
204
220
                logging.warning(_("package '%s' upgradable but fails to be marked for upgrade (%s)") % e)
205
221
                rewind_cache(cache, pkgs_to_ugprade)
206
 
                pkgs_kept_back.append(pkg)
 
222
                pkgs_kept_back.append(pkg.name)
207
223
                
208
224
 
209
225
    pkgs = "\n".join([pkg.name for pkg in pkgs_to_upgrade])
244
260
                # some other package again!
245
261
                logging.warning(_("Package '%s' has conffile prompt and needs to be upgraded manually") % pkgname_from_deb(item.DestFile))
246
262
                blacklisted_pkgs.append(pkgname_from_deb(item.DestFile))
 
263
                pkgs_kept_back.append(pkgname_from_deb(item.DestFile))
247
264
 
248
265
 
249
266
        # redo the selection about the packages to upgrade based on the new
261
278
                                            blacklisted_pkgs):
262
279
                     pkgs_to_upgrade.append(pkg)
263
280
                else:
 
281
                    if not (pkg.name in pkgs_kept_back):
 
282
                        pkgs_kept_back.append(pkg.name)
264
283
                    logging.info(_("package '%s' not upgraded") % pkg.name)
265
284
                    cache.clear()
266
285
                    for pkg2 in pkgs_to_upgrade:
270
289
 
271
290
    logging.debug("InstCount=%i DelCount=%i BrokenCout=%i" % (cache._depcache.InstCount, cache._depcache.DelCount, cache._depcache.BrokenCount))
272
291
 
273
 
    # check what we have
274
 
    if len(pkgs_to_upgrade) == 0:
 
292
    # exit if there is nothing to do and nothing to report
 
293
    if (len(pkgs_to_upgrade) == 0) and (len(pkgs_kept_back) == 0):
275
294
        logging.info(_("No packages found that can be upgraded unattended"))
276
295
        sys.exit(0)    
277
296
 
338
357
        s += "\n"
339
358
        if pkgs_kept_back:
340
359
            s += _("Packages with upgradable origin but kept back:\n")
341
 
            s += " " + wrap(" ".join([pkg.name for pkg in pkgs_kept_back]), 70, " ")
 
360
            s += " " + wrap(" ".join(pkgs_kept_back), 70, " ")
342
361
            s += "\n"
343
362
        s += "\n"
344
363
        s += _("Package installation log:")