rpm-razor.c
changeset 236 e4900c8df461
parent 235 060d83d8eca9
child 238 d19dc7950c76
     1.1 --- a/rpm-razor.c	Mon Jun 09 16:38:58 2008 -0400
     1.2 +++ b/rpm-razor.c	Mon Jun 09 22:41:37 2008 -0400
     1.3 @@ -20,6 +20,7 @@
     1.4  #include <stdlib.h>
     1.5  #include <string.h>
     1.6  #include <stdio.h>
     1.7 +#include <dirent.h>
     1.8  #include "razor.h"
     1.9  
    1.10  enum option_type {
    1.11 @@ -163,6 +164,7 @@
    1.12  };
    1.13  
    1.14  static int option_version;
    1.15 +static const char *option_root = "install";
    1.16  
    1.17  static const struct option common_options[] = {
    1.18  	{ OPTION_STRING, "define", 'D', "MACRO EXPR", "define MACRO with value EXPR", NULL, },
    1.19 @@ -171,7 +173,7 @@
    1.20  	{ OPTION_BOOL, "nodigest", 0, NULL, "don't verify package digest(s)", NULL, },
    1.21  	{ OPTION_BOOL, "nosignature", 0, NULL, "don't verify package signature(s)", NULL, },
    1.22  	{ OPTION_STRING, "rcfile", 0, "<FILE:...>", "read <FILE:...> instead of default file(s)", NULL },
    1.23 -	{ OPTION_STRING, "root", 'r', "ROOT", "use ROOT as top level directory (default: \"/\")", NULL },
    1.24 +	{ OPTION_STRING, "root", 'r', "ROOT", "use ROOT as top level directory (default: \"/\")", &option_root },
    1.25  	{ OPTION_BOOL, "querytags", 0, NULL, "display known query tags", NULL, },
    1.26  	{ OPTION_BOOL, "showrc", 0, NULL, "display final rpmrc and macro configuration", NULL, },
    1.27  	{ OPTION_BOOL, "quiet", 0, NULL, "provide less detailed output", NULL },
    1.28 @@ -240,12 +242,11 @@
    1.29  
    1.30  static const char system_repo_filename[] = "system.repo";
    1.31  static const char *repo_filename = system_repo_filename;
    1.32 -static const char install_root[] = "install";
    1.33  
    1.34  static void
    1.35  command_initdb(int argc, const char *argv[])
    1.36  {
    1.37 -	razor_root_create(install_root);
    1.38 +	razor_root_create(option_root);
    1.39  }
    1.40  
    1.41  static struct razor_property *
    1.42 @@ -434,7 +435,7 @@
    1.43  		argc = 0;
    1.44  		option_all = 1;
    1.45  	} else {
    1.46 -		set = razor_set_open(repo_filename);
    1.47 +		set = razor_root_open_read_only(option_root);
    1.48  	}
    1.49  
    1.50  	pi = get_query_packages(set, argc, argv);
    1.51 @@ -484,7 +485,7 @@
    1.52  		argc = 0;
    1.53  		option_all = 1;
    1.54  	} else {
    1.55 -		set = razor_set_open(repo_filename);
    1.56 +		set = razor_root_open_read_only(option_root);
    1.57  	}
    1.58  
    1.59  	pi = get_query_packages(set, argc, argv);