Haris Okanovic | 29 Jan 20:10 2016

[PATCH] .gitignore: Add generated *.dirstamp files and m4/ dir

.dirstamp gets created at libopkg/solvers/internal/.deps/ during build.
m4/ directory is populated by libtoolize.

Testing: Ran `./autogen.sh && ./configure` and verified all generated
files are ignored. Same after running `make && make check`.

Signed-off-by: Haris Okanovic <haris.okanovic@...>
---
 .gitignore | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.gitignore b/.gitignore
index e61ba0f..3599787 100644
--- a/.gitignore
+++ b/.gitignore
 <at>  <at>  -9,6 +9,7  <at>  <at> 
 *.[oa]
 *~
 *.*.swp
+*.dirstamp

 Makefile
 Makefile.in
 <at>  <at>  -16,6 +17,10  <at>  <at>  Makefile.in
 Makefile.in.in
 !tests/regress/Makefile

+# The generated m4 subdirectory
+m4/
+!m4/gpgme.m4
(Continue reading)

Alejandro del Castillo | 22 Jan 22:11 2016

[PATCH 00/11] Finalize internal solver disentanglement from install/remove transactions

This patchset splits the internal solver from the install/upgrade operations.
Now there is clear division between solving operations (on the solvers folder)
and transactional (install/upgrade/remove) operations, common to all solver
backends.

By solving first, issues 156 and 162 are fixed. 

Alejandro del Castillo (11):
  opkg_install.c: remove prerm_deconfigure_conflictor stub
  libopkg: move internal solver install related functions to a new file
  libopkg: rename opkg_upgrade.* to opkg_upgrade_internal.*
  libopkg: move internal solver solving related functions to
    opkg_solver_internal.*
  libopkg: split internal solver out of the install/upgrade functions
  libopkg: move internal solver pkg related functions to    
    pkg_depends_internal.*
  opkg_upgrade_internal.c: remove unused upgrade_pair_t typedef
  test/regress: remove expected failure for issue 156 (internalsolv) and
    162
  test/regress: fix issue50 test
  test/regress: provide better expected error message for issue 50
  tests: remove expected failures for passing tests

 libopkg/Makefile.am                                |   8 +-
 libopkg/opkg_cmd.c                                 |   2 +-
 libopkg/opkg_install.c                             | 652 +--------------------
 libopkg/opkg_install.h                             |   5 -
 libopkg/pkg_depends.c                              | 527 -----------------
 libopkg/pkg_depends.h                              |   8 -
 libopkg/solvers/internal/opkg_action.c             |   3 +-
(Continue reading)

Ankur Tank | 21 Jan 07:01 2016
Picon

Prevent opkg to create multiple copies of debians in offline install

We have am335x based custom board, we are running Linux on it.
we are having opkg as package manager.

opkg.conf looks like below,

src/gz repo file:///home/

dest ram
/tmp
lists_dir ext
/var/opkg-lists
option overlay_root
/overlay


now we run following commands,

opkg-cl -f /tmp/etc/opkg.conf -d ram update



which would update package lists, Then we run following command

opkg-cl -f /tmp/etc/opkg.conf -d ram install localpackage



this command installs the localpackage(local.deb) and its dependencies.

However there is one problem opkg first copies local.deb from /home to /tmp/opkg-xxxxx directory and then extracts it to /tmp and then pre & post post-installation script runs and completes the process.

Now as debians are present on /home(filesystem ext4 on eMMC) and /tmp being on the RAMFS(no sufficient place for package copy and its content) copying of local.deb and its dependencies is waste of memory

Can we avoid it ?

If yes how ?

Any suggestions/pointers?

--
You received this message because you are subscribed to the Google Groups "opkg-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opkg-devel+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Alejandro del Castillo | 13 Jan 00:34 2016

[PATCH] test/regress: add test for issue 8912

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@...>
---
 tests/Makefile             |  1 +
 tests/regress/issue8912.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100755 tests/regress/issue8912.py

diff --git a/tests/Makefile b/tests/Makefile
index 201e5ab..96efb87 100644
--- a/tests/Makefile
+++ b/tests/Makefile
 <at>  <at>  -57,6 +57,7  <at>  <at>  REGRESSION_TESTS := core/01_install.py \
 		    regress/issue165.py \
 		    regress/issue165a.py \
 		    regress/issue165b.py \
+		    regress/issue8912.py \
 		    misc/filehash.py \
 		    misc/update_loses_autoinstalled_flag.py
 RUN_TESTS := $(REGRESSION_TESTS:%.py=run-%.py)
diff --git a/tests/regress/issue8912.py b/tests/regress/issue8912.py
new file mode 100755
index 0000000..376d9d7
--- /dev/null
+++ b/tests/regress/issue8912.py
 <at>  <at>  -0,0 +1,58  <at>  <at> 
+#! /usr/bin/env python3
+#
+# Reporter: alejandro.delcastillo@...
+#
+# What steps will reproduce the problem?
+# ======================================
+#
+# 1.- Create package a, which depends on b and c
+# 2.- Create package b
+# 3.- Create package c, which depends on b
+# 4.- Install a
+# 5.- Remove a with --autoremove
+#
+# What is the expected output? What do you see instead?
+# =====================================================
+#
+# All packages should be removed. Instead, b is left behind.
+#
+
+import os
+import opk, cfg, opkgcl
+
+opk.regress_init()
+
+o = opk.OpkGroup()
+o.add(Package="a", Depends="b, c")
+o.add(Package="b")
+o.add(Package="c", Depends="b")
+
+o.write_opk()
+o.write_list()
+
+opkgcl.update()
+
+opkgcl.install("a")
+if not opkgcl.is_installed("a"):
+        opk.fail("Package 'a' installed but does not report as installed.")
+if not opkgcl.is_installed("b"):
+        opk.fail("Package 'b' should be installed as a dependency of 'a' but does not report as installed.")
+if not opkgcl.is_installed("c"):
+        opk.fail("Package 'c' should be installed as a dependency of 'a' but does not report as installed.")
+
+# Check the packages are marked correctly
+if opkgcl.is_autoinstalled("a"):
+	opk.fail("Package 'a' explicitly installed by user but reports as auto installed.")
+if not opkgcl.is_autoinstalled("b"):
+	opk.fail("Package 'b' installed as a dependency but does not report as auto installed.")
+if not opkgcl.is_autoinstalled("c"):
+	opk.fail("Package 'c' installed as a dependency but does not report as auto installed.")
+
+# Check that autoinstalled packages are removed properly
+opkgcl.remove("a","--autoremove")
+if opkgcl.is_installed("a"):
+        opk.fail("Package 'a' removed but reports as installed.")
+if opkgcl.is_installed("b"):
+        opk.xfail("Package 'b' not removed from --autoremove.")
+if opkgcl.is_installed("c"):
+        opk.fail("Package 'c' not removed from --autoremove.")
--

-- 
1.9.1

Alejandro del Castillo | 13 Jan 00:12 2016

[PATCH] pkg_get_provider_replacees: do not add installed pkg to replacee list

If package A replaces provider B, and B is provided by A,
pkg_get_provider_replacees incorrectly adds A to the list of B replacees
when A is installed. During an upgrade, pacakge A is removed during
pkg_remove_installed_replacees, then once more during the package
upgrade.

Add check to skip the insertion of package A into the replacees vector
in pkg_get_provider_replacees.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@...>
---
 libopkg/opkg_install.c     | 13 +++++++++----
 tests/Makefile             |  1 +
 tests/regress/issue8913.py | 44 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 4 deletions(-)
 create mode 100755 tests/regress/issue8913.py

diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index 4579771..e4367a6 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
 <at>  <at>  -1357,10 +1357,15  <at>  <at>  static void pkg_get_provider_replacees(pkg_t * pkg,
             continue;
         for (j = 0; j < ap->pkgs->len; j++) {
             pkg_t *replacee = ap->pkgs->pkgs[j];
-            int installed = (replacee->state_status == SS_INSTALLED)
-                    || (replacee->state_status == SS_UNPACKED);
-            if (installed)
-                pkg_vec_insert(replacees, replacee);
+            pkg_t *old = pkg_hash_fetch_installed_by_name(pkg->name);
+            /* skip pkg if installed: it  will be removed during upgrade
+             * issue 8913 */
+            if (old != replacee) {
+                int installed = (replacee->state_status == SS_INSTALLED)
+                        || (replacee->state_status == SS_UNPACKED);
+                if (installed)
+                    pkg_vec_insert(replacees, replacee);
+            }
         }
     }
 }
diff --git a/tests/Makefile b/tests/Makefile
index 201e5ab..f6ba076 100644
--- a/tests/Makefile
+++ b/tests/Makefile
 <at>  <at>  -57,6 +57,7  <at>  <at>  REGRESSION_TESTS := core/01_install.py \
 		    regress/issue165.py \
 		    regress/issue165a.py \
 		    regress/issue165b.py \
+		    regress/issue8913.py \
 		    misc/filehash.py \
 		    misc/update_loses_autoinstalled_flag.py
 RUN_TESTS := $(REGRESSION_TESTS:%.py=run-%.py)
diff --git a/tests/regress/issue8913.py b/tests/regress/issue8913.py
new file mode 100755
index 0000000..aaa940f
--- /dev/null
+++ b/tests/regress/issue8913.py
 <at>  <at>  -0,0 +1,44  <at>  <at> 
+#! /usr/bin/env python3
+#
+# Reporter: alejandro.delcastillo@...
+#
+# What steps will reproduce the problem?
+# ======================================
+#
+# 1.- Create package a (v 1.0) that Provides b and c, Replaces b, Conflicts with b.
+#         install it
+# 2.- Create package a (v 2.0) that Provides b and c, Replaces b, Conflicts with b.
+#         upgrade
+#
+# What is the expected output? What do you see instead?
+# =====================================================
+#
+# Upgrade fails
+#
+
+import os
+import opk, cfg, opkgcl
+
+opk.regress_init()
+
+o = opk.OpkGroup()
+o.add(Package="a", Version="1.0", Provides="b, c", Replaces="b", Conflicts="b")
+o.write_opk()
+o.write_list()
+
+opkgcl.update()
+
+opkgcl.install("a", "--force-postinstall")
+
+o = opk.OpkGroup()
+o.add(Package="a", Version="2.0", Provides="b, c", Replaces="b", Conflicts="b")
+o.write_opk()
+o.write_list()
+
+opkgcl.update()
+status = opkgcl.upgrade("--force-postinstall")
+
+if not opkgcl.is_installed("a", "2.0"):
+	opk.fail("New version of package 'a' available during upgrade but was not installed")
+
+opkgcl.remove("a")
--

-- 
1.9.1

Haris Okanovic | 7 Jan 01:29 2016

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

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@...>
Cc: Alejandro del Castillo <alejandro.delcastillo@...>
Cc: Paul Barker <paul@...>
---
 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
 <at>  <at>  -328,7 +328,7  <at>  <at>  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) {
 <at>  <at>  -352,10 +352,13  <at>  <at>  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++) {
 <at>  <at>  -379,9 +382,12  <at>  <at>  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
 <at>  <at>  -85,6 +85,7  <at>  <at>  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
 <at>  <at>  -107,6 +107,7  <at>  <at>  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

Haris Okanovic | 7 Jan 01:28 2016

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

Usage: opkg-graph-deps [-h] [-o feed.dot] [-u <base feed URL>] <paths to
Packages>

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 <haris.okanovic@...>
Cc: Alejandro del Castillo <alejandro.delcastillo@...>
Cc: Paul Barker <paul@...>
Cc: Ken Sharp <ken.sharp@...>
Cc: Richard Tollerton <rich.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 0000000..c42e7ce
--- /dev/null
+++ b/opkg-graph-deps
 <at>  <at>  -0,0 +1,246  <at>  <at> 
+#!/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 <base feed URL>] '
+        '<paths to Packages>' )
+    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': 
+        usage(more=True)
+    elif optkey == '-o': 
+        dot_filename = optval
+    elif optkey == '-u':
+        feed_url = optval
+
+if not index_files:
+    print >>sys.stderr, 'Must specify a path to at least one Packages file'
+    usage()
+
+def split_dep_list(lst):
+    '''
+    Splits a comma-space delimited list, retuning only the first item.
+    E.g. 'foo (>= 1.2), bar, lab (x)' yields ['foo', 'bar', 'lab']
+    '''
+    if not lst:
+        lst = ''
+
+    res = []
+
+    splitLst = lst.split(',')
+    for itm in splitLst:
+        itm = itm.strip()
+        if not itm:
+            continue
+        itmSplit = itm.split()
+        res.append(itmSplit[0])
+
+    return res
+
+# define the graph
+graph = pydot.Dot(graph_name='ipkFeed', graph_type='digraph')
+graph.set_node_defaults(shape='rectangle', style='solid', color='black')
+graph.set_edge_defaults(style='solid', color='black')
+
+def pkg_architectcture(pkg):
+    return str(pkg.architecture or '?')
+
+def pkg_label(pkg, includeArch=True, includeVersion=False, includePath=False, multiLine=False):
+    label = str(pkg.package or '?')
+    if multiLine:
+        label += '\\n'
+    if includeArch:
+        label += '[%s]' % pkg_architectcture(pkg)
+    if includeVersion:
+        label += '[%s]' % (pkg.version or '?')
+    if includePath:
+        label += '[%s]' % (pkg.fn or '?')
+    return label
+
+def add_package_to_graph(pkg, missing=False):
+    if not pkg.package:
+        raise Exception('Invalid package name')
+
+    node = pydot.Node(pkg.package)
+
+    node.set('label', pkg_label(pkg,
+        includeVersion=(not missing),
+        includeArch=(not missing),
+        multiLine=True) )
+
+    if missing:
+        node.set('ipkMissing', '1')
+        node.set('style', 'dotted')
+        node.set('color', 'red')
+
+    node.set('ipkVersion', pkg.version or 'none')
+    node.set('ipkArchitecture', pkg_architectcture(pkg))
+
+    if feed_url and pkg.filename:
+        node.set('href', '%s/%s' % (feed_url, pkg.fn) )
+
+    graph.add_node(node)
+
+def add_dependency_to_graph(fromPkg, toPkg, alias=None, broken=False):
+        edge = pydot.Edge(fromPkg.package, toPkg.package)
+
+        if alias:
+            edge.set('ipkAlias', alias)
+            edge.set('style', 'dashed')
+
+        if broken:
+            edge.set('ipkBrokenDep', '1')
+            edge.set('style', 'dotted')
+            edge.set('color', 'red')
+
+        graph.add_edge(edge)
+
+# the feed
+pkg_map = {}
+alias_pkg_map = {}
+missing_pkg_map = {}
+real_pkg_replace_count = 0
+broken_dep_count = 0
+
+# populate pkg_map with all real packages defined in the indexes
+#  do this first for all indexes before updating alias_pkg_map and
+#  adding nodes to apply any replacements
+for indexFilePath in index_files:
+    feedDir = os.path.dirname(indexFilePath)
+    feedDir = os.path.relpath(feedDir, start=os.getcwd())
+
+    packages = opkg.Packages()
+    packages.read_packages_file(indexFilePath)
+
+    # add each package
+    for pkgKey in packages.keys():
+        pkg = packages[pkgKey]
+
+        # save package filename relative to sub-feed dir
+        pkg.fn = os.path.join(feedDir, pkg.filename)
+
+        if pkg.package in pkg_map:
+            # pkg is being replaced
+            replacedPkg = pkg_map[pkg.package]
+
+            real_pkg_replace_count = real_pkg_replace_count + 1
+            print >>sys.stderr, "Duplicate package: Replacing %s with %s" % (
+                pkg_label(replacedPkg, includePath=True),
+                pkg_label(pkg, includePath=True) )
+
+        pkg_map[pkg.package] = pkg
+
+# populate alias_pkg_map with all real+alias packages defined in the indexes
+# add nodes to graph
+for pkgKey, pkg in pkg_map.iteritems():
+    # Add the real package
+    alias_pkg_map[pkg.package] = pkg
+
+    # Add any aliases
+    for alias in split_dep_list(pkg.provides):
+        if alias in alias_pkg_map:
+            oldAliasPkg = alias_pkg_map[alias]
+
+            if pkg == oldAliasPkg:
+                # weird, not an error, but worth documenting
+                print >>sys.stderr, "Self alias: %s" % pkg_label(pkg)
+            else:
+                print >>sys.stderr, "Replacing alias: %s (%s) with %s" % (
+                    alias, pkg_label(oldAliasPkg), pkg_label(pkg) )
+
+        alias_pkg_map[alias] = pkg
+
+    add_package_to_graph(pkg)
+
+# create stub packages in alias_pkg_map for broken deps
+# add them to missing_pkg_map
+# add nodes to graph
+for pkgKey, pkg in pkg_map.iteritems():
+    for depName in split_dep_list(pkg.depends):
+        if not depName in alias_pkg_map:
+            broken_dep_count = broken_dep_count + 1
+            print >>sys.stderr, "Broken dependency: %s --> %s (missing)" % (
+                pkg_label(pkg), depName )
+
+            stub = opkg.Package()
+            stub.package = depName
+
+            # don't update pkg_map, stub is not a real package
+            alias_pkg_map[stub.package] = stub
+            missing_pkg_map[stub.package] = stub
+
+            add_package_to_graph(stub, missing=True)
+
+# process dependencies
+# add edges to graph
+for pkgKey, pkg in pkg_map.iteritems():
+    for depName in split_dep_list(pkg.depends):
+        depPkg = alias_pkg_map[depName]
+
+        add_dependency_to_graph(pkg, depPkg,
+            alias=(depName if (depName != depPkg.package) else None),
+            broken=(depPkg.package in missing_pkg_map) )
+
+# Results
+print "%s packages" % len(pkg_map.keys())
+print "%s aliases" % len(alias_pkg_map)
+print "%s replaced packages" % real_pkg_replace_count
+print "%s broken dependencies" % broken_dep_count
+
+# Write the graph
+graph.write(path=dot_filename)
+print "Graphed at %s" % dot_filename
--

-- 
2.6.2

Alejandro del Castillo | 10 Dec 18:19 2015

[PATCH] configure.ac: use pkg-config for libsolv

Libsolv supports pkgconfig since version 0.6.9.
---
 configure.ac | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index ef86423..47f5e0c 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -143,20 +143,9  <at>  <at>  if test "x$with_libsolv" != "xno"; then
         AC_MSG_ERROR(External solver support not compatable with deprecated libopkg API!)
     fi

-    SOLVER_CFLAGS=""
-    SOLVER_LIBS=""
     AC_MSG_CHECKING([for solver])
     AC_MSG_RESULT(libsolv)
-    SOLVER_CFLAGS="-I/usr/local/include/"
-    SOLVER_LIBS="-lsolv -lsolvext"
-    AC_CHECK_LIB([solv],
-                 [solver_solve],
-                 [],
-                [AC_MSG_ERROR(libsolv not found)])
-    dnl TODO: remove previous 6 lines and uncomment line below to use
-    dnl pkg-config once there is a release of libsolv with pkg-config:
-    dnl PKG_CHECK_MODULES(SOLVER, libsolv)
-
+    PKG_CHECK_MODULES(SOLVER, libsolv)
     AC_DEFINE(HAVE_SOLVER_LIBSOLV,1,[Define if you want to use libsolv])
     AC_SUBST(SOLVER_CFLAGS)
     AC_SUBST(SOLVER_LIBS)
--

-- 
1.9.1

Alejandro del Castillo | 9 Dec 20:54 2015

[PATCH] libsolv_solver_set_arch_policy: use correct logic during archs resizing

If there are more than INITIAL_ARCH_LIST_SIZE archs defined in the
configuration, libsolv_solver_set_arch_policy crashes due to flawed
logic when resizing the archs array.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@...>
---
 libopkg/solvers/libsolv/opkg_solver_libsolv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libopkg/solvers/libsolv/opkg_solver_libsolv.c b/libopkg/solvers/libsolv/opkg_solver_libsolv.c
index d3f39c1..2a5a5e7 100644
--- a/libopkg/solvers/libsolv/opkg_solver_libsolv.c
+++ b/libopkg/solvers/libsolv/opkg_solver_libsolv.c
 <at>  <at>  -199,8 +199,10  <at>  <at>  static void libsolv_solver_set_arch_policy(libsolv_solver_t *libsolv_solver)
     nv_pair_list_elt_t *arch_info;

     list_for_each_entry(arch_info, &opkg_config->arch_list.head, node) {
-        if (arch_count > arch_list_size)
-            archs = xrealloc(archs, arch_list_size *= 2);
+        if (arch_count >= arch_list_size) {
+            arch_list_size *= 2;
+            archs = xrealloc(archs, arch_list_size * sizeof(arch_data_t));
+        }

         archs[arch_count].arch = ((nv_pair_t *)(arch_info->data))->name;
         archs[arch_count].priority = atoi(((nv_pair_t *)
--

-- 
1.9.1

Alejandro del Castillo | 4 Dec 20:41 2015

[PATCH] configure.ac: Bump version to 0.3.2-SNAPSHOT

Previous release didn't have the correct version. Adjust version for the
0.3.2 release.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@...>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index c0016fe..ef86423 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -1,5 +1,5  <at>  <at> 
 # Process this file with autoconf to produce a configure script
-AC_INIT([opkg], [0.3.0])
+AC_INIT([opkg], [0.3.2-SNAPSHOT])
 AC_CONFIG_SRCDIR([libopkg/pkg.c])

 AC_CONFIG_AUX_DIR([conf])
--

-- 
1.9.1

Alejandro del Castillo | 4 Dec 01:01 2015

Opkg-0.3.1 release

Hi all,

I would like to announce the release of opkg-0.3.1. The release is
available at the yocto project download page:

http://downloads.yoctoproject.org/releases/opkg/

I also would like to announce the branching strategy moving forward.
Currently, we have master, opkg-0.3.x and opkg-0.2.x. While it makes
sense to keep opkg-0.2.x around in case there are changes needed there,
I think opkg-0.3.x is not currently needed and just complicates the
process. I am planning on deleting the branch and have the 0.3.x
releases only be tags on master. Once we move to 0.4, if needed, I can
create a 0.3.x branch to receive fixes. Let me know if there are any
objections to the strategy.

Release notes for opkg-0.3.1
==========

- Libsolv backend support. Add --enable-solver=libsolv config option to
have opkg use the external solver libsolv. This feature is fully
functional, but in experimental stage.

- Cache filenames are now based on the path md5sum instead of the full
path, to fix errors on long filepaths.

- Fix several memory leaks

- Add --host-cache-dir and --cache-dir command line flag to change the
cache directory location

- Fix error when processing empty Package.gz files.

--

-- 
Cheers,

Alejandro


Gmane