aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-19 22:21:09 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-19 22:21:09 +0000
commitebe3297f0309fde8b8b22c4074a7dcec3aaf5fb5 (patch)
tree37e7ecc25c3a42321015ee8da835d632f5de6fe4
parent6e0ef486a1f4b7e0994af7047b3006288b52479e (diff)
downloadpaludis-ebe3297f0309fde8b8b22c4074a7dcec3aaf5fb5.tar.gz
paludis-ebe3297f0309fde8b8b22c4074a7dcec3aaf5fb5.tar.xz
Add in GPL headers where missing. Add KeyValueConfigFileError and use it rather than InternalError. Make DefaultConfigError and KeyValueConfigFileError descend from ConfigurationError rather than Exception.
-rw-r--r--paludis/block_error.cc18
-rw-r--r--paludis/config_file.cc4
-rw-r--r--paludis/configuration_error.cc29
-rw-r--r--paludis/configuration_error.hh35
-rw-r--r--paludis/create_insert_iterator.cc18
-rw-r--r--paludis/create_insert_iterator_TEST.cc18
-rw-r--r--paludis/default_config.cc18
-rw-r--r--paludis/default_config_error.cc20
-rw-r--r--paludis/default_config_error.hh22
-rw-r--r--paludis/exception_to_debug_string.cc18
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/filter_insert_iterator.cc18
-rw-r--r--paludis/filter_insert_iterator_TEST.cc18
-rw-r--r--paludis/getenv.cc18
-rw-r--r--paludis/getenv_TEST.cc18
-rw-r--r--paludis/is_file_with_extension.cc18
-rw-r--r--paludis/is_file_with_extension_TEST.cc18
-rw-r--r--paludis/iterator_utilities.cc18
-rw-r--r--paludis/key_value_config_file.cc31
-rw-r--r--paludis/key_value_config_file.hh18
-rw-r--r--paludis/key_value_config_file_TEST.cc47
-rw-r--r--paludis/key_value_config_file_error.cc29
-rw-r--r--paludis/key_value_config_file_error.hh35
-rw-r--r--paludis/mask_reasons.cc18
-rw-r--r--paludis/mask_reasons.hh18
-rw-r--r--paludis/strip.cc18
-rw-r--r--paludis/strip.hh18
-rw-r--r--paludis/translate_insert_iterator.cc18
-rw-r--r--paludis/translate_insert_iterator_TEST.cc18
-rw-r--r--paludis/use_flag_state.cc18
-rw-r--r--paludis/visitor.cc18
31 files changed, 623 insertions, 9 deletions
diff --git a/paludis/block_error.cc b/paludis/block_error.cc
index 6099be2..13e3a3e 100644
--- a/paludis/block_error.cc
+++ b/paludis/block_error.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "block_error.hh"
using namespace paludis;
diff --git a/paludis/config_file.cc b/paludis/config_file.cc
index f63ab06..ea05bd0 100644
--- a/paludis/config_file.cc
+++ b/paludis/config_file.cc
@@ -21,6 +21,8 @@
#include "config_file.hh"
#include "config_file_error.hh"
#include "strip.hh"
+#include "exception.hh"
+#include "stringify.hh"
using namespace paludis;
@@ -37,8 +39,10 @@ ConfigFile::need_lines() const
return;
std::string line;
+ unsigned line_number(0);
while (std::getline(*_stream, line))
{
+ Context c("When handling line " + stringify(++line_number) + ":");
normalise_line(line);
if (skip_line(line))
continue;
diff --git a/paludis/configuration_error.cc b/paludis/configuration_error.cc
new file mode 100644
index 0000000..08292e4
--- /dev/null
+++ b/paludis/configuration_error.cc
@@ -0,0 +1,29 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "configuration_error.hh"
+
+using namespace paludis;
+
+ConfigurationError::ConfigurationError(const std::string & msg) throw () :
+ Exception(msg)
+{
+}
+
diff --git a/paludis/configuration_error.hh b/paludis/configuration_error.hh
new file mode 100644
index 0000000..2c9346f
--- /dev/null
+++ b/paludis/configuration_error.hh
@@ -0,0 +1,35 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_CONFIGURATION_ERROR_HH
+#define PALUDIS_GUARD_PALUDIS_CONFIGURATION_ERROR_HH 1
+
+#include <paludis/exception.hh>
+
+namespace paludis
+{
+ class ConfigurationError : public Exception
+ {
+ protected:
+ ConfigurationError(const std::string & msg) throw ();
+ };
+}
+
+#endif
diff --git a/paludis/create_insert_iterator.cc b/paludis/create_insert_iterator.cc
index b8585d7..6754960 100644
--- a/paludis/create_insert_iterator.cc
+++ b/paludis/create_insert_iterator.cc
@@ -1,4 +1,22 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "create_insert_iterator.hh"
diff --git a/paludis/create_insert_iterator_TEST.cc b/paludis/create_insert_iterator_TEST.cc
index b835590..d3cad94 100644
--- a/paludis/create_insert_iterator_TEST.cc
+++ b/paludis/create_insert_iterator_TEST.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "create_insert_iterator.hh"
#include <test/test_framework.hh>
#include <test/test_runner.hh>
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index 1df5aa5..47850fe 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "default_config.hh"
#include "fs_entry.hh"
#include "dir_iterator.hh"
diff --git a/paludis/default_config_error.cc b/paludis/default_config_error.cc
index 53164ce..afff703 100644
--- a/paludis/default_config_error.cc
+++ b/paludis/default_config_error.cc
@@ -1,10 +1,28 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "default_config_error.hh"
using namespace paludis;
DefaultConfigError::DefaultConfigError(const std::string & msg) throw () :
- Exception("Default configuration error: " + msg)
+ ConfigurationError("Default configuration error: " + msg)
{
}
diff --git a/paludis/default_config_error.hh b/paludis/default_config_error.hh
index 24b6f1a..86a72d1 100644
--- a/paludis/default_config_error.hh
+++ b/paludis/default_config_error.hh
@@ -1,13 +1,31 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#ifndef PALUDIS_GUARD_PALUDIS_DEFAULT_CONFIG_ERROR_HH
#define PALUDIS_GUARD_PALUDIS_DEFAULT_CONFIG_ERROR_HH 1
-#include <paludis/exception.hh>
+#include <paludis/configuration_error.hh>
namespace paludis
{
- class DefaultConfigError : public Exception
+ class DefaultConfigError : public ConfigurationError
{
public:
DefaultConfigError(const std::string & msg) throw ();
diff --git a/paludis/exception_to_debug_string.cc b/paludis/exception_to_debug_string.cc
index 4160c6c..5813260 100644
--- a/paludis/exception_to_debug_string.cc
+++ b/paludis/exception_to_debug_string.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "exception_to_debug_string.hh"
using namespace paludis;
diff --git a/paludis/files.m4 b/paludis/files.m4
index 02e25e9..5f864ae 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -21,6 +21,7 @@ add(`composite_dep_atom', `hh', `cc')
add(`composite_pattern', `hh', `cc')
add(`config_file', `hh', `cc', `test')
add(`config_file_error', `hh', `cc')
+add(`configuration_error', `hh', `cc')
add(`container_entry', `hh', `cc', `test')
add(`counted_ptr', `hh', `cc', `test')
add(`counted_ptr_error', `hh', `cc')
@@ -60,6 +61,7 @@ add(`is_file_with_extension', `hh', `cc', `test', `testscript')
add(`iterator_utilities', `hh', `cc')
add(`join', `hh', `cc', `test')
add(`key_value_config_file', `hh', `cc', `test')
+add(`key_value_config_file_error', `hh', `cc')
add(`keyword_name', `hh', `cc')
add(`keyword_name_error', `hh', `cc')
add(`keyword_name_validator', `hh', `cc')
diff --git a/paludis/filter_insert_iterator.cc b/paludis/filter_insert_iterator.cc
index 8f9dafc..e20036f 100644
--- a/paludis/filter_insert_iterator.cc
+++ b/paludis/filter_insert_iterator.cc
@@ -1,4 +1,22 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "filter_insert_iterator.hh"
diff --git a/paludis/filter_insert_iterator_TEST.cc b/paludis/filter_insert_iterator_TEST.cc
index 9ef50f3..c1bacc7 100644
--- a/paludis/filter_insert_iterator_TEST.cc
+++ b/paludis/filter_insert_iterator_TEST.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "filter_insert_iterator.hh"
#include <test/test_framework.hh>
#include <test/test_runner.hh>
diff --git a/paludis/getenv.cc b/paludis/getenv.cc
index d459acb..c428b13 100644
--- a/paludis/getenv.cc
+++ b/paludis/getenv.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "getenv.hh"
#include <cstdlib>
diff --git a/paludis/getenv_TEST.cc b/paludis/getenv_TEST.cc
index e699079..46a5557 100644
--- a/paludis/getenv_TEST.cc
+++ b/paludis/getenv_TEST.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "getenv.hh"
#include <test/test_framework.hh>
#include <test/test_runner.hh>
diff --git a/paludis/is_file_with_extension.cc b/paludis/is_file_with_extension.cc
index 4182cb2..97397dc 100644
--- a/paludis/is_file_with_extension.cc
+++ b/paludis/is_file_with_extension.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "is_file_with_extension.hh"
using namespace paludis;
diff --git a/paludis/is_file_with_extension_TEST.cc b/paludis/is_file_with_extension_TEST.cc
index c0ca0dd..55f0336 100644
--- a/paludis/is_file_with_extension_TEST.cc
+++ b/paludis/is_file_with_extension_TEST.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Mark Loeser <halcy0n@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "is_file_with_extension.hh"
#include <test/test_framework.hh>
#include <test/test_runner.hh>
diff --git a/paludis/iterator_utilities.cc b/paludis/iterator_utilities.cc
index 72377a5..10ab96a 100644
--- a/paludis/iterator_utilities.cc
+++ b/paludis/iterator_utilities.cc
@@ -1,4 +1,22 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "iterator_utilities.hh"
diff --git a/paludis/key_value_config_file.cc b/paludis/key_value_config_file.cc
index cddedb8..0793b13 100644
--- a/paludis/key_value_config_file.cc
+++ b/paludis/key_value_config_file.cc
@@ -1,6 +1,25 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "key_value_config_file.hh"
+#include "key_value_config_file_error.hh"
#include "internal_error.hh"
using namespace paludis;
@@ -39,7 +58,7 @@ KeyValueConfigFile::replace_variables(const std::string & s) const
if ('\\' == s[p])
{
if (++p >= s.length())
- throw InternalError(PALUDIS_HERE, "todo");
+ throw KeyValueConfigFileError("Backslash not followed by a character");
r += s[p++];
}
else if ('$' != s[p])
@@ -48,13 +67,13 @@ KeyValueConfigFile::replace_variables(const std::string & s) const
{
std::string name;
if (++p >= s.length())
- throw InternalError(PALUDIS_HERE, "todo"); /// \bug
+ throw KeyValueConfigFileError("Dollar not followed by a character");
if ('{' == s[p])
{
std::string::size_type q;
if (std::string::npos == ((q = s.find("}", p))))
- throw InternalError(PALUDIS_HERE, "todo");
+ throw KeyValueConfigFileError("Closing } not found");
name = s.substr(p + 1, q - p - 1);
p = q + 1;
@@ -73,7 +92,7 @@ KeyValueConfigFile::replace_variables(const std::string & s) const
}
if (name.empty())
- throw InternalError(PALUDIS_HERE, "todo");
+ throw KeyValueConfigFileError("Empty variable name");
r += get(name);
}
@@ -92,9 +111,9 @@ KeyValueConfigFile::strip_quotes(const std::string & s) const
if (std::string::npos != std::string("'\"").find(s[0]))
{
if (s.length() < 2)
- throw InternalError(PALUDIS_HERE, "todo");
+ throw KeyValueConfigFileError("Unterminated quote");
if (s[s.length() - 1] != s[0])
- throw InternalError(PALUDIS_HERE, "todo");
+ throw KeyValueConfigFileError("Mismatched quote");
return s.substr(1, s.length() - 2);
}
else
diff --git a/paludis/key_value_config_file.hh b/paludis/key_value_config_file.hh
index b086198..0d2ac95 100644
--- a/paludis/key_value_config_file.hh
+++ b/paludis/key_value_config_file.hh
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#ifndef PALUDIS_GUARD_PALUDIS_KEY_VALUE_CONFIG_FILE_HH
#define PALUDIS_GUARD_PALUDIS_KEY_VALUE_CONFIG_FILE_HH 1
diff --git a/paludis/key_value_config_file_TEST.cc b/paludis/key_value_config_file_TEST.cc
index fa83cb3..5f4a007 100644
--- a/paludis/key_value_config_file_TEST.cc
+++ b/paludis/key_value_config_file_TEST.cc
@@ -1,7 +1,26 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "stringify.hh"
#include "key_value_config_file.hh"
+#include "configuration_error.hh"
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <vector>
@@ -51,5 +70,33 @@ namespace test_cases
TEST_CHECK_EQUAL(ff.get("z"), "foofoo\\$");
}
} test_key_value_config_file_vars;
+
+ struct KeyValueConfigFileErrorsTest : TestCase
+ {
+ KeyValueConfigFileErrorsTest() : TestCase("key value config file with errors") { }
+
+ void run()
+ {
+ std::stringstream s1;
+ s1 << "x='" << std::endl;
+ TEST_CHECK_THROWS(KeyValueConfigFile ff(&s1), ConfigurationError);
+
+ std::stringstream s2;
+ s2 << "x='moo\"" << std::endl;
+ TEST_CHECK_THROWS(KeyValueConfigFile ff(&s2), ConfigurationError);
+
+ std::stringstream s3;
+ s3 << "x=${foo" << std::endl;
+ TEST_CHECK_THROWS(KeyValueConfigFile ff(&s3), ConfigurationError);
+
+ std::stringstream s4;
+ s4 << "x=$~" << std::endl;
+ TEST_CHECK_THROWS(KeyValueConfigFile ff(&s4), ConfigurationError);
+
+ std::stringstream s5;
+ s5 << "x=abc\\" << std::endl;
+ TEST_CHECK_THROWS(KeyValueConfigFile ff(&s5), ConfigurationError);
+ }
+ } test_key_value_config_file_errors;
}
diff --git a/paludis/key_value_config_file_error.cc b/paludis/key_value_config_file_error.cc
new file mode 100644
index 0000000..64d133e
--- /dev/null
+++ b/paludis/key_value_config_file_error.cc
@@ -0,0 +1,29 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "key_value_config_file_error.hh"
+
+using namespace paludis;
+
+KeyValueConfigFileError::KeyValueConfigFileError(const std::string & msg) throw () :
+ ConfigurationError("Key/Value config file error: " + msg)
+{
+}
+
diff --git a/paludis/key_value_config_file_error.hh b/paludis/key_value_config_file_error.hh
new file mode 100644
index 0000000..9962857
--- /dev/null
+++ b/paludis/key_value_config_file_error.hh
@@ -0,0 +1,35 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_KEY_VALUE_CONFIG_FILE_ERROR_HH
+#define PALUDIS_GUARD_PALUDIS_KEY_VALUE_CONFIG_FILE_ERROR_HH 1
+
+#include <paludis/configuration_error.hh>
+
+namespace paludis
+{
+ class KeyValueConfigFileError : public ConfigurationError
+ {
+ public:
+ KeyValueConfigFileError(const std::string & message) throw ();
+ };
+}
+
+#endif
diff --git a/paludis/mask_reasons.cc b/paludis/mask_reasons.cc
index 503c311..ba41ab6 100644
--- a/paludis/mask_reasons.cc
+++ b/paludis/mask_reasons.cc
@@ -1,4 +1,22 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "mask_reasons.hh"
diff --git a/paludis/mask_reasons.hh b/paludis/mask_reasons.hh
index 2b3459a..61da2d0 100644
--- a/paludis/mask_reasons.hh
+++ b/paludis/mask_reasons.hh
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#ifndef PALUDIS_GUARD_PALUDIS_MASK_REASONS_HH
#define PALUDIS_GUARD_PALUDIS_MASK_REASONS_HH 1
diff --git a/paludis/strip.cc b/paludis/strip.cc
index f283451..2cfafd1 100644
--- a/paludis/strip.cc
+++ b/paludis/strip.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "strip.hh"
namespace paludis
diff --git a/paludis/strip.hh b/paludis/strip.hh
index b6983bc..9224f92 100644
--- a/paludis/strip.hh
+++ b/paludis/strip.hh
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#ifndef PALUDIS_GUARD_PALUDIS_STRIP_HH
#define PALUDIS_GUARD_PALUDIS_STRIP_HH 1
diff --git a/paludis/translate_insert_iterator.cc b/paludis/translate_insert_iterator.cc
index 97e9e75..e32b286 100644
--- a/paludis/translate_insert_iterator.cc
+++ b/paludis/translate_insert_iterator.cc
@@ -1,4 +1,22 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "translate_insert_iterator.hh"
diff --git a/paludis/translate_insert_iterator_TEST.cc b/paludis/translate_insert_iterator_TEST.cc
index 29168f2..6ee7a6f 100644
--- a/paludis/translate_insert_iterator_TEST.cc
+++ b/paludis/translate_insert_iterator_TEST.cc
@@ -1,5 +1,23 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "translate_insert_iterator.hh"
#include <test/test_framework.hh>
#include <test/test_runner.hh>
diff --git a/paludis/use_flag_state.cc b/paludis/use_flag_state.cc
index 66e7cc4..ea7fe0f 100644
--- a/paludis/use_flag_state.cc
+++ b/paludis/use_flag_state.cc
@@ -1,4 +1,22 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "use_flag_state.hh"
diff --git a/paludis/visitor.cc b/paludis/visitor.cc
index ffeab02..ddf14e2 100644
--- a/paludis/visitor.cc
+++ b/paludis/visitor.cc
@@ -1,4 +1,22 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis 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
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "visitor.hh"