deferring signing to a dedicated module
							parent
							
								
									576ffd5a76
								
							
						
					
					
						commit
						1a97621a53
					
				| 
						 | 
					@ -27,7 +27,6 @@ struct BuildOptions {
 | 
				
			||||||
    std::string metadata_dir;      /**< Directory with package metadata */
 | 
					    std::string metadata_dir;      /**< Directory with package metadata */
 | 
				
			||||||
    std::string hooks_dir;         /**< Directory with package hooks */
 | 
					    std::string hooks_dir;         /**< Directory with package hooks */
 | 
				
			||||||
    std::string package_name;      /**< Name of the package to build */
 | 
					    std::string package_name;      /**< Name of the package to build */
 | 
				
			||||||
    std::string signature_key;     /**< Path to the GPG key for signing the package */
 | 
					 | 
				
			||||||
    bool force;                    /**< Flag to force package creation even if warnings occur */
 | 
					    bool force;                    /**< Flag to force package creation even if warnings occur */
 | 
				
			||||||
    bool verbose;                  /**< Flag for verbose output */
 | 
					    bool verbose;                  /**< Flag for verbose output */
 | 
				
			||||||
    bool show_help;                /**< Flag to show help information */
 | 
					    bool show_help;                /**< Flag to show help information */
 | 
				
			||||||
| 
						 | 
					@ -39,7 +38,6 @@ struct BuildOptions {
 | 
				
			||||||
        metadata_dir(""),
 | 
					        metadata_dir(""),
 | 
				
			||||||
        hooks_dir(""),
 | 
					        hooks_dir(""),
 | 
				
			||||||
        package_name(""),
 | 
					        package_name(""),
 | 
				
			||||||
        signature_key(""),
 | 
					 | 
				
			||||||
        force(false),
 | 
					        force(false),
 | 
				
			||||||
        verbose(false),
 | 
					        verbose(false),
 | 
				
			||||||
        show_help(false) {}
 | 
					        show_help(false) {}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,8 +30,6 @@ int parse_create_options(int argc, char** argv, BuildOptions& options) {
 | 
				
			||||||
                options.hooks_dir = value;
 | 
					                options.hooks_dir = value;
 | 
				
			||||||
            } else if (option == "--name") {
 | 
					            } else if (option == "--name") {
 | 
				
			||||||
                options.package_name = value;
 | 
					                options.package_name = value;
 | 
				
			||||||
            } else if (option == "--sign") {
 | 
					 | 
				
			||||||
                options.signature_key = value;
 | 
					 | 
				
			||||||
            } else if (option == "--force") {
 | 
					            } else if (option == "--force") {
 | 
				
			||||||
                options.force = true;
 | 
					                options.force = true;
 | 
				
			||||||
            } else if (option == "--verbose") {
 | 
					            } else if (option == "--verbose") {
 | 
				
			||||||
| 
						 | 
					@ -51,7 +49,6 @@ int parse_create_options(int argc, char** argv, BuildOptions& options) {
 | 
				
			||||||
        {"metadata", required_argument, 0, 'm'},
 | 
					        {"metadata", required_argument, 0, 'm'},
 | 
				
			||||||
        {"hooks", required_argument, 0, 'H'},
 | 
					        {"hooks", required_argument, 0, 'H'},
 | 
				
			||||||
        {"name", required_argument, 0, 'n'},
 | 
					        {"name", required_argument, 0, 'n'},
 | 
				
			||||||
        {"sign", required_argument, 0, 's'},
 | 
					 | 
				
			||||||
        {"force", no_argument, 0, 'f'},
 | 
					        {"force", no_argument, 0, 'f'},
 | 
				
			||||||
        {"verbose", no_argument, 0, 'v'},
 | 
					        {"verbose", no_argument, 0, 'v'},
 | 
				
			||||||
        {"help", no_argument, 0, 'h'},
 | 
					        {"help", no_argument, 0, 'h'},
 | 
				
			||||||
| 
						 | 
					@ -66,7 +63,7 @@ int parse_create_options(int argc, char** argv, BuildOptions& options) {
 | 
				
			||||||
    int opt;
 | 
					    int opt;
 | 
				
			||||||
    int option_index = 0;
 | 
					    int option_index = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while ((opt = getopt_long(argc, argv, "o:c:m:H:n:s:fvh", long_options, &option_index)) != -1) {
 | 
					    while ((opt = getopt_long(argc, argv, "o:c:m:H:n:fvh", long_options, &option_index)) != -1) {
 | 
				
			||||||
        switch (opt) {
 | 
					        switch (opt) {
 | 
				
			||||||
            case 'o':
 | 
					            case 'o':
 | 
				
			||||||
                options.output_dir = optarg;
 | 
					                options.output_dir = optarg;
 | 
				
			||||||
| 
						 | 
					@ -83,9 +80,6 @@ int parse_create_options(int argc, char** argv, BuildOptions& options) {
 | 
				
			||||||
            case 'n':
 | 
					            case 'n':
 | 
				
			||||||
                options.package_name = optarg;
 | 
					                options.package_name = optarg;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case 's':
 | 
					 | 
				
			||||||
                options.signature_key = optarg;
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case 'f':
 | 
					            case 'f':
 | 
				
			||||||
                options.force = true;
 | 
					                options.force = true;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
| 
						 | 
					@ -120,10 +114,6 @@ int parse_create_options(int argc, char** argv, BuildOptions& options) {
 | 
				
			||||||
        options.hooks_dir = expand_path(options.hooks_dir);
 | 
					        options.hooks_dir = expand_path(options.hooks_dir);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!options.signature_key.empty()) {
 | 
					 | 
				
			||||||
        options.signature_key = expand_path(options.signature_key);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Log the parsed options for debugging
 | 
					    // Log the parsed options for debugging
 | 
				
			||||||
    dpm_log(LOG_DEBUG, ("Parsed options: contents_dir=" + options.contents_dir).c_str());
 | 
					    dpm_log(LOG_DEBUG, ("Parsed options: contents_dir=" + options.contents_dir).c_str());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,11 +174,5 @@ int validate_build_options(const BuildOptions& options) {
 | 
				
			||||||
        return 1;
 | 
					        return 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Check if signature key exists if provided
 | 
					 | 
				
			||||||
    if (!options.signature_key.empty() && !std::filesystem::exists(options.signature_key)) {
 | 
					 | 
				
			||||||
        dpm_log(LOG_ERROR, ("Signature key file does not exist: " + options.signature_key).c_str());
 | 
					 | 
				
			||||||
        return 1;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -36,10 +36,6 @@ int cmd_create(int argc, char** argv) {
 | 
				
			||||||
            dpm_log(LOG_INFO, ("  Package name: " + options.package_name).c_str());
 | 
					            dpm_log(LOG_INFO, ("  Package name: " + options.package_name).c_str());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!options.signature_key.empty()) {
 | 
					 | 
				
			||||||
            dpm_log(LOG_INFO, ("  Signature key: " + options.signature_key).c_str());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (options.force) {
 | 
					        if (options.force) {
 | 
				
			||||||
            dpm_log(LOG_INFO, "  Force: Yes");
 | 
					            dpm_log(LOG_INFO, "  Force: Yes");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -65,7 +61,6 @@ int cmd_help(int argc, char** argv) {
 | 
				
			||||||
    dpm_log(LOG_INFO, "  -m, --metadata DIR      Directory with package metadata (required)");
 | 
					    dpm_log(LOG_INFO, "  -m, --metadata DIR      Directory with package metadata (required)");
 | 
				
			||||||
    dpm_log(LOG_INFO, "  -H, --hooks DIR         Directory with package hooks (optional)");
 | 
					    dpm_log(LOG_INFO, "  -H, --hooks DIR         Directory with package hooks (optional)");
 | 
				
			||||||
    dpm_log(LOG_INFO, "  -n, --name NAME         Package name (required if not in metadata)");
 | 
					    dpm_log(LOG_INFO, "  -n, --name NAME         Package name (required if not in metadata)");
 | 
				
			||||||
    dpm_log(LOG_INFO, "  -s, --sign KEY          Path to GPG key for signing the package (optional)");
 | 
					 | 
				
			||||||
    dpm_log(LOG_INFO, "  -f, --force             Force package creation even if warnings occur");
 | 
					    dpm_log(LOG_INFO, "  -f, --force             Force package creation even if warnings occur");
 | 
				
			||||||
    dpm_log(LOG_INFO, "  -v, --verbose           Enable verbose output");
 | 
					    dpm_log(LOG_INFO, "  -v, --verbose           Enable verbose output");
 | 
				
			||||||
    dpm_log(LOG_INFO, "  -h, --help              Display this help message");
 | 
					    dpm_log(LOG_INFO, "  -h, --help              Display this help message");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue