]> git.tdb.fi Git - builder.git/commitdiff
Add a command line option to specify package search directories
authorMikko Rasa <tdb@tdb.fi>
Mon, 24 Apr 2023 04:12:04 +0000 (21:12 -0700)
committerMikko Rasa <tdb@tdb.fi>
Mon, 24 Apr 2023 04:12:04 +0000 (21:12 -0700)
source/cli/buildercli.cpp

index 5741fa6a265943f92ef4f0a20865006bffae9906..cfd367c9eeca01a021a8b0fa933de5641dd592c6 100644 (file)
@@ -29,6 +29,7 @@ BuilderCLI::BuilderCLI(int argc, char **argv):
        bool silent = false;
        vector<string> log_channels;
        string build_type;
+       vector<string> package_path;
 
        GetOpt getopt;
        getopt.add_option('a', "analyze",    analyze_mode,  GetOpt::REQUIRED_ARG).set_help("Perform dependency analysis.", "MODE");
@@ -46,6 +47,7 @@ BuilderCLI::BuilderCLI(int argc, char **argv):
        getopt.add_option('A', "conf-all",   conf_all,      GetOpt::NO_ARG).set_help("Apply configuration to all packages.");
        getopt.add_option('B', "build-all",  build_all,     GetOpt::NO_ARG).set_help("Build all targets unconditionally.");
        getopt.add_option('C', "chdir",      work_dir,      GetOpt::REQUIRED_ARG).set_help("Change to DIR before doing anything else.", "DIR");
+       getopt.add_option('I', "package-dir",package_path,  GetOpt::REQUIRED_ARG).set_help("Additional directory containing packages.", "DIR");
        getopt.add_option('P', "progress",   show_progress, GetOpt::NO_ARG).set_help("Display progress while building.");
        getopt.add_option('W', "what-if",    what_if,       GetOpt::REQUIRED_ARG).set_help("Pretend that FILE has changed.", "FILE");
        getopt.add_option(     "arch",       arch,          GetOpt::REQUIRED_ARG).set_help("Build for architecture ARCH.", "ARCH");
@@ -119,6 +121,8 @@ BuilderCLI::BuilderCLI(int argc, char **argv):
 
        package_manager.append_package_path(cwd);
        package_manager.append_package_path(cwd/"..");
+       for(const string &p: package_path)
+               package_manager.append_package_path(cwd/p);
        package_manager.append_binary_package_path(FS::get_sys_data_dir()/"packages");
 
        package_manager.set_no_externals(no_externals);