def create_links(self): if self.version: util.symlink(os.path.join(self.dir, 'latest'), self.version) self._callback('repo_link_set', 'latest', self.version) if self.stable: util.symlink(os.path.join(self.dir, 'stable'), self.stable) self._callback('repo_link_set', 'stable', self.stable) elif os.path.lexists(os.path.join(self.dir, 'stable')): os.unlink(os.path.join(self.dir, 'stable')) else: if os.path.lexists(os.path.join(self.dir, 'latest')): os.unlink(os.path.join(self.dir, 'latest')) if os.path.lexists(os.path.join(self.dir, 'stable')): os.unlink(os.path.join(self.dir, 'stable'))
def setup_directories(self): if self.local_dir and self.link_type == 'symlink': if not os.path.islink(self.package_dir) and os.path.isdir( self.package_dir): shutil.rmtree(self.package_dir) util.symlink(self.package_dir, self.local_dir) else: if os.path.islink(self.package_dir): os.unlink(self.package_dir) util.make_dir(self.package_dir) if self.version_dir: if os.path.islink(self.version_package_dir) or os.path.isfile( self.version_package_dir): os.unlink(self.version_package_dir) elif os.path.isdir(self.version_package_dir): shutil.rmtree(self.version_package_dir) if self.link_type == 'symlink': util.symlink( self.version_package_dir, os.path.relpath(self.package_dir, self.version_dir)) else: # hardlink util.make_dir(self.version_package_dir)
def setup_directories(self): if self.local_dir and self.link_type == 'symlink': if not os.path.islink(self.package_dir) and os.path.isdir(self.package_dir): shutil.rmtree(self.package_dir) assert isinstance(self.local_dir, (list, str)) if isinstance(self.local_dir, list): for idx, local_dir in enumerate(self.local_dir): subdir = os.path.join(self.package_dir, "repo_{}".format(idx)) util.symlink(subdir, local_dir) elif isinstance(self.local_dir, str): util.symlink(self.package_dir, self.local_dir) else: if os.path.islink(self.package_dir): os.unlink(self.package_dir) util.make_dir(self.package_dir) if self.version_dir: if os.path.islink(self.version_package_dir) or os.path.isfile(self.version_package_dir): os.unlink(self.version_package_dir) elif os.path.isdir(self.version_package_dir): shutil.rmtree(self.version_package_dir) if self.link_type == 'symlink': util.symlink(self.version_package_dir, os.path.relpath(self.package_dir, self.version_dir)) elif self.link_type == 'individual_symlink': util.make_dir(self.version_package_dir) if isinstance(self.local_dir, list): dirs = self.local_dir single = False elif isinstance(self.local_dir, str): dirs = [self.local_dir] single = True for idx, _dir in enumerate(dirs): pkg_dir = self.version_package_dir if not single: pkg_dir = os.path.join(self.version_package_dir, "repo_{}".format(idx)) util.make_dir(os.path.join(pkg_dir)) for _file in self._find_rpms(_dir): util.symlink(os.path.join(pkg_dir, _file), os.path.join(_dir, _file)) else: # hardlink util.make_dir(self.version_package_dir)
def create_links(self): if self.version: util.symlink(os.path.join(self.dir, 'latest'), self.version) self._callback('repo_link_set', 'latest', self.version) if self.stable: util.symlink(os.path.join(self.dir, 'stable'), self.stable) self._callback('repo_link_set', 'stable', self.stable) elif os.path.lexists(os.path.join(self.dir, 'stable')): os.unlink(os.path.join(self.dir, 'stable')) for label, version in six.iteritems(self.labels): util.symlink(os.path.join(self.dir, label), version) self._callback('repo_link_set', label, version) else: if os.path.lexists(os.path.join(self.dir, 'latest')): os.unlink(os.path.join(self.dir, 'latest')) if os.path.lexists(os.path.join(self.dir, 'stable')): os.unlink(os.path.join(self.dir, 'stable'))