[mbox2eml] Patch to build with boost filesystem v3.

Ville Skyttä scop at fedoraproject.org
Fri Jul 27 15:28:02 UTC 2012


commit 20faa44465d60959117dcd416c189505ac71c65e
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Jul 27 18:27:54 2012 +0300

    Patch to build with boost filesystem v3.

 mbox2eml-0.1.1-boostfs3.patch |  119 +++++++++++++++++++++++++++++++++++++++++
 mbox2eml.spec                 |   10 +++-
 2 files changed, 127 insertions(+), 2 deletions(-)
---
diff --git a/mbox2eml-0.1.1-boostfs3.patch b/mbox2eml-0.1.1-boostfs3.patch
new file mode 100644
index 0000000..5121118
--- /dev/null
+++ b/mbox2eml-0.1.1-boostfs3.patch
@@ -0,0 +1,119 @@
+diff -up mbox2eml-0.1.1/src/cmdparser.cpp~ mbox2eml-0.1.1/src/cmdparser.cpp
+--- mbox2eml-0.1.1/src/cmdparser.cpp~	2012-07-27 17:14:07.400821302 +0300
++++ mbox2eml-0.1.1/src/cmdparser.cpp	2012-07-27 18:20:03.472759926 +0300
+@@ -166,7 +166,7 @@ Cmdline_parser::check_dir(const char* di
+     // compose the output directory's path
+     fs::path full_path;
+     try {
+-        fs::path dir_path(dir_str, fs::native);
++        fs::path dir_path(dir_str);
+         full_path = fs::system_complete(dir_path);
+     }
+     catch(...) {
+@@ -174,13 +174,27 @@ Cmdline_parser::check_dir(const char* di
+         exit(1);
+     }
+     // create the output directory if necessary
+-    if(!fs::exists(full_path) && !fs::create_directory(full_path)) {
+-        cerr << "Could not create directory: " << full_path.native_file_string() << endl;
++    bool exists = false;
++    try {
++        exists = fs::exists(full_path);
++    }
++    catch(const fs::filesystem_error& ex) {
++        cerr << "Could not check if dir exists: " << ex.what() << endl;
+         exit(1);
+     }
++    if(!exists) {
++        try {
++            exists = fs::create_directory(full_path);
++        }
++        catch(...) {}
++        if(!exists) {
++            cerr << "Could not create directory: " << full_path << endl;
++            exit(1);
++        }
++    }
+     // does the ouput path represent a directory?
+     if(!fs::is_directory(full_path)) {
+-        cerr << "This is a file and not a directory: " << full_path.native_file_string() << endl;
++        cerr << "This is a file and not a directory: " << full_path << endl;
+         exit(1);
+     }
+ 
+@@ -197,7 +211,7 @@ Cmdline_parser::check_file(const char* f
+     // compose the input file's path
+     fs::path full_path;
+     try {
+-        fs::path file_path(file_str, fs::native);
++        fs::path file_path(file_str);
+         full_path = fs::system_complete(file_path);
+     }
+     catch(...) {
+@@ -205,13 +219,19 @@ Cmdline_parser::check_file(const char* f
+         exit(1);
+     }
+     // does the input file exist?
+-    if(!fs::exists(full_path)) {
+-        cerr << "File does not exist: " << full_path.native_file_string() << endl;
++    try {
++        if (!fs::exists(full_path)) {
++            cerr << "File does not exist: " << full_path << endl;
++            exit(1);
++        }
++    }
++    catch(const fs::filesystem_error& ex) {
++        cerr << "Could not check if file exists: " << ex.what() << endl;
+         exit(1);
+     }
+     // is it really a file?
+     if(fs::is_directory(full_path)) {
+-        cerr << "This is a directory and not a file: " << full_path.native_file_string() << endl;
++        cerr << "This is a directory and not a file: " << full_path << endl;
+         exit(1);
+     }
+ 
+diff -up mbox2eml-0.1.1/src/main.cpp~ mbox2eml-0.1.1/src/main.cpp
+--- mbox2eml-0.1.1/src/main.cpp~	2005-02-04 17:27:06.000000000 +0200
++++ mbox2eml-0.1.1/src/main.cpp	2012-07-27 17:29:52.408172492 +0300
+@@ -15,7 +15,7 @@ main(const int argc, const char** argv)
+     delete cmd_parser;
+     // open the mbox file
+     fs::ifstream infile(config->input_file, fs::ifstream::in);
+-    assure(infile, config->input_file.native_file_string());
++    assure(infile, config->input_file.string());
+     // This counter is used for duplicate mails with no subject.
+     // This is thought to be an optimization for the function that generates a
+     // unique file name for the destination .eml file. By using this counter
+@@ -32,7 +32,7 @@ main(const int argc, const char** argv)
+         getline(infile, str, '\n');
+ 
+         if(infile.fail() && !infile.eof()) {
+-            cerr << "Error while reading " << config->input_file.native_file_string() << endl;
++            cerr << "Error while reading " << config->input_file << endl;
+             exit(1);
+         }
+ 
+diff -up mbox2eml-0.1.1/src/mboxparser.cpp~ mbox2eml-0.1.1/src/mboxparser.cpp
+--- mbox2eml-0.1.1/src/mboxparser.cpp~	2005-02-02 02:29:20.000000000 +0200
++++ mbox2eml-0.1.1/src/mboxparser.cpp	2012-07-27 18:17:59.502385089 +0300
+@@ -157,12 +157,18 @@ Mail::store(const fs::path outdpath, lon
+     // remove special chars from the file name
+     fixFilename(&fname);
+     // generate a unique file name
++    try {
+     fname = generateUniqueFilename(fname, outdpath, outf_counter);
++    }
++    catch(const fs::filesystem_error& ex) {
++        cerr << "Could not generate unique filename: " << ex.what() << endl;
++        exit(1);
++    }
+ 
+     // the whole path to the output eml file
+     fs::path outfpath = outdpath / (fname + ".eml");
+     fs::ofstream outfile(outfpath, fs::ofstream::out);
+-    assure(outfile, outfpath.native_file_string());
++    assure(outfile, outfpath.string());
+ 
+     while(!header.empty()) {
+         outfile << header.front() << endl;;
diff --git a/mbox2eml.spec b/mbox2eml.spec
index a425778..fe2c86b 100644
--- a/mbox2eml.spec
+++ b/mbox2eml.spec
@@ -1,6 +1,6 @@
 Name:           mbox2eml
 Version:        0.1.1
-Release:        14%{?dist}
+Release:        15%{?dist}
 Summary:        Split mbox mailboxes into single .eml files
 
 License:        GPL+
@@ -9,6 +9,8 @@ Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.
 Source1:        set-eml-mtimes.pl
 # http://sf.net/tracker/?func=detail&aid=2892908&group_id=127642&atid=709064
 Patch0:         %{name}-0.1.1-gcc43.patch
+# http://sf.net/tracker/?func=detail&aid=3550053&group_id=127642&atid=709064
+Patch1:         %{name}-0.1.1-boostfs3.patch
 
 BuildRequires:  boost-devel
 BuildRequires:  popt-devel
@@ -22,12 +24,13 @@ minimum of RAM.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 sed -i -e 's/\r//g' AUTHORS ChangeLog
 install -pm 644 %{SOURCE1} .
 
 
 %build
-%configure LIBS="-lboost_system" CPPFLAGS="-DBOOST_FILESYSTEM_VERSION=2"
+%configure LIBS="-lboost_system"
 make %{?_smp_mflags}
 
 
@@ -41,6 +44,9 @@ make install DESTDIR=$RPM_BUILD_ROOT
 
 
 %changelog
+* Fri Jul 27 2012 Ville Skyttä <ville.skytta at iki.fi> - 0.1.1-15
+- Patch to build with boost filesystem v3.
+
 * Thu Jul 19 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.1.1-14
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list