Accepting request 64575 from home:dimstar:branches:GNOME:Apps
We should finally fix this in Factory... been failing too long. And the patch is from upstream. OBS-URL: https://build.opensuse.org/request/show/64575 OBS-URL: https://build.opensuse.org/package/show/GNOME:Apps/gnote?expand=0&rev=5
This commit is contained in:
parent
a7c4d44d6b
commit
80e924c575
335
gnote-replace_boost_with_glib.patch
Normal file
335
gnote-replace_boost_with_glib.patch
Normal file
@ -0,0 +1,335 @@
|
||||
From a52e9a93621f4df84c0c93b4b5367165778cc362 Mon Sep 17 00:00:00 2001
|
||||
From: Debarshi Ray <debarshir@src.gnome.org>
|
||||
Date: Tue, 08 Mar 2011 14:53:12 +0000
|
||||
Subject: Replace boost::filesystem::path with Glib equivalents
|
||||
|
||||
Added some tests to reduce chances of breakage and document edge-case
|
||||
behavior.
|
||||
|
||||
Changes from prior behavior:
|
||||
+ sharp::file_filename("/foo/bar/") == "bar" (not ".")
|
||||
Ditto for sharp::FileInfo::get_name.
|
||||
+ sharp::file_basename("/foo/bar/") == "bar" (not "")
|
||||
|
||||
Fixes: https://bugzilla.gnome.org/641416
|
||||
---
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 141d923..19c8795 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -28,9 +28,9 @@ GNOTE_LIBS = libgnote.a $(top_builddir)/libtomboy/libtomboy.la \
|
||||
noinst_LIBRARIES = libgnote.a
|
||||
bin_PROGRAMS = gnote
|
||||
check_PROGRAMS = trietest stringtest notetest dttest uritest filestest \
|
||||
- xmlreadertest
|
||||
+ fileinfotest xmlreadertest
|
||||
TESTS = trietest stringtest notetest dttest uritest filestest \
|
||||
- xmlreadertest
|
||||
+ fileinfotest xmlreadertest
|
||||
|
||||
|
||||
trietest_SOURCES = test/trietest.cpp \
|
||||
@@ -47,7 +47,11 @@ stringtest_LDADD = @PCRE_LIBS@ @LIBGLIBMM_LIBS@
|
||||
|
||||
filestest_SOURCES = test/filestest.cpp \
|
||||
sharp/files.cpp
|
||||
-filestest_LDADD = @BOOST_FILESYSTEM_LIBS@ -lboost_system-mt
|
||||
+filestest_LDADD = @BOOST_FILESYSTEM_LIBS@ @LIBGLIBMM_LIBS@ -lboost_system-mt
|
||||
+
|
||||
+fileinfotest_SOURCES = test/fileinfotest.cpp \
|
||||
+ sharp/fileinfo.cpp
|
||||
+fileinfotest_LDADD = @BOOST_FILESYSTEM_LIBS@ @LIBGLIBMM_LIBS@ -lboost_system-mt
|
||||
|
||||
uritest_SOURCES = test/uritest.cpp \
|
||||
sharp/string.cpp sharp/uri.cpp debug.cpp
|
||||
diff --git a/src/sharp/directory.cpp b/src/sharp/directory.cpp
|
||||
index 8a38f43..d9ee931 100644
|
||||
--- a/src/sharp/directory.cpp
|
||||
+++ b/src/sharp/directory.cpp
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* gnote
|
||||
*
|
||||
+ * Copyright (C) 2011 Debarshi Ray
|
||||
* Copyright (C) 2009 Hubert Figuiere
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
@@ -27,8 +28,10 @@
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
+#include <glibmm.h>
|
||||
|
||||
#include "sharp/directory.hpp"
|
||||
+#include "sharp/fileinfo.hpp"
|
||||
#include "sharp/string.hpp"
|
||||
|
||||
namespace sharp {
|
||||
@@ -38,20 +41,21 @@ namespace sharp {
|
||||
const std::string & ext,
|
||||
std::list<std::string> & list)
|
||||
{
|
||||
- boost::filesystem::path p(dir);
|
||||
-
|
||||
- if(!exists(p)) {
|
||||
+ if (!Glib::file_test(dir, Glib::FILE_TEST_EXISTS))
|
||||
return;
|
||||
- }
|
||||
- boost::filesystem::directory_iterator end_itr;
|
||||
- for ( boost::filesystem::directory_iterator itr( p );
|
||||
- itr != end_itr;
|
||||
- ++itr )
|
||||
- {
|
||||
- // is_regular() is deprecated but is_regular_file isn't in 1.34.
|
||||
- if ( is_regular(*itr) && (ext.empty() || (sharp::string_to_lower(extension(*itr)) == ext)) )
|
||||
- {
|
||||
- list.push_back(itr->string());
|
||||
+
|
||||
+ if (!Glib::file_test(dir, Glib::FILE_TEST_IS_DIR))
|
||||
+ return;
|
||||
+
|
||||
+ Glib::Dir d(dir);
|
||||
+
|
||||
+ for (Glib::Dir::iterator itr = d.begin(); itr != d.end(); ++itr) {
|
||||
+ const sharp::FileInfo file_info(*itr);
|
||||
+ const std::string & extension = file_info.get_extension();
|
||||
+
|
||||
+ if (Glib::file_test(*itr, Glib::FILE_TEST_IS_REGULAR)
|
||||
+ && (ext.empty() || (sharp::string_to_lower(extension) == ext))) {
|
||||
+ list.push_back(*itr);
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/sharp/fileinfo.cpp b/src/sharp/fileinfo.cpp
|
||||
index 52d2760..a53d570 100644
|
||||
--- a/src/sharp/fileinfo.cpp
|
||||
+++ b/src/sharp/fileinfo.cpp
|
||||
@@ -23,8 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
-#include <boost/filesystem/path.hpp>
|
||||
-#include <boost/filesystem/convenience.hpp>
|
||||
+#include <glibmm.h>
|
||||
#include "sharp/fileinfo.hpp"
|
||||
|
||||
|
||||
@@ -42,17 +41,19 @@ namespace sharp {
|
||||
|
||||
std::string FileInfo::get_name() const
|
||||
{
|
||||
-#if BOOST_VERSION >= 103600
|
||||
- return boost::filesystem::path(m_path).filename();
|
||||
-#else
|
||||
- return boost::filesystem::path(m_path).leaf();
|
||||
-#endif
|
||||
+ return Glib::path_get_basename(m_path);
|
||||
}
|
||||
|
||||
|
||||
std::string FileInfo::get_extension() const
|
||||
{
|
||||
- return boost::filesystem::extension(m_path);
|
||||
+ const std::string & name = get_name();
|
||||
+
|
||||
+ if ("." == name || ".." == name)
|
||||
+ return "";
|
||||
+
|
||||
+ const std::string::size_type pos = name.find_last_of('.');
|
||||
+ return (std::string::npos == pos) ? "" : std::string(name, pos);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/sharp/files.cpp b/src/sharp/files.cpp
|
||||
index d15cb32..f1a1e4b 100644
|
||||
--- a/src/sharp/files.cpp
|
||||
+++ b/src/sharp/files.cpp
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
-#include <boost/filesystem/convenience.hpp>
|
||||
+#include <glibmm.h>
|
||||
|
||||
#include "files.hpp"
|
||||
|
||||
@@ -34,30 +34,28 @@ namespace sharp {
|
||||
|
||||
bool file_exists(const std::string & file)
|
||||
{
|
||||
- boost::filesystem::path p(file);
|
||||
- // is_regular_file isn't in 1.34. is_regular is deprecated.
|
||||
- return (exists(p) && is_regular(p));
|
||||
+ return Glib::file_test(file, Glib::FILE_TEST_EXISTS)
|
||||
+ && Glib::file_test(file, Glib::FILE_TEST_IS_REGULAR);
|
||||
}
|
||||
|
||||
|
||||
std::string file_basename(const std::string & p)
|
||||
{
|
||||
-#if BOOST_VERSION >= 103600
|
||||
- return boost::filesystem::path(p).stem();
|
||||
-#else
|
||||
- return boost::filesystem::basename(boost::filesystem::path(p));
|
||||
-#endif
|
||||
+ const std::string & filename = Glib::path_get_basename(p);
|
||||
+ const std::string::size_type pos = filename.find_last_of('.');
|
||||
+
|
||||
+ return std::string(filename, 0, pos);
|
||||
}
|
||||
|
||||
std::string file_dirname(const std::string & p)
|
||||
{
|
||||
- return boost::filesystem::path(p).branch_path().string();
|
||||
+ return Glib::path_get_dirname(p);
|
||||
}
|
||||
|
||||
|
||||
std::string file_filename(const std::string & p)
|
||||
{
|
||||
- return boost::filesystem::path(p).leaf();
|
||||
+ return Glib::path_get_basename(p);
|
||||
}
|
||||
|
||||
void file_delete(const std::string & p)
|
||||
diff --git a/src/test/fileinfotest.cpp b/src/test/fileinfotest.cpp
|
||||
new file mode 100644
|
||||
index 0000000..c4c5931
|
||||
--- a/dev/null
|
||||
+++ b/src/test/fileinfotest.cpp
|
||||
@@ -0,0 +1,62 @@
|
||||
+/*
|
||||
+ * gnote
|
||||
+ *
|
||||
+ * Copyright (C) 2011 Debarshi Ray
|
||||
+ *
|
||||
+ * This program is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <boost/test/minimal.hpp>
|
||||
+
|
||||
+#include "sharp/fileinfo.hpp"
|
||||
+
|
||||
+int test_main(int /*argc*/, char ** /*argv*/)
|
||||
+{
|
||||
+ {
|
||||
+ sharp::FileInfo file_info("/foo/bar/baz.txt");
|
||||
+
|
||||
+ BOOST_CHECK(file_info.get_name() == "baz.txt");
|
||||
+ BOOST_CHECK(file_info.get_extension() == ".txt");
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ sharp::FileInfo file_info("/foo/bar/baz.");
|
||||
+
|
||||
+ BOOST_CHECK(file_info.get_name() == "baz.");
|
||||
+ BOOST_CHECK(file_info.get_extension() == ".");
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ sharp::FileInfo file_info("/foo/bar/baz");
|
||||
+
|
||||
+ BOOST_CHECK(file_info.get_name() == "baz");
|
||||
+ BOOST_CHECK(file_info.get_extension() == "");
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ sharp::FileInfo file_info("/foo/bar/..");
|
||||
+
|
||||
+ BOOST_CHECK(file_info.get_name() == "..");
|
||||
+ BOOST_CHECK(file_info.get_extension() == "");
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ sharp::FileInfo file_info("/foo/bar/");
|
||||
+
|
||||
+ BOOST_CHECK(file_info.get_name() == "bar");
|
||||
+ BOOST_CHECK(file_info.get_extension() == "");
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/src/test/filestest.cpp b/src/test/filestest.cpp
|
||||
index d11e54c..7579dba 100644
|
||||
--- a/src/test/filestest.cpp
|
||||
+++ b/src/test/filestest.cpp
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* gnote
|
||||
*
|
||||
+ * Copyright (C) 2011 Debarshi Ray
|
||||
* Copyright (C) 2009 Hubert Figuiere
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -20,6 +21,7 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
+#include <glibmm.h>
|
||||
|
||||
#include "sharp/files.hpp"
|
||||
|
||||
@@ -27,10 +29,46 @@ using namespace sharp;
|
||||
|
||||
int test_main(int /*argc*/, char ** /*argv*/)
|
||||
{
|
||||
- std::string path = "/foo/bar/baz.txt";
|
||||
+ {
|
||||
+ std::string path = "/foo/bar/baz.txt";
|
||||
|
||||
- BOOST_CHECK(file_basename(path) == "baz");
|
||||
- BOOST_CHECK(file_dirname(path) == "/foo/bar");
|
||||
+ BOOST_CHECK(file_basename(path) == "baz");
|
||||
+ BOOST_CHECK(file_dirname(path) == "/foo/bar");
|
||||
+ BOOST_CHECK(file_filename(path) == "baz.txt");
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ std::string path = "/foo/bar/baz";
|
||||
+
|
||||
+ BOOST_CHECK(file_basename(path) == "baz");
|
||||
+ BOOST_CHECK(file_dirname(path) == "/foo/bar");
|
||||
+ BOOST_CHECK(file_filename(path) == "baz");
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ std::string path = "/foo/bar/..";
|
||||
+
|
||||
+ BOOST_CHECK(file_basename(path) == ".");
|
||||
+ BOOST_CHECK(file_dirname(path) == "/foo/bar");
|
||||
+ BOOST_CHECK(file_filename(path) == "..");
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ std::string path = "/foo/bar/";
|
||||
+
|
||||
+ BOOST_CHECK(file_basename(path) == "bar");
|
||||
+ BOOST_CHECK(file_dirname(path) == "/foo/bar");
|
||||
+ BOOST_CHECK(file_filename(path) == "bar");
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ std::string dir = Glib::get_current_dir();
|
||||
+
|
||||
+ BOOST_CHECK(file_exists(dir) == false);
|
||||
+ // Very unlikely to exist.
|
||||
+ BOOST_CHECK(file_exists(__FILE__ __FILE__) == false);
|
||||
+ BOOST_CHECK(file_exists(__FILE__) == true);
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
cgit v0.8.3.4
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Mar 20 21:53:18 UTC 2011 - dimstar@opensuse.org
|
||||
|
||||
- Add gnote-replace_boost_with_glib.patch: Replace
|
||||
boost::filesystem with glib equivalents. Taken from upstream git.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Feb 12 18:46:05 CET 2011 - vuntz@opensuse.org
|
||||
|
||||
|
@ -20,12 +20,14 @@
|
||||
|
||||
Name: gnote
|
||||
Version: 0.7.3
|
||||
Release: 1
|
||||
Release: 2
|
||||
License: GNU GPL v3 or later
|
||||
Summary: A Port of Tomboy to C++
|
||||
Group: Productivity/Text/Editors
|
||||
Url: http://live.gnome.org/Gnote
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
# PATCH-FIX-UPSTREAM gnote-replace_boost_with_glib.patch dimstar@opensuse.org -- Replace Boost with glib equivalent. Taken from git, commit a52e9a
|
||||
Patch0: gnote-replace_boost_with_glib.patch
|
||||
BuildRequires: boost-devel >= 1.34
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gcc-c++
|
||||
@ -51,6 +53,7 @@ to come). Synchronization support is being worked on.
|
||||
%lang_package
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%configure --disable-static --disable-schemas-install --disable-scrollkeeper --enable-dbus
|
||||
@ -72,12 +75,14 @@ test "%{buildroot}" != "/" && %__rm -rf %{buildroot}
|
||||
%posttrans -f %{name}.schemas_posttrans
|
||||
|
||||
%if 0%{?suse_version} > 1130
|
||||
|
||||
%post
|
||||
%desktop_database_post
|
||||
%icon_theme_cache_post
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version} > 1130
|
||||
|
||||
%postun
|
||||
%desktop_database_postun
|
||||
%icon_theme_cache_postun
|
||||
|
Loading…
x
Reference in New Issue
Block a user