All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libopkg: Add disable_intercepts option to opkg.conf
@ 2016-01-06 23:07 Haris Okanovic
  2016-01-06 23:56 ` Alejandro del Castillo
  0 siblings, 1 reply; 2+ messages in thread
From: Haris Okanovic @ 2016-01-06 23:07 UTC (permalink / raw)
  To: yocto; +Cc: Haris Okanovic

When set, this option disables interception and deferral of certain
utilities (E.g. depmod, ldconfig) when called from maintainer scripts
(E.g. postinst). Disabled by default to maintain old behavior.

Append "option disable_intercepts 1" to opkg.conf to set it.

Testing:
 * Installed package containing postinst script and verified
   intercept prep/finalize does not run via DEBUG output.
 * Ran `make check` with option set in the test suite's opkg.conf,
   no additional failures.

Yocto bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8837

Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Cc: Alejandro del Castillo <alejandro.delcastillo@ni.com>
Cc: Paul Barker <paul@paulbarker.me.uk>
---
 libopkg/opkg_cmd.c  | 22 ++++++++++++++--------
 libopkg/opkg_conf.c |  1 +
 libopkg/opkg_conf.h |  1 +
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
index 050e6ec..ff3dcc0 100644
--- a/libopkg/opkg_cmd.c
+++ b/libopkg/opkg_cmd.c
@@ -328,7 +328,7 @@ static int opkg_configure_packages(char *pkg_name)
     pkg_vec_t *all, *ordered, *visited;
     unsigned int i;
     pkg_t *pkg;
-    opkg_intercept_t ic;
+    opkg_intercept_t ic = NULL;
     int r, err = 0;
 
     if (opkg_config->offline_root && !opkg_config->force_postinstall) {
@@ -352,10 +352,13 @@ static int opkg_configure_packages(char *pkg_name)
         opkg_recurse_pkgs_in_order(pkg, all, visited, ordered);
     }
 
-    ic = opkg_prep_intercepts();
-    if (ic == NULL) {
-        err = -1;
-        goto error;
+    if (!opkg_config->disable_intercepts) {
+        ic = opkg_prep_intercepts();
+        if (ic == NULL) {
+            err = -1;
+            goto error;
+        }
+        opkg_msg(DEBUG, "Intercepts enabled; statedir=\"%s\"\n", ic->statedir);
     }
 
     for (i = 0; i < ordered->len; i++) {
@@ -379,9 +382,12 @@ static int opkg_configure_packages(char *pkg_name)
         }
     }
 
-    r = opkg_finalize_intercepts(ic);
-    if (r != 0)
-        err = -1;
+    if (!opkg_config->disable_intercepts) {
+        opkg_msg(DEBUG, "Finalizing intercepts\n");
+        r = opkg_finalize_intercepts(ic);
+        if (r != 0)
+            err = -1;
+    }
 
  error:
     pkg_vec_free(all);
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index f52a4db..2d2f4f7 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -85,6 +85,7 @@ static opkg_option_t options[] = {
     {"overwrite_no_owner", OPKG_OPT_TYPE_BOOL, &_conf.overwrite_no_owner},
     {"combine", OPKG_OPT_TYPE_BOOL, &_conf.combine},
     {"cache_local_files", OPKG_OPT_TYPE_BOOL, &_conf.cache_local_files},
+    {"disable_intercepts", OPKG_OPT_TYPE_BOOL, &_conf.disable_intercepts},
 #if defined(HAVE_OPENSSL)
     {"signature_ca_file", OPKG_OPT_TYPE_STRING, &_conf.signature_ca_file},
     {"signature_ca_path", OPKG_OPT_TYPE_STRING, &_conf.signature_ca_path},
diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
index 7460ca2..5421044 100644
--- a/libopkg/opkg_conf.h
+++ b/libopkg/opkg_conf.h
@@ -107,6 +107,7 @@ typedef struct opkg_conf {
     int volatile_cache;
     int combine;
     int cache_local_files;
+    int disable_intercepts;
     int host_cache_dir;
 
     /* ssl options: used only when opkg is configured with '--enable-curl',
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libopkg: Add disable_intercepts option to opkg.conf
  2016-01-06 23:07 [PATCH] libopkg: Add disable_intercepts option to opkg.conf Haris Okanovic
@ 2016-01-06 23:56 ` Alejandro del Castillo
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro del Castillo @ 2016-01-06 23:56 UTC (permalink / raw)
  To: Haris Okanovic, yocto



On 01/06/2016 05:07 PM, Haris Okanovic wrote:
> When set, this option disables interception and deferral of certain
> utilities (E.g. depmod, ldconfig) when called from maintainer scripts
> (E.g. postinst). Disabled by default to maintain old behavior.
> 
> Append "option disable_intercepts 1" to opkg.conf to set it.
> 
> Testing:
>  * Installed package containing postinst script and verified
>    intercept prep/finalize does not run via DEBUG output.
>  * Ran `make check` with option set in the test suite's opkg.conf,
>    no additional failures.
> 
> Yocto bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8837
> 
> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
> Cc: Alejandro del Castillo <alejandro.delcastillo@ni.com>
> Cc: Paul Barker <paul@paulbarker.me.uk>
> ---
>  libopkg/opkg_cmd.c  | 22 ++++++++++++++--------
>  libopkg/opkg_conf.c |  1 +
>  libopkg/opkg_conf.h |  1 +
>  3 files changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
> index 050e6ec..ff3dcc0 100644
> --- a/libopkg/opkg_cmd.c
> +++ b/libopkg/opkg_cmd.c
> @@ -328,7 +328,7 @@ static int opkg_configure_packages(char *pkg_name)
>      pkg_vec_t *all, *ordered, *visited;
>      unsigned int i;
>      pkg_t *pkg;
> -    opkg_intercept_t ic;
> +    opkg_intercept_t ic = NULL;
>      int r, err = 0;
>  
>      if (opkg_config->offline_root && !opkg_config->force_postinstall) {
> @@ -352,10 +352,13 @@ static int opkg_configure_packages(char *pkg_name)
>          opkg_recurse_pkgs_in_order(pkg, all, visited, ordered);
>      }
>  
> -    ic = opkg_prep_intercepts();
> -    if (ic == NULL) {
> -        err = -1;
> -        goto error;
> +    if (!opkg_config->disable_intercepts) {
> +        ic = opkg_prep_intercepts();
> +        if (ic == NULL) {
> +            err = -1;
> +            goto error;
> +        }
> +        opkg_msg(DEBUG, "Intercepts enabled; statedir=\"%s\"\n", ic->statedir);
>      }
>  
>      for (i = 0; i < ordered->len; i++) {
> @@ -379,9 +382,12 @@ static int opkg_configure_packages(char *pkg_name)
>          }
>      }
>  
> -    r = opkg_finalize_intercepts(ic);
> -    if (r != 0)
> -        err = -1;
> +    if (!opkg_config->disable_intercepts) {
> +        opkg_msg(DEBUG, "Finalizing intercepts\n");
> +        r = opkg_finalize_intercepts(ic);
> +        if (r != 0)
> +            err = -1;
> +    }
>  
>   error:
>      pkg_vec_free(all);
> diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
> index f52a4db..2d2f4f7 100644
> --- a/libopkg/opkg_conf.c
> +++ b/libopkg/opkg_conf.c
> @@ -85,6 +85,7 @@ static opkg_option_t options[] = {
>      {"overwrite_no_owner", OPKG_OPT_TYPE_BOOL, &_conf.overwrite_no_owner},
>      {"combine", OPKG_OPT_TYPE_BOOL, &_conf.combine},
>      {"cache_local_files", OPKG_OPT_TYPE_BOOL, &_conf.cache_local_files},
> +    {"disable_intercepts", OPKG_OPT_TYPE_BOOL, &_conf.disable_intercepts},
>  #if defined(HAVE_OPENSSL)
>      {"signature_ca_file", OPKG_OPT_TYPE_STRING, &_conf.signature_ca_file},
>      {"signature_ca_path", OPKG_OPT_TYPE_STRING, &_conf.signature_ca_path},
> diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
> index 7460ca2..5421044 100644
> --- a/libopkg/opkg_conf.h
> +++ b/libopkg/opkg_conf.h
> @@ -107,6 +107,7 @@ typedef struct opkg_conf {
>      int volatile_cache;
>      int combine;
>      int cache_local_files;
> +    int disable_intercepts;
>      int host_cache_dir;
>  
>      /* ssl options: used only when opkg is configured with '--enable-curl',
> 

Wrong ml, could you resend to opkg-devel@googlegroups.com? Also, you no longer
needed to CC Paul

-- 
Cheers,

Alejandro


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-07  0:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-06 23:07 [PATCH] libopkg: Add disable_intercepts option to opkg.conf Haris Okanovic
2016-01-06 23:56 ` Alejandro del Castillo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.