[buildd-tools-devel] [PATCH 08/12] Some cleanup for session and union chroots
Jan-Marek Glogowski
glogow at fbihome.de
Fri Jul 31 14:21:45 UTC 2009
Introduces own error messages when union underlay or overlay
directory isn't absolute. Drops an unnecessary variable usage
from the session facet code.
---
sbuild/sbuild-chroot-facet-session.cc | 4 ++--
sbuild/sbuild-chroot-facet-union.cc | 8 ++++----
sbuild/sbuild-chroot.cc | 4 +++-
sbuild/sbuild-chroot.h | 4 +++-
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/sbuild/sbuild-chroot-facet-session.cc b/sbuild/sbuild-chroot-facet-session.cc
index d75af63..ad40fa0 100644
--- a/sbuild/sbuild-chroot-facet-session.cc
+++ b/sbuild/sbuild-chroot-facet-session.cc
@@ -119,8 +119,8 @@ chroot_facet_session::clone_session_setup (chroot::ptr& clone,
std::tr1::shared_ptr<chroot_lvm_snapshot> snapshot(std::tr1::dynamic_pointer_cast<chroot_lvm_snapshot>(clone));
if (snapshot)
{
- std::string dir(dirname(snapshot->get_device(), '/'));
- std::string device(dir + "/" + clone->get_session_id());
+ std::string device(dirname(snapshot->get_device(), '/'));
+ device += "/" + clone->get_session_id();
snapshot->set_snapshot_device(device);
}
#endif // SBUILD_FEATURE_LVMSNAP
diff --git a/sbuild/sbuild-chroot-facet-union.cc b/sbuild/sbuild-chroot-facet-union.cc
index 42f16cd..6af9eed 100644
--- a/sbuild/sbuild-chroot-facet-union.cc
+++ b/sbuild/sbuild-chroot-facet-union.cc
@@ -128,8 +128,8 @@ void
chroot_facet_union::set_union_overlay_directory
(std::string const& directory)
{
- if (!is_absname(union_overlay_directory))
- throw chroot::error(union_overlay_directory, chroot::LOCATION_ABS);
+ if (!is_absname(directory))
+ throw chroot::error(directory, chroot::OVERLAY_ABS);
this->union_overlay_directory = directory;
}
@@ -144,8 +144,8 @@ void
chroot_facet_union::set_union_underlay_directory
(std::string const& directory)
{
- if (!is_absname(union_underlay_directory))
- throw chroot::error(union_underlay_directory, chroot::LOCATION_ABS);
+ if (!is_absname(directory))
+ throw chroot::error(directory, chroot::UNDERLAY_ABS);
this->union_underlay_directory = directory;
}
diff --git a/sbuild/sbuild-chroot.cc b/sbuild/sbuild-chroot.cc
index f82e0cc..3aeed25 100644
--- a/sbuild/sbuild-chroot.cc
+++ b/sbuild/sbuild-chroot.cc
@@ -80,9 +80,11 @@ namespace
emap(sbuild::chroot::FILE_PERMS, N_("File has write permissions for others")),
emap(sbuild::chroot::FILE_UNLOCK, N_("Failed to discard file lock")),
emap(sbuild::chroot::LOCATION_ABS, N_("Location must have an absolute path")),
+ emap(sbuild::chroot::OVERLAY_ABS, N_("Union overlay must have an absolute path")),
// TRANSLATORS: unlink refers to the C function which removes a file
emap(sbuild::chroot::SESSION_UNLINK, N_("Failed to unlink session file")),
- emap(sbuild::chroot::SESSION_WRITE, N_("Failed to write session file"))
+ emap(sbuild::chroot::SESSION_WRITE, N_("Failed to write session file")),
+ emap(sbuild::chroot::UNDERLAY_ABS, N_("Union underlay must have an absolute path"))
};
}
diff --git a/sbuild/sbuild-chroot.h b/sbuild/sbuild-chroot.h
index 09cd902..c92a1f8 100644
--- a/sbuild/sbuild-chroot.h
+++ b/sbuild/sbuild-chroot.h
@@ -83,8 +83,10 @@ namespace sbuild
FILE_PERMS, ///< File has write permissions for others.
FILE_UNLOCK, ///< Failed to discard lock.
LOCATION_ABS, ///< Location must have an absolute path.
+ OVERLAY_ABS, ///< Union overlay must have an absolute path.
SESSION_UNLINK, ///< Failed to unlink session file.
- SESSION_WRITE ///< Failed to write session file.
+ SESSION_WRITE, ///< Failed to write session file.
+ UNDERLAY_ABS ///< Union underlay must have an absolute path.
};
/// Exception type.
--
1.6.3.2
More information about the Buildd-tools-devel
mailing list