fn into_config(
        mut self,
        root_package: &CargoMetadataPackage,
        manifest_dir: &Path,
        deb_output_path: Option<String>,
        target_dir: &Path,
        target: Option<&str>,
        variant: Option<&str>,
        deb_version: Option<String>,
        listener: &dyn Listener,
    ) -> CDResult<Config> {
        // Cargo cross-compiles to a dir
        let target_dir = if let Some(target) = target {
            target_dir.join(target)
        } else {
            target_dir.to_owned()
        };

        // If we build against a variant use that config and change the package name
        let mut deb = if let Some(variant) = variant {
            // Use dash as underscore is not allowed in package names
            self.package.name = format!("{}-{}", self.package.name, variant);
            let mut deb = self.package
                .metadata
                .take()
                .and_then(|m| m.deb)
                .unwrap_or_else(CargoDeb::default);
            let variant = deb.variants
                .as_mut()
                .and_then(|v| v.remove(variant))
                .ok_or(CargoDebError::VariantNotFound(variant.to_string()))?;
            variant.inherit_from(deb)
        } else {
            self.package
                .metadata
                .take()
                .and_then(|m| m.deb)
                .unwrap_or_else(CargoDeb::default)
        };

        let (license_file, license_file_skip_lines) = self.license_file(deb.license_file.as_ref())?;
        let readme = self.package.readme.as_ref();
        self.check_config(manifest_dir, readme, &deb, listener);
        let mut config = Config {
            manifest_dir: manifest_dir.to_owned(),
            deb_output_path,
            target: target.map(|t| t.to_string()),
            target_dir,
            name: self.package.name.clone(),
            deb_name: deb.name.take().unwrap_or(self.package.name.clone()),
            deb_version: deb_version.unwrap_or(self.version_string(deb.revision)),
            license: self.package.license.take(),
            license_file,
            license_file_skip_lines,
            copyright: deb.copyright.take().ok_or_then(|| {
                if self.package.authors.is_empty() {
                    Err("The package must have a copyright or authors property")?;
                }
                Ok(self.package.authors.join(", "))
            })?,
            homepage: self.package.homepage.clone(),
            documentation: self.package.documentation.clone(),
            repository: self.package.repository.take(),
            description: self.package.description.take().unwrap_or_else(||format!("[generated from Rust crate {}]", self.package.name)),
            extended_description: self.extended_description(
                deb.extended_description.take(),
                deb.extended_description_file.as_ref().or(readme))?,
            maintainer: deb.maintainer.take().ok_or_then(|| {
                Ok(self.package.authors.get(0)
                    .ok_or("The package must have a maintainer or authors property")?.to_owned())
            })?,
            depends: deb.depends.take().unwrap_or_else(|| "$auto".to_owned()),
            build_depends: deb.build_depends.take(),
            conflicts: deb.conflicts.take(),
            breaks: deb.breaks.take(),
            replaces: deb.replaces.take(),
            provides: deb.provides.take(),
            section: deb.section.take(),
            priority: deb.priority.take().unwrap_or("optional".to_owned()),
            architecture: get_arch(target.unwrap_or(crate::DEFAULT_TARGET)).to_owned(),
            conf_files: deb.conf_files.map(|x| x.iter().fold(String::new(), |a, b| a + b + "\n")),
            assets: Assets::new(),
            triggers_file: deb.triggers_file.map(PathBuf::from),
            changelog: deb.changelog.take(),
            maintainer_scripts: deb.maintainer_scripts.map(PathBuf::from),
            features: deb.features.take().unwrap_or_default(),
            default_features: deb.default_features.unwrap_or(true),
            separate_debug_symbols: deb.separate_debug_symbols.unwrap_or(false),
            strip: self.profile.as_ref().and_then(|p|p.release.as_ref())
                .and_then(|r| r.debug.as_ref())
                .map_or(true, |debug| match *debug {
                    toml::Value::Integer(0) => false,
                    toml::Value::Boolean(value) => value,
                    _ => true
                }),
            preserve_symlinks: deb.preserve_symlinks.unwrap_or(false),
            _use_constructor_to_make_this_struct_: (),
        };
        let assets = self.take_assets(&config, deb.assets.take(), &root_package.targets, readme)?;
        if assets.is_empty() {
            Err("No binaries or cdylibs found. The package is empty. Please specify some assets to package in Cargo.toml")?;
        }
        config.assets = assets;
        config.add_copyright_asset()?;
        config.add_changelog_asset()?;

        Ok(config)
    }
/// Convert Cargo.toml/metadata information into internal configu structure
///
/// **IMPORTANT**: This function must not create or expect to see any files on disk!
/// It's run before destination directory is cleaned up, and before the build start!
///
Convert Cargo.toml/metadata information into internal configu structure
IMPORTANT**: This function must not create or expect to see any files on disk.
It's run before destination directory is cleaned up, and before the build start!
Convert Cargo . toml / metadata information into internal configu structure IMPORTANT ** : This function must not create or expect to see any files on disk . It ' s run before destination directory is cleaned up and before the build start!
fn into_config(
        mut self,
        root_package: &CargoMetadataPackage,
        manifest_dir: &Path,
        deb_output_path: Option<String>,
        target_dir: &Path,
        target: Option<&str>,
        variant: Option<&str>,
        deb_version: Option<String>,
        listener: &dyn Listener,
    ) -> CDResult<Config> {
        // Cargo cross-compiles to a dir
        let target_dir = if let Some(target) = target {
            target_dir.join(target)
        } else {
            target_dir.to_owned()
        };
        // If we build against a variant use that config and change the package name
        let mut deb = if let Some(variant) = variant {
            // Use dash as underscore is not allowed in package names
            self.package.name = format!("{}-{}", self.package.name, variant);
            let mut deb = self.package
                .metadata
                .take()
                .and_then(|m| m.deb)
                .unwrap_or_else(CargoDeb::default);
            let variant = deb.variants
                .as_mut()
                .and_then(|v| v.remove(variant))
                .ok_or(CargoDebError::VariantNotFound(variant.to_string()))?;
            variant.inherit_from(deb)
        } else {
            self.package
                .metadata
                .take()
                .and_then(|m| m.deb)
                .unwrap_or_else(CargoDeb::default)
        };
        let (license_file, license_file_skip_lines) = self.license_file(deb.license_file.as_ref())?;
        let readme = self.package.readme.as_ref();
        self.check_config(manifest_dir, readme, &deb, listener);
        let mut config = Config {
            manifest_dir: manifest_dir.to_owned(),
            deb_output_path,
            target: target.map(|t| t.to_string()),
            target_dir,
            name: self.package.name.clone(),
            deb_name: deb.name.take().unwrap_or(self.package.name.clone()),
            deb_version: deb_version.unwrap_or(self.version_string(deb.revision)),
            license: self.package.license.take(),
            license_file,
            license_file_skip_lines,
            copyright: deb.copyright.take().ok_or_then(|| {
                if self.package.authors.is_empty() {
                    Err("The package must have a copyright or authors property")?;
                }
                Ok(self.package.authors.join(", "))
            })?,
            homepage: self.package.homepage.clone(),
            documentation: self.package.documentation.clone(),
            repository: self.package.repository.take(),
            description: self.package.description.take().unwrap_or_else(||format!("[generated from Rust crate {}]", self.package.name)),
            extended_description: self.extended_description(
                deb.extended_description.take(),
                deb.extended_description_file.as_ref().or(readme))?,
            maintainer: deb.maintainer.take().ok_or_then(|| {
                Ok(self.package.authors.get(0)
                    .ok_or("The package must have a maintainer or authors property")?.to_owned())
            })?,
            depends: deb.depends.take().unwrap_or_else(|| "$auto".to_owned()),
            build_depends: deb.build_depends.take(),
            conflicts: deb.conflicts.take(),
            breaks: deb.breaks.take(),
            replaces: deb.replaces.take(),
            provides: deb.provides.take(),
            section: deb.section.take(),
            priority: deb.priority.take().unwrap_or("optional".to_owned()),
            architecture: get_arch(target.unwrap_or(crate::DEFAULT_TARGET)).to_owned(),
            conf_files: deb.conf_files.map(|x| x.iter().fold(String::new(), |a, b| a + b + "\n")),
            assets: Assets::new(),
            triggers_file: deb.triggers_file.map(PathBuf::from),
            changelog: deb.changelog.take(),
            maintainer_scripts: deb.maintainer_scripts.map(PathBuf::from),
            features: deb.features.take().unwrap_or_default(),
            default_features: deb.default_features.unwrap_or(true),
            separate_debug_symbols: deb.separate_debug_symbols.unwrap_or(false),
            strip: self.profile.as_ref().and_then(|p|p.release.as_ref())
                .and_then(|r| r.debug.as_ref())
                .map_or(true, |debug| match *debug {
                    toml::Value::Integer(0) => false,
                    toml::Value::Boolean(value) => value,
                    _ => true
                }),
            preserve_symlinks: deb.preserve_symlinks.unwrap_or(false),
            _use_constructor_to_make_this_struct_: (),
        };
        let assets = self.take_assets(&config, deb.assets.take(), &root_package.targets, readme)?;
        if assets.is_empty() {
            Err("No binaries or cdylibs found. The package is empty. Please specify some assets to package in Cargo.toml")?;
        }
        config.assets = assets;
        config.add_copyright_asset()?;
        config.add_changelog_asset()?;
        Ok(config)
    }
fn into_config ( mut self , root_package : & CargoMetadataPackage , manifest_dir : & Path , deb_output_path : Option < String > , target_dir : & Path , target : Option < & str > , variant : Option < & str > , deb_version : Option < String > , listener : & dyn Listener , ) -> CDResult < Config > { // Cargo cross-compiles to a dir let target_dir = if let Some ( target ) = target { target_dir . join ( target ) } else { target_dir . to_owned ( ) } ; // If we build against a variant use that config and change the package name let mut deb = if let Some ( variant ) = variant { // Use dash as underscore is not allowed in package names self . package . name = format ! ( " " self package name variant ) ; let mut deb = self . package . metadata . take ( ) . and_then ( | m | m . deb ) . unwrap_or_else ( CargoDeb :: default ) ; let variant = deb . variants . as_mut ( ) . and_then ( | v | v . remove ( variant ) ) . ok_or ( CargoDebError :: VariantNotFound ( variant . to_string ( ) ) ) ? ; variant . inherit_from ( deb ) } else { self . package . metadata . take ( ) . and_then ( | m | m . deb ) . unwrap_or_else ( CargoDeb :: default ) } ; let ( license_file , license_file_skip_lines ) = self . license_file ( deb . license_file . as_ref ( ) ) ? ; let readme = self . package . readme . as_ref ( ) ; self . check_config ( manifest_dir , readme , & deb , listener ) ; let mut config = Config { manifest_dir : manifest_dir . to_owned ( ) , deb_output_path , target : target . map ( | t | t . to_string ( ) ) , target_dir , name : self . package . name . clone ( ) , deb_name : deb . name . take ( ) . unwrap_or ( self . package . name . clone ( ) ) , deb_version : deb_version . unwrap_or ( self . version_string ( deb . revision ) ) , license : self . package . license . take ( ) , license_file , license_file_skip_lines , copyright : deb . copyright . take ( ) . ok_or_then ( | | { if self . package . authors . is_empty ( ) { Err ( " " ) ? ; } Ok ( self . package . authors . join ( " " ) ) } ) ? , homepage : self . package . homepage . clone ( ) , documentation : self . package . documentation . clone ( ) , repository : self . package . repository . take ( ) , description : self . package . description . take ( ) . unwrap_or_else ( | | format ! ( " " self package name ) ) , extended_description : self . extended_description ( deb . extended_description . take ( ) , deb . extended_description_file . as_ref ( ) . or ( readme ) ) ? , maintainer : deb . maintainer . take ( ) . ok_or_then ( | | { Ok ( self . package . authors . get ( 0 ) . ok_or ( " " ) ? . to_owned ( ) ) } ) ? , depends : deb . depends . take ( ) . unwrap_or_else ( | | " " . to_owned ( ) ) , build_depends : deb . build_depends . take ( ) , conflicts : deb . conflicts . take ( ) , breaks : deb . breaks . take ( ) , replaces : deb . replaces . take ( ) , provides : deb . provides . take ( ) , section : deb . section . take ( ) , priority : deb . priority . take ( ) . unwrap_or ( " " . to_owned ( ) ) , architecture : get_arch ( target . unwrap_or ( crate :: DEFAULT_TARGET ) ) . to_owned ( ) , conf_files : deb . conf_files . map ( | x | x . iter ( ) . fold ( String :: new ( ) , | a , b | a + b + " \n " ) ) , assets : Assets :: new ( ) , triggers_file : deb . triggers_file . map ( PathBuf :: from ) , changelog : deb . changelog . take ( ) , maintainer_scripts : deb . maintainer_scripts . map ( PathBuf :: from ) , features : deb . features . take ( ) . unwrap_or_default ( ) , default_features : deb . default_features . unwrap_or ( true ) , separate_debug_symbols : deb . separate_debug_symbols . unwrap_or ( false ) , strip : self . profile . as_ref ( ) . and_then ( | p | p . release . as_ref ( ) ) . and_then ( | r | r . debug . as_ref ( ) ) . map_or ( true , | debug | match * debug { toml :: Value :: Integer ( 0 ) => false , toml :: Value :: Boolean ( value ) => value , _ => true } ) , preserve_symlinks : deb . preserve_symlinks . unwrap_or ( false ) , _use_constructor_to_make_this_struct_ : ( ) , } ; let assets = self . take_assets ( & config , deb . assets . take ( ) , & root_package . targets , readme ) ? ; if assets . is_empty ( ) { Err ( " " ) ? ; } config . assets = assets ; config . add_copyright_asset ( ) ? ; config . add_changelog_asset ( ) ? ; Ok ( config ) }
Convert Cargo.toml/metadata information into internal configu structure
IMPORTANT**: This function must not create or expect to see any files on disk!
Convert Cargo . toml / metadata information into internal configu structure IMPORTANT ** : This function must not create or expect to see any files on disk!
mut self
root_package
&CargoMetadataPackage
manifest_dir
&Path
deb_output_path
Option<String>
target_dir
&Path
target
Option<&str>
variant
Option<&str>
deb_version
Option<String>
listener
&dyn Listener
mut self
root_package
&CargoMetadataPackage
manifest_dir
&Path
deb_output_path
Option<String>
target_dir
&Path
target
Option<&str>
variant
Option<&str>
deb_version
Option<String>
listener
&dyn Listener