2323// metadata, as well as generating the md5sums file. Currently we do not
2424// generate postinst or prerm files.
2525
26- use super :: { super :: common , freedesktop} ;
27- use crate :: { bundle:: settings:: Arch , Settings } ;
26+ use super :: freedesktop;
27+ use crate :: { bundle:: settings:: Arch , utils :: fs_utils , Settings } ;
2828use anyhow:: Context ;
2929use flate2:: { write:: GzEncoder , Compression } ;
3030use tar:: HeaderMode ;
@@ -73,7 +73,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
7373
7474 let ( data_dir, _) = generate_data ( settings, & package_dir)
7575 . with_context ( || "Failed to build data folders and files" ) ?;
76- common :: copy_custom_files ( & settings. deb ( ) . files , & data_dir)
76+ fs_utils :: copy_custom_files ( & settings. deb ( ) . files , & data_dir)
7777 . with_context ( || "Failed to copy custom files" ) ?;
7878
7979 // Generate control files.
@@ -113,7 +113,7 @@ pub fn generate_data(
113113
114114 for bin in settings. binaries ( ) {
115115 let bin_path = settings. binary_path ( bin) ;
116- common :: copy_file ( & bin_path, bin_dir. join ( bin. name ( ) ) )
116+ fs_utils :: copy_file ( & bin_path, & bin_dir. join ( bin. name ( ) ) )
117117 . with_context ( || format ! ( "Failed to copy binary from {bin_path:?}" ) ) ?;
118118 }
119119
@@ -141,7 +141,7 @@ fn generate_changelog_file(settings: &Settings, data_dir: &Path) -> crate::Resul
141141 let product_name = settings. product_name ( ) ;
142142 let dest_path = data_dir. join ( format ! ( "usr/share/doc/{product_name}/changelog.gz" ) ) ;
143143
144- let changelog_file = common :: create_file ( & dest_path) ?;
144+ let changelog_file = fs_utils :: create_file ( & dest_path) ?;
145145 let mut gzip_encoder = GzEncoder :: new ( changelog_file, Compression :: new ( 9 ) ) ;
146146 io:: copy ( & mut src_file, & mut gzip_encoder) ?;
147147
@@ -161,7 +161,7 @@ fn generate_control_file(
161161 // For more information about the format of this file, see
162162 // https://www.debian.org/doc/debian-policy/ch-controlfields.html
163163 let dest_path = control_dir. join ( "control" ) ;
164- let mut file = common :: create_file ( & dest_path) ?;
164+ let mut file = fs_utils :: create_file ( & dest_path) ?;
165165 let package = heck:: AsKebabCase ( settings. product_name ( ) ) ;
166166 writeln ! ( file, "Package: {}" , package) ?;
167167 writeln ! ( file, "Version: {}" , settings. version_string( ) ) ?;
@@ -294,7 +294,7 @@ fn create_script_file_from_path(from: &PathBuf, to: &PathBuf) -> crate::Result<(
294294/// for each file within the `data_dir`.
295295fn generate_md5sums ( control_dir : & Path , data_dir : & Path ) -> crate :: Result < ( ) > {
296296 let md5sums_path = control_dir. join ( "md5sums" ) ;
297- let mut md5sums_file = common :: create_file ( & md5sums_path) ?;
297+ let mut md5sums_file = fs_utils :: create_file ( & md5sums_path) ?;
298298 for entry in WalkDir :: new ( data_dir) {
299299 let entry = entry?;
300300 let path = entry. path ( ) ;
@@ -327,7 +327,7 @@ fn copy_resource_files(settings: &Settings, data_dir: &Path) -> crate::Result<()
327327/// Create an empty file at the given path, creating any parent directories as
328328/// needed, then write `data` into the file.
329329fn create_file_with_data < P : AsRef < Path > > ( path : P , data : & str ) -> crate :: Result < ( ) > {
330- let mut file = common :: create_file ( path. as_ref ( ) ) ?;
330+ let mut file = fs_utils :: create_file ( path. as_ref ( ) ) ?;
331331 file. write_all ( data. as_bytes ( ) ) ?;
332332 file. flush ( ) ?;
333333 Ok ( ( ) )
@@ -376,7 +376,7 @@ fn create_tar_from_dir<P: AsRef<Path>, W: Write>(src_dir: P, dest_file: W) -> cr
376376fn tar_and_gzip_dir < P : AsRef < Path > > ( src_dir : P ) -> crate :: Result < PathBuf > {
377377 let src_dir = src_dir. as_ref ( ) ;
378378 let dest_path = src_dir. with_extension ( "tar.gz" ) ;
379- let dest_file = common :: create_file ( & dest_path) ?;
379+ let dest_file = fs_utils :: create_file ( & dest_path) ?;
380380 let gzip_encoder = GzEncoder :: new ( dest_file, Compression :: default ( ) ) ;
381381 let gzip_encoder = create_tar_from_dir ( src_dir, gzip_encoder) ?;
382382 let mut dest_file = gzip_encoder. finish ( ) ?;
@@ -387,7 +387,7 @@ fn tar_and_gzip_dir<P: AsRef<Path>>(src_dir: P) -> crate::Result<PathBuf> {
387387/// Creates an `ar` archive from the given source files and writes it to the
388388/// given destination path.
389389fn create_archive ( srcs : Vec < PathBuf > , dest : & Path ) -> crate :: Result < ( ) > {
390- let mut builder = ar:: Builder :: new ( common :: create_file ( dest) ?) ;
390+ let mut builder = ar:: Builder :: new ( fs_utils :: create_file ( dest) ?) ;
391391 for path in & srcs {
392392 builder. append_path ( path) ?;
393393 }
0 commit comments