11use crate :: command:: Command ;
22use crate :: settings:: Settings ;
3+ use crate :: setup:: DEF_PACKAGES ;
34use crate :: utils:: _parse_key_value;
45use crate :: { parse_key_value, utils} ;
56
@@ -34,6 +35,7 @@ impl Builder {
3435 }
3536
3637 let mut cmd_args = Vec :: new ( ) ;
38+ let mut concat_args = Vec :: new ( ) ;
3739 let mut apkbuild_file = String :: new ( ) ;
3840
3941 let sett = Settings :: load_or_create ( ) ;
@@ -87,6 +89,8 @@ impl Builder {
8789 fs:: copy ( apkbuild_file. clone ( ) , & dest_file) ?;
8890
8991 Self :: run_abuild ( rootfs_dir. clone ( ) , dir_name) ?;
92+ } else if file_path. is_dir ( ) {
93+ concat_args. push ( apkbuild_file) ;
9094 } else {
9195 eprintln ! (
9296 "\x1b [1;33mWarning\x1b [0m: Invalid file: {}, expected 'APKBUILD'" ,
@@ -101,7 +105,9 @@ impl Builder {
101105 }
102106 }
103107
104- for p in cmd_args {
108+ concat_args. extend ( cmd_args) ;
109+
110+ for p in concat_args {
105111 let path = Path :: new ( & p) ;
106112 let ( pkg_name, mut dir_name) : ( String , String ) ;
107113 let mut copy_only_apkbuild = false ;
@@ -210,15 +216,16 @@ impl Builder {
210216 fn run_abuild ( rootfs : String , dir_name : String ) -> Result < ( ) , Box < dyn Error > > {
211217 let cmd = format ! (
212218 "
213- type abuild > /dev/null || apk add alpine-sdk autoconf automake
219+ type abuild > /dev/null || apk add {a}
214220 HOME=/build
215221 test -f /etc/apk/keys/{u}*.rsa.pub && exit
216222 rm -rf /build/.abuild
217223 mkdir -p /build
218224 abuild-keygen -a -n
219225 cp -v /build/.abuild/{u}*.rsa.pub /etc/apk/keys/
220- " ,
221- u = env:: var( "USER" ) . unwrap( )
226+ " ,
227+ u = env:: var( "USER" ) . unwrap( ) ,
228+ a = DEF_PACKAGES
222229 ) ;
223230
224231 Command :: run ( rootfs. clone ( ) , None , Some ( cmd) , false , false , false ) ?;
0 commit comments