[yocto] [PATCH] opkg-utils: Fix crash on dependency error

2015-05-21 Thread Haris Okanovic
Fix crash on exception in opkg-show-deps when generating an
'unsatisfied dependency' error. process_dep() function was
referencing a missing parameter `pkg`.

Signed-off-by: Haris Okanovic 
Reviewed-by: Alejandro del Castillo 
Acked-by: Brad Mouring 
Cc: Alejandro del Castillo 
Cc: Paul Barker 
---
 opkg-show-deps | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/opkg-show-deps b/opkg-show-deps
index 3c3be6a..4694579 100755
--- a/opkg-show-deps
+++ b/opkg-show-deps
@@ -58,7 +58,7 @@ def find_package(name):
   return provider_hash[name]
  return None
 
-def process_dep(dep):
+def process_dep(pkg, dep):
  # Add a provider of the given dependency to the list of required packages
  # unless a provider is already present in this list.
  dep = re.sub("\s*\(.*\)", "", dep)
@@ -83,7 +83,7 @@ def recurse(pkg):
  if pkg.depends:
   deps = split_list(pkg.depends)
   for dep in deps:
-   process_dep(dep)
+   process_dep(pkg, dep)
 
 for root in remaining_args:
  pkgs = find_package(root)
-- 
2.2.2

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [PATCH] opkg-utils: Add opkg-graph-deps

2016-01-05 Thread Haris Okanovic
Usage: opkg-graph-deps [-h] [-o feed.dot] [-u ] 

Generates a dot formatted dependency graph of an IPK feed.

The feed is specified by a list of IPK index (Packages) files, which
are sourced in the order specified to build a dependency graph. Last
index to declare a package wins, but also generates a warning to stderr.

Possible warnings:
 Duplicate package: package appears in more than one index.
 Broken dependency: no package satisfies a declared dependency.
 Replacing alias: package is replacing another package.
 Self alias: package declares an alias on it's own name.

If a base feed URL is specified, each package node includes an 'href'
to the associated IPK file. It's assumes that the specified base
feed URL hosts the current working directory, so the resulting
hrefs are generated by joining the base and a relative IPK path.

The resulting feed graph is written to './feed.dot' or an alternate
path specified by the caller. Nodes represent real packages (not
aliases)
and edges represent dependencies.

Node attributes:
 (node name): Package name from feed index (without version or arch)
 label: [Package name] [ipkArchitecture] [ipkVersion]
 ipkArchitecture: Architecture name from feed index
 ipkVersion: The full version number from feed index
 ipkMissing: Set to "1" when the ipk is not actually in feed, but has
  one or inbound dependencies.
 href: URL to the IPK file. Only if optional base URL is specified.

Edge attributes:
 (from) The package name declaring a dependency
 (to) The (de-aliased) package name (from) depends on
 ipkAlias: The alias of (to) which (from) depends on. Only set when
  the alias != (to).
 ipkBrokenDep: Set to "1" if (to) is missing from the feed.

Signed-off-by: Haris Okanovic 
Cc: Alejandro del Castillo 
Cc: Paul Barker 
Cc: Ken Sharp 
Cc: Richard Tollerton 
---
 opkg-graph-deps | 246 
 1 file changed, 246 insertions(+)
 create mode 100755 opkg-graph-deps

diff --git a/opkg-graph-deps b/opkg-graph-deps
new file mode 100755
index 000..c42e7ce
--- /dev/null
+++ b/opkg-graph-deps
@@ -0,0 +1,246 @@
+#!/usr/bin/env python
+
+import sys
+import os
+import getopt
+import pydot
+import opkg
+
+def usage(more=False):
+print >>sys.stderr, ( 'Usage: opkg-graph-deps '
+'[-h] [-o feed.dot] '
+'[-u ] '
+'' )
+if more:
+print >>sys.stderr, '\n'.join( [
+'',
+'Generates a dot formatted dependency graph of an IPK feed.',
+'',
+'The feed is specified by a list of IPK index (Packages) files, which',
+'are sourced in the order specified to build a dependency graph. Last',
+'index to declare a package wins, but also generates a warning to stderr.',
+'',
+'Possible warnings:',
+' Duplicate package: package appears in more than one index.',
+' Broken dependency: no package satisfies a declared dependency.',
+' Replacing alias: package is replacing another package.',
+' Self alias: package declares an alias on it\'s own name.',
+'',
+'If a base feed URL is specified, each package node includes an \'href\'',
+'to the associated IPK file. It\'s assumes that the specified base',
+'feed URL hosts the current working directory, so the resulting',
+'hrefs are generated by joining the base and a relative IPK path.',
+'',
+'The resulting feed graph is written to \'./feed.dot\' or an alternate',
+'path specified by the caller. Nodes represent real packages (not aliases)',
+'and edges represent dependencies.',
+'',
+'Node attributes:',
+' (node name): Package name from feed index (without version or arch)',
+' label: [Package name] [ipkArchitecture] [ipkVersion]',
+' ipkArchitecture: Architecture name from feed index',
+' ipkVersion: The full version number from feed index',
+' ipkMissing: Set to "1" when the ipk is not actually in feed, but has',
+'  one or inbound dependencies.',
+' href: URL to the IPK file. Only if optional base URL is specified.',
+'',
+'Edge attributes:',
+' (from) The package name declaring a dependency',
+' (to) The (de-aliased) package name (from) depends on',
+' ipkAlias: The alias of (to) which (from) depends on. Only set when',
+'  the alias != (to).',
+' ipkBrokenDep: Set to "1" if (to) is missing from the feed.',
+'',
+] )
+exit(1)
+
+# optional args
+dot_filename = "feed.dot"
+feed_url = None
+
+(opts, index_files) = getopt.getopt(sys.argv[1:], "ho:u:")
+for (optkey, optval) in opts:
+if optkey == '-h':

[yocto] [PATCH] libopkg: Add disable_intercepts option to opkg.conf

2016-01-06 Thread 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 
Cc: Alejandro del Castillo 
Cc: Paul Barker 
---
 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

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [opkg-devel] [OE-core][opkg-utils ] Bug 13528 : adding SPDX license identifier

2019-10-11 Thread Haris Okanovic

I have no objection. Do you have a patch with this change?

-- Haris


On 10/11/19 10:54 AM, Alejandro Del Castillo wrote:


On 10/11/19 8:51 AM, Ycn aKaJoseph wrote:

Hi guys,

https://bugzilla.yoctoproject.org/show_bug.cgi?id=13528
<https://urldefense.com/v3/__https://bugzilla.yoctoproject.org/show_bug.cgi?id=13528__;!fqWJcnlTkjM!8RtsWJXbDz_l063ZSVKrRMwvQ5KGdD0lk9aSjlUW9VHM2wufITJnBuIvovQxoT0yJXu-6Q$>

I'm about to work on that bug however most of the script in opkg-utils
dir are un-licenced and there's no hint for me to decide what SPDX
Identifier to add.


thanks for doing this!


The doubt concerns those script :
makePackage
opkg-build
opkg-buildpackage
opkg-compare-indexes
opkg-diff
opkg-extract-file
opkg-graph-deps
opkg-list-fields
opkg-make-index
opkg-show-deps
opkg-unbuild
opkg-update-index

What license do you want them to carry ?


Looking at the commit history, opkg-graph-deps was authored by Haris
Okanovic, and the rest by Richard Purdie (included them on the thread).

My take on it:  since opkg is licensed as GPLv2+, and the files that
have a license in opkg-utils are GPLv2+, make sense to me to license the
rest as GPLv2+ too.

Haris, Richard, thoughts?


--
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto