libmpm

morphux C package management library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/libmpm

commit 30f4fca6dde2c6b702b74b48659fa4e233a9fa43
parent b0a9c58f9b6e1ba4b4769d9e908f8e6cd44e4c4d
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 22 May 2017 13:17:09 +0200

Add(Compile): Add after_package function

Diffstat:
Minc/compile.h | 18+++++++++++++++++-
Msrc/compile.c | 15+++++++++++++++
Mtests/test_compile.c | 1+
3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/inc/compile.h b/inc/compile.h @@ -81,7 +81,7 @@ bool before_package(compile_t *ctx); /*! * \brief Apply system and user patch * - * \param[in] ctx Current paco + * \param[in] ctx Current package * * \return true on succes, false on failure */ @@ -105,6 +105,22 @@ bool configure_package(compile_t *ctx); */ bool make_package(compile_t *ctx); +/*! + * \brief Install a Package + * + * \param[in] ctx Package to compile + * + * \return true on success, false on failure + */ bool install_package(compile_t *ctx); +/*! + * \brief Execute post-installation script + * + * \param[in] ctx Current package + * + * \return truc on success, false on failure + */ +bool after_package(compile_t *ctx); + #endif /* COMPILE_H */ diff --git a/src/compile.c b/src/compile.c @@ -142,3 +142,18 @@ end: ctx->state = INST_STATE_INSTALLATION; return status; } + +bool after_package(compile_t *ctx) { + if (file_exist(COMP_AFTER_SCRIPT) == false) + goto end; + + if (exec_line("sh " COMP_AFTER_SCRIPT) != 0) + { + printf("Here !\n"); + return false; + } + +end: + ctx->state = INST_STATE_AFTER; + return true; +} diff --git a/tests/test_compile.c b/tests/test_compile.c @@ -26,6 +26,7 @@ TEST(configure_package) { TEST_ASSERT(configure_package(ptr) == true, "An error happened"); TEST_ASSERT(make_package(ptr) == true, "An error happened"); TEST_ASSERT(install_package(ptr) == true, "An error happened"); + TEST_ASSERT(after_package(ptr) == true, "An error happened"); TEST_ASSERT(package_install_cleanup(ptr) == true, "An error happened"); return TEST_SUCCESS;