~ubuntu-branches/ubuntu/oneiric/aptdaemon/oneiric-updates

« back to all changes in this revision

Viewing changes to aptdaemon/core.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2011-08-23 11:29:50 UTC
  • mfrom: (1.3.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20110823112950-0getv6s3nko33jrq
Tags: 0.43+bzr674-0ubuntu1
* new bzr snapshot:
  - add /var/log/apt/history.log integration
  - switch bytes_{done,total} to 64bit to follow a change in apt 
    (LP: #825468)
  - fix multiarch names (LP: #828898, LP: #828162)

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
# finished
86
86
TRANSACTION_DEL_TIMEOUT = 5
87
87
 
88
 
# regexp for the pkgname, for details see
 
88
# regexp for the pkgname and optional arch, for details see
89
89
#   http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source
90
 
REGEX_VALID_PACKAGENAME = "^[a-z0-9][a-z0-9\-+.]+$"
 
90
REGEX_VALID_PACKAGENAME = "^[a-z0-9][a-z0-9\-+.]+(:[a-z0-9]+)?$"
91
91
# regexp for the version number, for details see:
92
92
#   http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
93
93
REGEX_VALID_VERSION = "^[0-9][0-9.+\-A-Za-z:~]*$"
94
94
# regexp for the archive (Suite) as found in the Release file 
95
95
REGEX_VALID_RELEASE = "^[a-zA-Z0-9_\-]+$"
96
 
# regexp for the architecture
97
 
REGEX_VALID_ARCH = "^[a-z0-9]+$"
98
96
 
99
97
# Setup the DBus main loop
100
98
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
330
328
        self.after = None
331
329
        self._role = dbus.String(role)
332
330
        self._progress = dbus.Int32(0)
 
331
        # items_done, total_items, bytes_done, total_bytes, speed, time
333
332
        self._progress_details = dbus.Struct((0, 0, 0, 0, 0, 0),
334
 
                                             signature="iiiiiii")
 
333
                                             signature="iixxii")
335
334
        self._progress_download = dbus.Struct(("", "", "", 0L, 0L, ""),
336
335
                                              signature="sssxxs")
337
336
        self._exit = dbus.String(enums.EXIT_UNFINISHED)
454
453
    role = property(_get_role, _set_role, doc="Operation type of transaction.")
455
454
 
456
455
    def _set_progress_details(self, details):
457
 
        self._progress_details = self._convert_struct(details, "iiiiii")
 
456
        # items_done, total_items, bytes_done, total_bytes, speed, time
 
457
        self._progress_details = self._convert_struct(details, "iixxii")
458
458
        self.PropertyChanged("ProgressDetails", self._progress_details)
459
459
 
460
460
    def _get_progress_details(self):
1862
1862
        exception.
1863
1863
        """
1864
1864
        for fullname in pkg_names:
1865
 
            name, arch, version, release = AptWorker._split_package_id(fullname)
 
1865
            name, version, release = AptWorker._split_package_id(fullname)
1866
1866
            if not re.match(REGEX_VALID_PACKAGENAME, name):
1867
1867
                raise errors.AptDaemonError("%s isn't a valid package name" % \
1868
1868
                                            name)
1869
 
            if (arch is not None and
1870
 
                not re.match(REGEX_VALID_ARCH, arch)):
1871
 
                raise errors.AptDaemonError("%s isn't a valid architecture" % \
1872
 
                                            arch)
1873
1869
            if (version is not None and
1874
1870
                not re.match(REGEX_VALID_VERSION, version)):
1875
1871
                raise errors.AptDaemonError("%s isn't a valid version" % \
1910
1906
 
1911
1907
    def _get_is_reboot_required(self):
1912
1908
        return os.path.exists("/var/run/reboot-required")
1913
 
        
 
1909
 
1914
1910
    def _get_popcon_participation(self):
1915
1911
        #FIXME: Use a script to evaluate the configuration:
1916
1912
        #       #!/bin/sh