~ubuntu-branches/ubuntu/precise/oneconf/precise

« back to all changes in this revision

Viewing changes to oneconf/Ubuntu.py

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2012-02-15 17:22:39 UTC
  • Revision ID: package-import@ubuntu.com-20120215172239-1ximqt1ya83i0rj4
Tags: 0.2.6.8
* New release:
  - ensure we keep staged pending action of the server told us the operation
    failed (LP: #932715)
  - preventing running as root (LP: #834458)
  - fix a typo when gsettings return null (LP: #871783)
  - oneconf-service crashed with UnboundLocalError in process_sync(): local
    variable 'packages_checksum' referenced before assignment (LP: #908759)
  - import the dbus exception at the right place (LP: #889867)
  - add a lot of tests
* debian/control:
  - change python-gobject dep by python-gi

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 Canonical
2
 
#
3
 
# Authors:
4
 
#  Didier Roche <didrocks@ubuntu.com>
5
 
#
6
 
# This program is free software; you can redistribute it and/or modify it under
7
 
# the terms of the GNU General Public License as published by the Free Software
8
 
# Foundation; version 3.
9
 
#
10
 
# This program is distributed in the hope that it will be useful, but WITHOUT
11
 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
 
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
13
 
# details.
14
 
#
15
 
# You should have received a copy of the GNU General Public License along with
16
 
# this program; if not, write to the Free Software Foundation, Inc.,
17
 
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
 
 
19
 
import apt
20
 
import logging
21
 
 
22
 
LOG = logging.getLogger(__name__)
23
 
 
24
 
from oneconf.distributor import Distro
25
 
 
26
 
 
27
 
class Ubuntu(Distro):
28
 
 
29
 
    ONECONF_SERVER = "https://apps.ubuntu.com/cat/api/1.0"
30
 
 
31
 
    def compute_local_packagelist(self):
32
 
        '''Introspect what's installed on this hostid
33
 
 
34
 
        Return: installed_packages list
35
 
        '''
36
 
        
37
 
        LOG.debug ('Compute package list for current host')
38
 
        apt_cache = apt.Cache()
39
 
 
40
 
        # get list of all apps installed
41
 
        installed_packages = {}
42
 
        for pkg in apt_cache:
43
 
            if pkg.is_installed:
44
 
                installed_packages[pkg.name] = {"auto": pkg.is_auto_installed}
45
 
 
46
 
        return installed_packages
47