Example #1
0
  def get (self, pkginst, show_progress = False):
    """Copy `pkginst` file from remote depot to local depot.

    :Parameters:
        `pkginst`: string
            Path to remote pkginst file relative to remote repository.
        `show_progress`: boolean
            True if a `TextProgressMeter` should be used as `pkginst`
            is downloaded.

    :Attributes:
        `verify_checksum`: boolean
            If True, then a checksum file is also fetched as part of
            the same file group (sharing the same `progressmeter`).
    """

    fetched_bytes = 0

    if show_progress:
      progressmeter = TextProgressMeter (self.indent_progressmeter)
    else:
      progressmeter = None

    # fetch a copy of the remote file
    mysig.register (os.remove, os.path.join (self.local_path, pkginst))
    try:
      fetched_bytes = self.fetch (pkginst, progressmeter, 0,
                                  CHECKSUM_FILESIZE)
    except depot.DepotError, msg:
      mysig.unregister (os.remove)
      raise
Example #2
0
  def remove_local_depot (self, local_depot, msg_callback = None):
    if not local_depot and self.local_depot:
      if msg_callback:
        msg_callback ('begin', 'removing temporary \
local depot directory', 2)
      misclib.rmdir (self.local_depot)
      if msg_callback:
        msg_callback ('end', 'done', 2)

      mysig.unregister (self.remove_local_depot)
Example #3
0
  def remove_temp_package_dir (self, msg_callback = None):
    if self.temp_package_dir:
      if msg_callback:
        msg_callback ('begin', 'removing temporary package directory', 2)
      misclib.rmdir (self.temp_package_dir)
      if msg_callback:
        msg_callback ('end', 'done', 2)

      mysig.unregister (self.remove_temp_package_dir)
      self.temp_package_dir = None
Example #4
0
    mysig.register (os.remove, os.path.join (self.local_path, pkginst))
    try:
      fetched_bytes = self.fetch (pkginst, progressmeter, 0,
                                  CHECKSUM_FILESIZE)
    except depot.DepotError, msg:
      mysig.unregister (os.remove)
      raise

    if self.verify_checksum:
      # fetch the associated checksum file
      pkginst += '.md5'
      mysig.register (os.remove, os.path.join (self.local_path, pkginst))
      try:
        self.fetch (pkginst, progressmeter, fetched_bytes, 0)
      except depot.DepotError:
        mysig.unregister (os.remove)
        mysig.unregister (os.remove)
        raise

    mysig.unregister (os.remove)
    mysig.unregister (os.remove)

    if show_progress:
      progressmeter.end ()

  def is_remote (self):
    """Return True if a depot with this transport is on a remote server."""
    return True

  def local_uptodate (self, file):
    """Check if file in local depot equivalent to that in remote depot."""