Exemplo n.º 1
0
    def update(self, package_name, version, platform, staging_dir, manifest_filepath):
        try:
            manifest_filename = CommonUtils.generate_manifest_filename(package_name, version, platform, "json")
            input_manifest_file = os.path.join(manifest_filepath, manifest_filename)
            self._deploy_package(package_name, version, platform, input_manifest_file, staging_dir)

        except Exception as e:
            self._cleanup(package_name, version, platform, manifest_filename)
            raise e
Exemplo n.º 2
0
 def add(self, package_name, version, platform, staging_dir, manifest_filepath):
     try:
         manifest_filename = CommonUtils.generate_manifest_filename(package_name, version, platform, "json")
         if os.path.exists(os.path.join(self._depot_mf_path, manifest_filename)):
             raise PackageExistsError("Package manifest file already exists in depot. Package name : {0}, manifest file: {1}.\n\
                                          Either uninstall the package first or use update command to install the package.".format(CommonUtils.generate_package_name(package_name,
                                                                                                                                                                      version,
                                                                                                                                                                      platform),
                                                                                                                                   manifest_filename))
         input_manifest_file = os.path.join(manifest_filepath, manifest_filename)
         self._deploy_package(package_name, version, platform, input_manifest_file, staging_dir)
     except Exception as e:
         self._cleanup(package_name, version, platform, manifest_filename)
         raise e
Exemplo n.º 3
0
 def _install_dependency(self, dep):
     mfn = dep[CommonConsts.MF_KEY_DEPENDS_ATTR_MANIFEST]
     if not mfn:
         mfn = CommonUtils.generate_manifest_filename(dep[CommonConsts.MF_KEY_DEPENDS_ATTR_PACKAGE],
                                                      dep[CommonConsts.MF_KEY_DEPENDS_ATTR_VERSION],
                                                      dep[CommonConsts.MF_KEY_DEPENDS_ATTR_PLATFORM],
                                                      "json")
     if mfn in self._dep_status[DEP_STATUS_KEY_INSTALLED]:
         return
     elif mfn in self._dep_status[DEP_STATUS_KEY_INQUEUE]:
         raise CyclicDependencyError("FATAL: Cyclic dependency found in manifest : {0} for {1} while installing package: {2}".format(self._manifest_filename,
                                                                                                                                     mfn, self._name))
     pi = PackageInstaller(dep[CommonConsts.MF_KEY_DEPENDS_ATTR_PACKAGE],
                                                      dep[CommonConsts.MF_KEY_DEPENDS_ATTR_VERSION],
                                                      dep[CommonConsts.MF_KEY_DEPENDS_ATTR_PLATFORM],
                                                      self._install_dir, self._depot_location, self._dep_status)
     pi.install()
Exemplo n.º 4
0
 def test_genfile(self):
     '''
     python voltron20.py manifest genfile --package_name="snappy" -ver="1.0.5" -p="ubuntu-12.04" 
     -sd="/tmp/snappy/opt/couchbase" -tfp="/home/suhail/workspace/temp/manifest-files"
     '''
     m = ManifestGenerator(SNAPPY_PKG_NAME, SNAPPY_VERSION, SNAPPY_PLATFORM,
                           os.path.join(DIR_SNAPPY_STAGING), DIR_DEPOT_TEMP)
     m.generate_manifest()
     mfn = CommonUtils.generate_manifest_filename("snappy", "1.0.5",
                                                  "ubuntu-12.04", "json")
     with open(os.path.join(DIR_DEPOT_TEMP, mfn)) as f:
         manifest = json.load(f)
     assert set([
         CommonConsts.MF_KEY_BUILD, CommonConsts.MF_KEY_DEPENDS,
         CommonConsts.MF_KEY_DIRS, CommonConsts.MF_KEY_FILES
     ]) == set(manifest)
     assert len(manifest[CommonConsts.MF_KEY_DIRS]) == 5
     assert len(manifest[CommonConsts.MF_KEY_FILES]) == 16
Exemplo n.º 5
0
    def _setup(self):
        try:
            self._manifest_filename = CommonUtils.generate_manifest_filename(self._name, self._version, self._platform, "json")

            self._depot_manifestfile_location = os.path.join(self._depot_location, CommonConsts.SW_DEPOT_MANIFEST_FILE_DIR)
            self._depot_datafile_location = os.path.join(self._depot_location, CommonConsts.SW_DEPOT_DATAFILES_DIR,
                                                         CommonUtils.generate_package_name(self._name, self._version, self._platform))


            self._etc_dir = os.path.join(self._install_dir, "etc", "packages")
            if not os.path.exists(self._etc_dir):
                os.makedirs(self._etc_dir)
            self._pkg_install_dir = self._install_dir
            self._is_already_installed = self._is_already_installed()
            self._temp_dir = os.path.join(self._pkg_install_dir, os.path.splitext(self._manifest_filename)[0] + "-INSTALL-TEMP")
            os.mkdir(self._temp_dir)
            self._manifest = self._get_manifest_object()
        except Exception as e:
            self._cleanup()
            self._log.error(e)
            raise e
Exemplo n.º 6
0
 def _generate_file_name(self):
     return CommonUtils.generate_manifest_filename(self._package_name,
                                                   self._version,
                                                   self._platform, "json")
Exemplo n.º 7
0
 def delete(self, package_name, version, platform,):
     manifest_filename = CommonUtils.generate_manifest_filename(package_name, version, platform, "json")
     self._cleanup(package_name, version, platform, manifest_filename)
Exemplo n.º 8
0
 def _generate_file_name(self):
     return CommonUtils.generate_manifest_filename(self._package_name, self._version, self._platform, "json")