~glatzor/aptdaemon/maverick-updates

« back to all changes in this revision

Viewing changes to .pc/05_sources_list_password.patch/aptdaemon/worker.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2010-09-16 09:11:50 UTC
  • mfrom: (1.1.34 upstream)
  • Revision ID: james.westby@ubuntu.com-20100916091150-bum78balwxl58ml4
Tags: 0.31+bzr503-0ubuntu1
* merge fixes from bzr:
  - allow purge of removed files with conffiles left
  - fix bug when deferable is called with sync=True
  - use wait=False in enable_distro component
  - Fix local dpkg installation from unicode pathes by 
    converting the strings to UTF-8
  - fix potential exception in wait=True, defer=True calls

Show diffs side-by-side

added added

removed removed

Lines of Context:
433
433
        log.info("Installing local package file: %s", path)
434
434
        # Check if the dpkg can be installed at all
435
435
        self.trans.status = STATUS_RESOLVING_DEP
436
 
        deb = apt.debfile.DebPackage(path, self._cache)
 
436
        deb = apt.debfile.DebPackage(path.encode("UTF-8"), self._cache)
437
437
        if not deb.check():
438
438
            raise TransactionFailed(ERROR_DEP_RESOLUTION_FAILED,
439
439
                                    deb._failure_string)
480
480
            except KeyError:
481
481
                raise TransactionFailed(ERROR_NO_PACKAGE,
482
482
                                        "Package %s isn't available" % pkg_name)
483
 
            if not pkg.is_installed:
 
483
            if not pkg.is_installed and not pkg.installed_files:
484
484
                raise TransactionFailed(ERROR_PACKAGE_NOT_INSTALLED,
485
485
                                        "Package %s isn't installed" % pkg_name)
486
486
            if pkg.essential == True:
487
487
                raise TransactionFailed(ERROR_NOT_REMOVE_ESSENTIAL_PACKAGE,
488
488
                                        "Package %s cannot be removed." % \
489
489
                                        pkg_name)
490
 
            pkg.mark_delete(False, purge=purge)
 
490
            pkg.mark_delete(False, purge)
491
491
            resolver.clear(pkg)
492
492
            resolver.protect(pkg)
493
493
            resolver.remove(pkg)
700
700
        # Do not allow to remove essential packages
701
701
        for pkg in changes:
702
702
            if pkg.marked_delete and (pkg.essential == True or \
703
 
                                      pkg.installed.priority == "required" or \
 
703
                                      (pkg.installed and \
 
704
                                       pkg.installed.priority == "required") or\
704
705
                                      pkg.name == "aptdaemon"):
705
706
                raise TransactionFailed(ERROR_NOT_REMOVE_ESSENTIAL_PACKAGE,
706
707
                                        "Package %s cannot be removed." % \
819
820
            self._cache.upgrade(not trans.kwargs["safe_mode"])
820
821
            self._call_plugins("modify_cache_after")
821
822
        elif trans.role == ROLE_INSTALL_FILE:
822
 
            deb = apt.debfile.DebPackage(trans.kwargs["path"], self._cache)
 
823
            deb = apt.debfile.DebPackage(trans.kwargs["path"].encode("UTF-8"),
 
824
                                         self._cache)
823
825
            if not deb.check():
824
826
                raise TransactionFailed(ERROR_DEP_RESOLUTION_FAILED,
825
827
                                        deb._failure_string)
898
900
                    # candidate version
899
901
                    version = pkg.candidate
900
902
                    status += "Status: install ok installed\n"
901
 
                status += get_base_records(version.record)
 
903
                # Corner-case: a purge of an already removed package won't
 
904
                # have an installed version
 
905
                if version:
 
906
                    status += get_base_records(version.record)
902
907
                changes.remove(pkg)
903
908
            else:
904
909
                status += get_base_records(sec, ["Status"])