From beedc17766c58799eae1919cb471f686b8286363 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Oct 2019 12:42:15 +0200 Subject: Regularize and make accessible install/uninstall primitives --- libbuild2/install/rule.hxx | 47 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'libbuild2/install/rule.hxx') diff --git a/libbuild2/install/rule.hxx b/libbuild2/install/rule.hxx index c7e6a17..56d3970 100644 --- a/libbuild2/install/rule.hxx +++ b/libbuild2/install/rule.hxx @@ -158,7 +158,32 @@ namespace build2 // The verbosity argument specified the level to start printing the // command at. Note that these functions respect the dry_run flag. - // Install a symlink: base/link -> target. + // Install (create) a directory: + // + // install -d + // + static void + install_d (const scope& rs, + const install_dir& base, + const dir_path& dir, + uint16_t verbosity = 1); + + // Install a file: + // + // install / # if is empty + // install / # if is not empty + // + static void + install_f (const scope& rs, + const install_dir& base, + const path& name, + const file& target, + const path& file, + uint16_t verbosity = 1); + + // Install (make) a symlink: + // + // ln -s / // static void install_l (const scope& rs, @@ -167,10 +192,10 @@ namespace build2 const path& link, uint16_t verbosity = 1); - // Uninstall a file or symlink: + // Uninstall (remove) a file or symlink: // - // uninstall / rm /.leaf (); name empty - // uninstall rm /; target can be NULL + // uninstall / # rm /.leaf (); name empty + // uninstall # rm /; target can be NULL // // Return false if nothing has been removed (i.e., the file does not // exist). @@ -182,6 +207,20 @@ namespace build2 const path& name, uint16_t verbosity = 1); + // Uninstall (remove) an empty directory. + // + // uninstall -d + // + // We try to remove all the directories between base and dir but not base + // itself unless base == dir. Return false if nothing has been removed + // (i.e., the directories do not exist or are not empty). + // + static bool + uninstall_d (const scope& rs, + const install_dir& base, + const dir_path& dir, + uint16_t verbosity = 1); + target_state perform_install (action, const target&) const; -- cgit v1.1