fleshing out stage creation
							parent
							
								
									4c15eb07db
								
							
						
					
					
						commit
						b034a3679d
					
				| 
						 | 
				
			
			@ -16,6 +16,7 @@ add_library(build MODULE
 | 
			
		|||
        src/helpers.cpp
 | 
			
		||||
        src/cli_parsers.cpp
 | 
			
		||||
        src/commands.cpp
 | 
			
		||||
        src/package_staging.cpp
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
# Set output properties
 | 
			
		||||
| 
						 | 
				
			
			@ -40,6 +41,7 @@ add_executable(build_standalone
 | 
			
		|||
        src/helpers.cpp
 | 
			
		||||
        src/cli_parsers.cpp
 | 
			
		||||
        src/commands.cpp
 | 
			
		||||
        src/package_staging.cpp
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
# Define the BUILD_STANDALONE macro for the standalone build
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
#include "cli_parsers.hpp"
 | 
			
		||||
#include <dpmdk/include/CommonModuleAPI.hpp>
 | 
			
		||||
#include <filesystem>
 | 
			
		||||
#include "package_staging.hpp"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Handler for the stage command
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ int parse_create_options(int argc, char** argv, BuildOptions& options) {
 | 
			
		|||
            std::string option = arg.substr(0, equals_pos);
 | 
			
		||||
            std::string value = arg.substr(equals_pos + 1);
 | 
			
		||||
 | 
			
		||||
            if (option == "--output-dir") {
 | 
			
		||||
            if (option == "--output") {
 | 
			
		||||
                options.output_dir = value;
 | 
			
		||||
                output_dir_provided = true;
 | 
			
		||||
            } else if (option == "--contents") {
 | 
			
		||||
| 
						 | 
				
			
			@ -82,7 +82,7 @@ int parse_create_options(int argc, char** argv, BuildOptions& options) {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    static struct option long_options[] = {
 | 
			
		||||
        {"output-dir", required_argument, 0, 'o'},
 | 
			
		||||
        {"output", required_argument, 0, 'o'},
 | 
			
		||||
        {"contents", required_argument, 0, 'c'},
 | 
			
		||||
        {"hooks", required_argument, 0, 'H'},
 | 
			
		||||
        {"name", required_argument, 0, 'n'},
 | 
			
		||||
| 
						 | 
				
			
			@ -254,6 +254,18 @@ int validate_build_options(const BuildOptions& options) {
 | 
			
		|||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Check if output directory is provided
 | 
			
		||||
    if (options.output_dir.empty()) {
 | 
			
		||||
        dpm_log(LOG_ERROR, "Output directory is required (--output)");
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Check if output directory exists
 | 
			
		||||
    if (!std::filesystem::exists(options.output_dir)) {
 | 
			
		||||
        dpm_log(LOG_ERROR, ("Output directory does not exist: " + options.output_dir).c_str());
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Check if contents directory is provided and exists
 | 
			
		||||
    if (options.contents_dir.empty()) {
 | 
			
		||||
        dpm_log(LOG_ERROR, "Contents directory is required (--contents)");
 | 
			
		||||
| 
						 | 
				
			
			@ -289,11 +301,5 @@ int validate_build_options(const BuildOptions& options) {
 | 
			
		|||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Check if output directory exists
 | 
			
		||||
    if (!std::filesystem::exists(options.output_dir)) {
 | 
			
		||||
        dpm_log(LOG_ERROR, ("Output directory does not exist: " + options.output_dir).c_str());
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
#include "commands.hpp"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cmd_stage(int argc, char** argv) {
 | 
			
		||||
    // Announce that the stage step is being executed (debug level)
 | 
			
		||||
    dpm_log(LOG_DEBUG, "Executing stage command");
 | 
			
		||||
| 
						 | 
				
			
			@ -62,11 +63,17 @@ int cmd_stage(int argc, char** argv) {
 | 
			
		|||
        dpm_log(LOG_DEBUG, "  Force: Yes");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Standard info logs that are always visible
 | 
			
		||||
    dpm_log(LOG_INFO, "Package staging functionality not yet implemented");
 | 
			
		||||
    dpm_log(LOG_INFO, "Would stage package directory using the provided options");
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
    // Call the build_package_stage function with individual parameters
 | 
			
		||||
    return build_package_stage(
 | 
			
		||||
        options.output_dir,
 | 
			
		||||
        options.contents_dir,
 | 
			
		||||
        options.hooks_dir,
 | 
			
		||||
        options.package_name,
 | 
			
		||||
        options.package_version,
 | 
			
		||||
        options.architecture,
 | 
			
		||||
        options.os,
 | 
			
		||||
        options.force
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int cmd_help(int argc, char** argv) {
 | 
			
		||||
| 
						 | 
				
			
			@ -91,11 +98,12 @@ int cmd_unknown(const char* command, int argc, char** argv) {
 | 
			
		|||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cmd_stage_help(int argc, char** argv) {
 | 
			
		||||
    dpm_log(LOG_INFO, "Usage: dpm build stage [options]");
 | 
			
		||||
    dpm_log(LOG_INFO, "");
 | 
			
		||||
    dpm_log(LOG_INFO, "Options:");
 | 
			
		||||
    dpm_log(LOG_INFO, "  -o, --output-dir DIR       Directory to save the staged package (required)");
 | 
			
		||||
    dpm_log(LOG_INFO, "  -o, --output DIR           Directory to save the staged package (required)");
 | 
			
		||||
    dpm_log(LOG_INFO, "  -c, --contents DIR         Directory with package contents (required)");
 | 
			
		||||
    dpm_log(LOG_INFO, "  -H, --hooks DIR            Directory with package hooks (optional)");
 | 
			
		||||
    dpm_log(LOG_INFO, "  -n, --name NAME            Package name (required)");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue