Create an ARJ archive.
197274
def create_arj (archive, compression, cmd, verbosity, interactive, filenames):
    """"""
    cmdlist = [cmd, 'a', '-r']
    if not interactive:
        cmdlist.append('-y')
    cmdlist.append(archive)
    cmdlist.extend(filenames)
    return cmdlist
285911
def _generate_tar(dir_path):
    """"""
    try:
        with tarfile.open(dir_path + '.tar', 'w') as tar:
            tar.add(dir_path)
    except tarfile.TarError as e:
        stderr("Error: tar archive creation failed [" + str(e) + "]", exit=1)
542349
def _create_algo_bin(self, ro_rw_zi):
        """"""
        sect_ro, sect_rw, sect_zi = ro_rw_zi
        algo_size = sect_ro.length + sect_rw.length + sect_zi.length
        algo_data = bytearray(algo_size)
        for section in (sect_ro, sect_rw):
            start = section.start
            size = section.length
            data = section.data
            assert len(data) == size
            algo_data[start:start + size] = data
        return algo_data
852485
def _create(opener,
            format_code,
            files,
            filter_code=None,
            block_size=16384):
    """"""

    a = _archive_write_new()
    _set_write_context(a, format_code, filter_code)

    _LOGGER.debug("Opening archive (create).")
    opener(a)

# Use the standard uid/gid lookup mechanisms.
# This was set on an instance of *disk* that wasn't used. Do we still need it?
#_archive_read_disk_set_standard_lookup(disk)

    # We used to yield this, but that necessitated users always flattening the
    # response. This means we don't have to, but we still have to return an
    # enumerable in order to maintain compatibility.
    added = []

    for filepath in files:
        filepath = filepath.encode('utf-8')

        disk = libarchive.calls.archive_read.c_archive_read_disk_new()
        libarchive.calls.archive_read.c_archive_read_disk_open(
            disk,
            filepath)

        while 1:
            entry = libarchive.calls.archive_entry.c_archive_entry_new()
            r = libarchive.calls.archive_read.c_archive_read_next_header2(
                    disk,
                    entry)

            if r == libarchive.constants.archive.ARCHIVE_EOF:
                break
            elif r != libarchive.constants.archive.ARCHIVE_OK:
                message = c_archive_error_string(disk)
                raise libarchive.exception.ArchiveError(
                        "Could not build header from physical source file "
                        "during create: (%d) [%s]" %
                        (r, message))

            ae = libarchive.adapters.archive_entry.ArchiveEntry(
                        disk,
                        entry)

            # print("WRITING: [{}] {}".format(ae, ae.filetype))

            # Strip leading slash so it stores as a relative path.
            if os.path.isabs(ae.pathname) is True:
                ae.pathname = ae.pathname[1:]

            added.append(ae)

            libarchive.calls.archive_read.c_archive_read_disk_descend(disk)

            # NOTE: There's a `archive_entry_set_size()` on the underlying
            # entry type, but it doesn't appear to be necessary. The sizes
            # report perfectly fine with the [probably automatic] counting that
            # occurs just with `_archive_write_data()`.

            r = _archive_write_header(a, entry)

            if ae.filetype.IFLNK is True and os.path.islink(ae.sourcepath) is True:
                target_path = os.readlink(ae.sourcepath)
                ae.symlink_targetpath = target_path
            else:
                with open(ae.sourcepath, 'rb') as f:
                    while 1:
                        data = f.read(block_size)
                        if not data:
                            break

                        _archive_write_data(a, data)

            libarchive.calls.archive_entry.c_archive_entry_free(entry)

        libarchive.calls.archive_read.c_archive_read_close(disk)
        libarchive.calls.archive_read.c_archive_read_free(disk)

    _LOGGER.debug("Closing archive (create).")

    _archive_write_close(a)
    _archive_write_free(a)

    return added
1060933
def _create_archive(archive, filenames, verbosity=0, interactive=True,
                    program=None, format=None, compression=None):
    """"""
    if format is None:
        format, compression = get_archive_format(archive)
    check_archive_format(format, compression)
    program = find_archive_program(format, 'create', program=program)
    check_program_compression(archive, 'create', program, compression)
    get_archive_cmdlist = get_archive_cmdlist_func(program, 'create', format)
    origarchive = None
    if os.path.basename(program) == 'arc' and \
       ".arc" in archive and not archive.endswith(".arc"):
        # the arc program mangles the archive name if it contains ".arc"
        origarchive = archive
        archive = util.tmpfile(dir=os.path.dirname(archive), suffix=".arc")
    cmdlist = get_archive_cmdlist(archive, compression, program, verbosity, interactive, filenames)
    if cmdlist:
        # an empty command list means the get_archive_cmdlist() function
        # already handled the command (eg. when it's a builtin Python
        # function)
        run_archive_cmdlist(cmdlist, verbosity=verbosity)
    if origarchive:
        shutil.move(archive, origarchive)
856032
def create_lzma(archive, compression, cmd, verbosity, interactive, filenames):
    """"""
    return _create(archive, compression, cmd, 'alone', verbosity, filenames)
1288192
function createMiddleware(options, archiveFormat) {
  /**
   * Express middleware handling GitHub API archive link requests
   *
   * @param {Request} req Request object
   * @param {Response} res Response object
   * @param {callback} next next middleware in chain
   *
   * @see https://developer.github.com/v3/repos/contents/#get-archive-link
   */
  return (req, res) => {
    // GET /repos/:owner/:repo/:archive_format/:ref
    const { owner } = req.params;
    const repoName = req.params.repo;
    const refName = req.params.ref || 'master';

    const host = req.mappedSubDomain ? `localhost:${options.listen[req.protocol].port}` : req.headers.host;
    const location = `${req.protocol}://${host}/codeload/${owner}/${repoName}/${archiveFormat}/${refName}`;

    res.writeHead(302, {
      Location: location,
    });
    res.end();
  };
}
852465
def create(cls, result_id=None, summary=None, file_modified_at=None):
        """"""
        asset = cls(result_id, summary, file_modified_at)

        db.session.add(asset)
        db.session.commit()

        return asset
1109339
private File createArchive() throws Exception {
        getLog().info("Creating archive.");
        Artifact artifact = mavenProject.getArtifact();
        String clsfr = noclassifier ? "" : ("-" + classifier);
        String archiveName = artifact.getArtifactId() + "-" + artifact.getVersion() + clsfr + ".jar";
        File jarFile = new File(mavenProject.getBuild().getDirectory(), archiveName);
        MavenArchiver archiver = new MavenArchiver();
        jarArchiver.addDirectory(stagingDirectory);
        archiver.setArchiver(jarArchiver);
        archiver.setOutputFile(jarFile);
        archiver.createArchive(mavenSession, mavenProject, archiveConfig);
        
        if (noclassifier) {
            artifact.setFile(jarFile);
        } else {
            projectHelper.attachArtifact(mavenProject, jarFile, classifier);
        }
        
        FileUtils.deleteDirectory(stagingDirectory);
        return jarFile;
    }
1358287
def _repack_archive (archive1, archive2, verbosity=0, interactive=True):
    """"""
    format1, compression1 = get_archive_format(archive1)
    format2, compression2 = get_archive_format(archive2)
    if format1 == format2 and compression1 == compression2:
        # same format and compression allows to copy the file
        util.link_or_copy(archive1, archive2, verbosity=verbosity)
        return
    tmpdir = util.tmpdir()
    try:
        kwargs = dict(verbosity=verbosity, outdir=tmpdir)
        same_format = (format1 == format2 and compression1 and compression2)
        if same_format:
            # only decompress since the format is the same
            kwargs['format'] = compression1
        path = _extract_archive(archive1, **kwargs)
        archive = os.path.abspath(archive2)
        files = tuple(os.listdir(path))
        olddir = os.getcwd()
        os.chdir(path)
        try:
            kwargs = dict(verbosity=verbosity, interactive=interactive)
            if same_format:
                # only compress since the format is the same
                kwargs['format'] = compression2
            _create_archive(archive, files, **kwargs)
        finally:
            os.chdir(olddir)
    finally:
        shutil.rmtree(tmpdir, onerror=rmtree_log_error)
204785
def _create_archive(self):
        ''''''
        try:
            self.archive_path = os.path.join(self.report_dir, "%s.tar.gz" % self.session)
            self.logger.con_out('Creating SOSCleaner Archive - %s', self.archive_path)
            t = tarfile.open(self.archive_path, 'w:gz')
            for dirpath, dirnames, filenames in os.walk(self.dir_path):
                for f in filenames:
                    f_full = os.path.join(dirpath, f)
                    f_archive = f_full.replace(self.report_dir,'')
                    self.logger.debug('adding %s to %s archive', f_archive, self.archive_path)
                    t.add(f_full, arcname=f_archive)
        except Exception as e: #pragma: no cover
            self.logger.exception(e)
            raise Exception('CreateArchiveError: Unable to create Archive')

        self._clean_up()
        self.logger.info('Archiving Complete')
        self.logger.con_out('SOSCleaner Complete')
        if not self.quiet:  # pragma: no cover
            t.add(self.logfile, arcname=self.logfile.replace(self.report_dir,''))
        t.close()
769474
def archive(self):
        
        ids = self.rpc_model.search(self.domain, context=self.context)
        if ids:
            self.rpc_model.write(ids, {'active': False})
1215486
def create_archive(
            self,
            archive_name,
            authority_name,
            archive_path,
            versioned,
            raise_on_err=True,
            metadata=None,
            user_config=None,
            tags=None,
            helper=False):
        '''
        

        '''

        archive_metadata = self._create_archive_metadata(
            archive_name=archive_name,
            authority_name=authority_name,
            archive_path=archive_path,
            versioned=versioned,
            raise_on_err=raise_on_err,
            metadata=metadata,
            user_config=user_config,
            tags=tags,
            helper=helper)

        if raise_on_err:
            self._create_archive(
                archive_name,
                archive_metadata)
        else:
            self._create_if_not_exists(
                archive_name,
                archive_metadata)

        return self.get_archive(archive_name)
1328267
void startArchiving() {
		if (isArchivingDisabled()) {
			return;
		}

		String archiveName = configuration.get(JFunkConstants.ARCHIVE_FILE);
		if (StringUtils.isBlank(archiveName)) {
			archiveName = String.format(DIR_PATTERN, moduleMetaData.getModuleName(), Thread.currentThread().getName(),
					FORMAT.format(moduleMetaData.getStartDate()));
		}

		moduleArchiveDir = new File(archiveDir, archiveName);
		if (moduleArchiveDir.exists()) {
			log.warn("Archive directory already exists: {}", moduleArchiveDir);
		} else {
			moduleArchiveDir.mkdirs();
		}

		addModuleAppender();
		log.info("Started archiving: (module={}, moduleArchiveDir={})", moduleMetaData.getModuleName(), moduleArchiveDir);
	}
380766
def channels_archive(self, room_id, **kwargs):
        """"""
        return self.__call_api_post('channels.archive', roomId=room_id, kwargs=kwargs)
1229618
def create_gzip (archive, compression, cmd, verbosity, interactive, filenames):
    """"""
    if len(filenames) > 1:
        raise util.PatoolError('multi-file compression not supported in Python gzip')
    try:
        with gzip.GzipFile(archive, 'wb') as gzipfile:
            filename = filenames[0]
            with open(filename, 'rb') as srcfile:
                data = srcfile.read(READ_SIZE_BYTES)
                while data:
                    gzipfile.write(data)
                    data = srcfile.read(READ_SIZE_BYTES)
    except Exception as err:
        msg = "error creating %s: %s" % (archive, err)
        raise util.PatoolError(msg)
    return None
1280103
def __populate_archive_files(self):
        """"""
        self.archive_files = []
        for _ptr in _bfd.archive_list_files(self._ptr):
            try:
                self.archive_files.append(Bfd(_ptr))
            except BfdException, err:
                #print "Error populating archive file list : %s" % err
                #print_exc()
                pass