Index: oprofile/pp/oparchive.cpp =================================================================== --- oprofile.orig/pp/oparchive.cpp +++ oprofile/pp/oparchive.cpp @@ -35,6 +35,11 @@ namespace { void copy_one_file(image_error err, string const & source, string const & dest) { + if (options::list_files) { + cout << source << endl; + return; + } + if (!copy_file(source, dest) && err == image_ok) { cerr << "can't copy from " << source << " to " << dest << " cause: " << strerror(errno) << endl; @@ -46,7 +51,7 @@ int oparchive(options::spec const & spec handle_options(spec); /* Check to see if directory can be created */ - if (create_path(options::outdirectory.c_str())) { + if (!options::list_files && create_path(options::outdirectory.c_str())) { cerr << "Unable to create directory for " << options::outdirectory << "." << endl; exit (EXIT_FAILURE); @@ -73,7 +78,8 @@ int oparchive(options::spec const & spec cverb << vdebug << exe_name << endl; /* Create directory for executable file. */ - if (create_path(exe_archive_file.c_str())) { + if (!options::list_files + && create_path(exe_archive_file.c_str())) { cerr << "Unable to create directory for " << exe_archive_file << "." << endl; exit (EXIT_FAILURE); @@ -100,7 +106,8 @@ int oparchive(options::spec const & spec /* found something copy it over */ string dest_debug_dir = options::outdirectory + dirname + "/.debug/"; - if (create_dir(dest_debug_dir.c_str())) { + if (!options::list_files + && create_dir(dest_debug_dir.c_str())) { cerr << "Unable to create directory: " << dest_debug_dir << "." << endl; exit (EXIT_FAILURE); @@ -130,7 +137,8 @@ int oparchive(options::spec const & spec cverb << vdebug << (sample_name) << endl; cverb << vdebug << " destp " << sample_archive_file << endl; - if (create_path(sample_archive_file.c_str())) { + if (!options::list_files + && create_path(sample_archive_file.c_str())) { cerr << "Unable to create directory for " << sample_archive_file << "." << endl; exit (EXIT_FAILURE); Index: oprofile/pp/oparchive_options.cpp =================================================================== --- oprofile.orig/pp/oparchive_options.cpp +++ oprofile/pp/oparchive_options.cpp @@ -36,6 +36,7 @@ namespace options { bool exclude_dependent; merge_option merge_by; string outdirectory; + bool list_files; } @@ -47,7 +48,9 @@ popt::option options_array[] = { popt::option(options::outdirectory, "output-directory", 'o', "output to the given directory", "directory"), popt::option(options::exclude_dependent, "exclude-dependent", 'x', - "exclude libs, kernel, and module samples for applications") + "exclude libs, kernel, and module samples for applications"), + popt::option(options::list_files, "list-files", 'l', + "just list the files necessary, don't produce the archive") }; @@ -60,7 +63,7 @@ void check_options() using namespace options; /* output directory is required */ - if (outdirectory.size() == 0) { + if (outdirectory.size() == 0 && !list_files) { cerr << "Requires --output-directory option." << endl; exit(EXIT_FAILURE); } Index: oprofile/pp/oparchive_options.h =================================================================== --- oprofile.orig/pp/oparchive_options.h +++ oprofile/pp/oparchive_options.h @@ -22,6 +22,7 @@ namespace options { extern bool exclude_dependent; extern merge_option merge_by; extern std::string outdirectory; + extern bool list_files; } /// All the chosen sample files. Index: oprofile/ChangeLog =================================================================== --- oprofile.orig/ChangeLog +++ oprofile/ChangeLog @@ -1,5 +1,12 @@ 2007-05-09 Richard Purdie + * oparchive.cpp: + * oparchive_options.cpp: + * oparchive_options.h: Add --list-files option to list all files that + would be handled by oparchive. + +2007-05-09 Richard Purdie + * oprofile/pp/oparchive.cpp: If the debug files have the same name as the original binary, the binary gets overwritten. Add in a .debug directory to avoid this. Index: oprofile/doc/oparchive.1.in =================================================================== --- oprofile.orig/doc/oparchive.1.in +++ oprofile/doc/oparchive.1.in @@ -50,6 +50,10 @@ Output to the given directory. There is Do not include application-specific images for libraries, kernel modules and the kernel. This option only makes sense if the profile session used --separate. +.br +.TP +.BI "--list-files / -l" +Only list the files that would be archived, don't copy them. .SH ENVIRONMENT No special environment variables are recognised by oparchive.