def create_server(trunk_location, pubkey, privkey, keystore_location,
                  update_dir):
    """
  <Purpose>
    Populates the update directory (set by a constant) with the
    program files from the current repository.
  
  <Arguments>
    trunk_location:
      The location of the repository's trunk directory, used to
      find the program files.

    pubkey:
      The public key used to generate the metafile.

    privkey:
      The private key used to generate the metafile.
    
    updatedir:
      The directory to put the generated update files in.
    
  <Exceptions>
    IOError on bad filepath.
  
  <Side Effects>
    None.

  <Returns>
    None.
  """
    # If we're in DEBUG mode, don't use the real update
    # directory
    if DEBUG:
        print "Debug mode..."
        update_dir = update_dir + "/test"

    # Create temporary directory for the files to go into the installer.
    temp_install_dir = tempfile.mkdtemp()

    try:
        print "Generating all the seattle general files..."
        make_base_installers.prepare_gen_files(trunk_location,
                                               temp_install_dir, False, pubkey,
                                               privkey, False)
        print "Done generating seattle files."

        print "Starting to setup softwareupdater server..."
        # Create the software updater server and sign all the data.
        make_base_installers.create_softwareupdater_server(
            temp_install_dir, update_dir, keystore_location)
        print "Done creating softwareupdater server."

    finally:
        # Remove the temporary folder
        shutil.rmtree(temp_install_dir)
def create_server(trunk_location, pubkey, privkey, keystore_location, update_dir):
  """
  <Purpose>
    Populates the update directory (set by a constant) with the
    program files from the current repository.
  
  <Arguments>
    trunk_location:
      The location of the repository's trunk directory, used to
      find the program files.

    pubkey:
      The public key used to generate the metafile.

    privkey:
      The private key used to generate the metafile.
    
    updatedir:
      The directory to put the generated update files in.
    
  <Exceptions>
    IOError on bad filepath.
  
  <Side Effects>
    None.

  <Returns>
    None.
  """
  # If we're in DEBUG mode, don't use the real update
  # directory
  if DEBUG:
    print "Debug mode..."
    update_dir = update_dir + "/test"
  
  # Create temporary directory for the files to go into the installer.
  temp_install_dir = tempfile.mkdtemp()

  try:
    print "Generating all the seattle general files..."
    make_base_installers.prepare_gen_files(trunk_location, temp_install_dir,
                                           False, pubkey, privkey, False)
    print "Done generating seattle files."
    
    print "Starting to setup softwareupdater server..."
    # Create the software updater server and sign all the data.
    make_base_installers.create_softwareupdater_server(temp_install_dir, update_dir,
                                                      keystore_location)
    print "Done creating softwareupdater server."

  finally:
    # Remove the temporary folder
    shutil.rmtree(temp_install_dir)
示例#3
0
def update(trunk_location, pubkey, privkey, keystore_location, update_dir):
  """
  <Purpose>
    Populates the update directory (set by a constant) with the
    program files from the current repository.
  
  <Arguments>
    trunk_location:
      The location of the repository's trunk directory, used to
      find the program files.

    pubkey:
      The public key used to generate the metafile.

    privkey:
      The private key used to generate the metafile.
    
    updatedir:
      The directory to put the generated update files in.
    
  <Exceptions>
    IOError on bad filepath.
  
  <Side Effects>
    None.
"Melody Kadenko" <*****@*****.**>, 
  <Returns>
    None.
  """
  # If we're in DEBUG mode, don't use the real update
  # directory
  if DEBUG:
    print "Debug mode..."
    update_dir = update_dir + "/test"
  
  # Create temporary directory for the files to go into the installer.
  temp_install_dir = tempfile.mkdtemp()

  try:
    make_base_installers.prepare_gen_files(trunk_location, temp_install_dir,
                                           False, pubkey, privkey, False)


    shutil.copy2(os.path.join(temp_install_dir, "metainfo"), "/home/testgeni/temp/metainfo_update")
    # Update the softwareupdater server directory with the files.
    make_base_installers.update_softwareupdater_server(temp_install_dir, update_dir,
                                                      keystore_location)
  finally:
    # Remove the temporary folder
    shutil.rmtree(temp_install_dir)
示例#4
0
def update(trunk_location, pubkey, privkey, update_dir):
    """
  <Purpose>
    Populates the update directory (set by a constant) with the
    program files from the current repository.
  
  <Arguments>
    trunk_location:
      The location of the repository's trunk directory, used to
      find the program files.

    pubkey:
      The public key used to generate the metafile.

    privkey:
      The private key used to generate the metafile.
    
    updatedir:
      The directory to put the generated update files in.
    
  <Exceptions>
    IOError on bad filepath.
  
  <Side Effects>
    None.

  <Returns>
    None.
  """
    # If we're in DEBUG mode, don't use the real update
    # directory
    if DEBUG:
        print "Debug mode..."
        update_dir = update_dir + "/test"

    make_base_installers.prepare_gen_files(trunk_location, update_dir, False,
                                           pubkey, privkey, False)
示例#5
0
def update(trunk_location, pubkey, privkey, update_dir):
  """
  <Purpose>
    Populates the update directory (set by a constant) with the
    program files from the current repository.
  
  <Arguments>
    trunk_location:
      The location of the repository's trunk directory, used to
      find the program files.

    pubkey:
      The public key used to generate the metafile.

    privkey:
      The private key used to generate the metafile.
    
    updatedir:
      The directory to put the generated update files in.
    
  <Exceptions>
    IOError on bad filepath.
  
  <Side Effects>
    None.

  <Returns>
    None.
  """
  # If we're in DEBUG mode, don't use the real update
  # directory
  if DEBUG:
    print "Debug mode..."
    update_dir = update_dir + "/test"
    
  make_base_installers.prepare_gen_files(trunk_location, update_dir,
                                         False, pubkey, privkey, False)
示例#6
0
def build_and_update(trunk_location, pubkey, privkey, version):
  """
  <Purpose>
    Builds the installers, copying the proper files to the software updater
    directory in the process, and deposits the installers in the dist
    directory. Only meant to be run on the actual seattle server.

  <Arguments>
    trunk_location:
      The path to the repository's trunk directory.
    pubkey:
      The public key to be used in the installers.
    privkey:
      The private key to be used in the installers.
    version:
      The version of the distribution which will be appended to the base name of
      each installer.

  <Exceptions>
    IOError on bad filepaths.

  <Side Effects>
    None.

  <Returns>
    None.
  """

  # Check that the urls, keys, and version this script wants to use matches up
  # with the information in the trunk (namely softwarupdater.mix and nmmain.py)
  urls_match, keys_match, versions_match = confirm_paths_version(trunk_location,
                                                                pubkey, version)
  if not (urls_match and keys_match and versions_match):
    if not urls_match:
      print "Updater location does not match with url in softwareupdater.py."
    if not keys_match:
      print "Given public key does not match with key in softwareupdater.py."
    if not versions_match:
      print "Given version does not match with version in nmmain.py"
    return
  print "Confirmation of url and key paths match."
  print "Confirmation of version match."
  print ""
  print "Building installers and copying files to the software updater..."


  # First, make the temp directories
  # Zack: Created temporary directory for the installation
  temp_install_dir = tempfile.mkdtemp()
  # Zack: Created temporary directory for creating the tarball(s)
  temp_tarball_dir = tempfile.mkdtemp()

  # Next, prepare the installation files
  install_files = make_base_installers.prepare_gen_files(trunk_location,
                                 temp_install_dir, False, pubkey, privkey, True)

  # Remove the files in UPDATER_SITE, then copy the general installer files to
  # the updater site
  os.chdir(UPDATER_SITE)    
  for fname in os.listdir(UPDATER_SITE):
    os.remove(fname)
  # Zack: Copy files to UPDATER_SITE, excluding the files that did not belong in
  # the metainfo file
  os.chdir(temp_install_dir)
  for fname in install_files:
    if "nodeman.cfg" != fname and "resources.offcut" != fname:
      shutil.copy2(fname, UPDATER_SITE)


  # Now, package each installer
  win_instname = make_base_installers.get_inst_name("win", version)
  winmob_instname = make_base_installers.get_inst_name("winmob", version)
  linux_instname = make_base_installers.get_inst_name("linux", version)
  mac_instname = make_base_installers.get_inst_name("mac", version)

  make_base_installers.package_win_or_winmob(trunk_location, temp_install_dir,
                                  temp_tarball_dir, win_instname, install_files)
  make_base_installers.package_win_or_winmob(trunk_location, temp_install_dir,
                               temp_tarball_dir, winmob_instname, install_files)
  make_base_installers.package_linux_or_mac(trunk_location, temp_install_dir,
                                temp_tarball_dir, linux_instname, install_files)
  make_base_installers.package_linux_or_mac(trunk_location, temp_install_dir,
                                  temp_tarball_dir, mac_instname, install_files)


  # Zack: Move the installers to the specified output directory
  os.chdir(temp_tarball_dir)
  for tarball in os.listdir(temp_tarball_dir):
    shutil.copy2(tarball, DIST_DIR)


  # Copy each versioned installer name over the corresponding base
  # base installer
  for dist in ["win", "winmob", "linux", "mac"]:
    versioned_name = make_base_installers.get_inst_name(dist, version)
    unversioned_name = make_base_installers.get_inst_name(dist, "")
    shutil.copy2(DIST_DIR + "/" + versioned_name,
                 DIST_DIR + "/" + unversioned_name)


  # Zack: Remove the temp directory when done.
  shutil.rmtree(temp_install_dir)
  shutil.rmtree(temp_tarball_dir)
  print "Done!"
示例#7
0
def build_and_update(trunk_location, pubkey, privkey, version):
    """
  <Purpose>
    Builds the installers, copying the proper files to the software updater
    directory in the process, and deposits the installers in the dist
    directory. Only meant to be run on the actual seattle server.

  <Arguments>
    trunk_location:
      The path to the repository's trunk directory.
    pubkey:
      The public key to be used in the installers.
    privkey:
      The private key to be used in the installers.
    version:
      The version of the distribution which will be appended to the base name of
      each installer.

  <Exceptions>
    IOError on bad filepaths.

  <Side Effects>
    None.

  <Returns>
    None.
  """

    # Check that the urls, keys, and version this script wants to use matches up
    # with the information in the trunk (namely softwarupdater.mix and nmmain.py)
    urls_match, keys_match, versions_match = confirm_paths_version(
        trunk_location, pubkey, version)
    if not (urls_match and keys_match and versions_match):
        if not urls_match:
            print "Updater location does not match with url in softwareupdater.py."
        if not keys_match:
            print "Given public key does not match with key in softwareupdater.py."
        if not versions_match:
            print "Given version does not match with version in nmmain.py"
        return
    print "Confirmation of url and key paths match."
    print "Confirmation of version match."
    print ""
    print "Building installers and copying files to the software updater..."

    # First, make the temp directories
    # Zack: Created temporary directory for the installation
    temp_install_dir = tempfile.mkdtemp()
    # Zack: Created temporary directory for creating the tarball(s)
    temp_tarball_dir = tempfile.mkdtemp()

    # Next, prepare the installation files
    install_files = make_base_installers.prepare_gen_files(
        trunk_location, temp_install_dir, False, pubkey, privkey, True)

    # Remove the files in UPDATER_SITE, then copy the general installer files to
    # the updater site
    os.chdir(UPDATER_SITE)
    for fname in os.listdir(UPDATER_SITE):
        os.remove(fname)
    # Zack: Copy files to UPDATER_SITE, excluding the files that did not belong in
    # the metainfo file
    os.chdir(temp_install_dir)
    for fname in install_files:
        if "nodeman.cfg" != fname and "resources.offcut" != fname:
            shutil.copy2(fname, UPDATER_SITE)

    # Now, package each installer
    win_instname = make_base_installers.get_inst_name("win", version)
    winmob_instname = make_base_installers.get_inst_name("winmob", version)
    linux_instname = make_base_installers.get_inst_name("linux", version)
    mac_instname = make_base_installers.get_inst_name("mac", version)

    make_base_installers.package_win_or_winmob(trunk_location,
                                               temp_install_dir,
                                               temp_tarball_dir, win_instname,
                                               install_files)
    make_base_installers.package_win_or_winmob(trunk_location,
                                               temp_install_dir,
                                               temp_tarball_dir,
                                               winmob_instname, install_files)
    make_base_installers.package_linux_or_mac(trunk_location, temp_install_dir,
                                              temp_tarball_dir, linux_instname,
                                              install_files)
    make_base_installers.package_linux_or_mac(trunk_location, temp_install_dir,
                                              temp_tarball_dir, mac_instname,
                                              install_files)

    # Zack: Move the installers to the specified output directory
    os.chdir(temp_tarball_dir)
    for tarball in os.listdir(temp_tarball_dir):
        shutil.copy2(tarball, DIST_DIR)

    # Copy each versioned installer name over the corresponding base
    # base installer
    for dist in ["win", "winmob", "linux", "mac"]:
        versioned_name = make_base_installers.get_inst_name(dist, version)
        unversioned_name = make_base_installers.get_inst_name(dist, "")
        shutil.copy2(DIST_DIR + "/" + versioned_name,
                     DIST_DIR + "/" + unversioned_name)

    # Zack: Remove the temp directory when done.
    shutil.rmtree(temp_install_dir)
    shutil.rmtree(temp_tarball_dir)
    print "Done!"