1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-24 23:37:31 +02:00
Commit Graph

22 Commits

Author SHA1 Message Date
Werner Almesberger
326cd33967 qpkg/: committed some old changes (non-functional)
- TODO: various updates
- pkg.h (enum relop): marked rel_lt as deprecated
- prereq.c (resolve): instrumentation for chasing a dependencies bug
2011-07-23 11:45:24 -03:00
Werner Almesberger
068264ed61 qpkg: light cleanup of prereq.c:resolve and change forgotten in last commit
- prereq.c (resolve): do not consider installing virtual packages
  (forgotten in previous commit)
- prereq.c (resolve): renamed "next_dep" to "next_deps" to emphasize that
  this is a list
- prereq.c (resolve): use "break" instead of "return" to abandon a
  non-optimal path, so that we'll run future cleanup code
- prereq.c (resolve): fixed typos in explanation of QPKG_ADDING cleanup
- prereq.c (resolve): reference test/bug-adding in explanation
2010-11-22 21:18:33 -03:00
Werner Almesberger
bbf9c42bc8 qpkg: move "struct pkg" and its allocation from gobble.c and qpkg.h to pkg.[hc]
- Makefile (OBJS_qpkg): added pkg.o
- gobble.c (gobble_buf): moved "struct pkg" allocation to function new_pkg
  in pkg.c
- qpkg.h: moved "struct pkg" and subordinate structures to pkg.h
- pkg.h, pkg.c (new_pkg, free_pkg): provide package structure definition,
  allocation, and deallocation
- fixup.c, gobble.c, prereq.c, qpkg.c: include "pkg.h"
- gobble.c (finish_pkg): use free_pkg instead of just "free" to avoid
  leaking memory
2010-11-22 16:19:32 -03:00
Werner Almesberger
b89bcdfd93 qpkg: also consider conflicts introduced by package about to be added
- prereq.c (conflicts, resolve, prereq): renamed "conflicts" to
  "old_conflicts"
- prereq.c (new_conflicts, resolve, prereq): also test whether any of the
  conflicts of the package we're about to add matches an installed or
  considered package
- test/conflict, test/instconf: test for conflicts introduced by package
  about to be added
2010-11-22 06:52:53 -03:00
Werner Almesberger
c44510ade1 qpkg: detect conflicts with installed packages
- prereq.c (installed_conflicts, free_conflicts, prereq): collect list of
  pre-existing conflicts in installed packages
- prereq.c (prereq): check if package being requested already conflicts
- test/instconf: regression test for conflicts with installed packages
- TODO: updated for full support of conflicts. Mention that we're not
  terribly efficient with handling conflicts.
2010-11-21 23:59:27 -03:00
Werner Almesberger
be31904f5d qpkg: adding handling of conflicts (in progress)
- prereq.c (conflicts): detect conflicts
- prereq.c (prereq): pass list of conflicts of initial package
- test/conflict: regression test for basic conflict handling
- TODO: updated for partial implementation of conflicts
2010-11-21 23:24:44 -03:00
Werner Almesberger
dd8bb6eecd qpkg: moved comp_versions from prereq.c to id.c
- id.c: added section titles
- prereq.c (comp_versions), id.h, id.c: moved comp_versions from prereq.c
  to id.c, to allow sharing with other code
2010-11-21 21:14:04 -03:00
Werner Almesberger
a0c0e854cc qpkg: option -d to enable debugging at run time, and some cleanup
- prereq.c: added section titles
- prereq.c (debug), qpkg.h, qpkg.c: made variable "debug" global and moved
  it to qpkg.c
- qpkg.c (usage, main): new option -d to enable debugging
2010-11-21 20:55:25 -03:00
Werner Almesberger
e1404bb6a2 qpkg/prereq.c (print_debug, resolve): moved debug output to separate function 2010-11-21 20:48:24 -03:00
Werner Almesberger
0bc4b6046b qpkg: added detection of cyclic dependencies
We define a cyclic dependency as the possibility (!) of the prerequisites
of a package X including a package that depends on X, and issue an error
if encountering such a situation.

Note that, if the dependencies of X can be resolved in a manner that does
not include the cyclic dependency, qpkg will still fail if it encounters
the cycle. Also note that qpkg (at least so far) does no perform an
exhaustive search to ferret out cyclic dependencies.

Furthermore, we don't consider that a cyclic dependency may not necessarily
imply a real life problem. E.g., if a package A contains elements X and
Y, with X needing package B, and the content of package B has a run-time
dependency on Y, the cyclic dependency between A and B would not exist
when considering its constituents. Since we don't have this information, we
just err on the side of caution.

- qpkg.h (enum flags): divide flags into categories (parse-time and
  run-time) and add flag QPKG_ADDING to mark packets whose dependencies we
  are processing
- prereq.c (resolve, prereq): track which packages we're tentatively
  considering for installation and detect cyclic dependencies
- test/cyclic: regression test for detection of cyclic dependencies
- TODO: updated with recent changes
2010-11-21 20:31:20 -03:00
Werner Almesberger
0229051f07 qpkg: change prerequisite resolution order to be fully depth-first
Until now, when considering adding a package, we processed its
dependencies after completing the current list of dependencies. E.g.,
if we had a package A that depended on B and C, B depended on D, and C
depended on E, then the sequence would have been A, B, C, ...

We now process the dependencies of a package immediately after
considering the package, so the sequence above would become A, B, D,
C, ...

The advantage of the new order is that it becomes easier to follow the
dependency tree, which will be beneficial for loop detection and for
ordering packages by installation order.

- prereq.c (resolve): change prerequisite resolution order such that the
  dependencies of the package being considered are processed immediately,
  instead of deferring them until the end of the current dependency list
- prereq.c (prereq): we can now pass the list of dependencies directly,
  without needing a list of lists element
- test/resorder: test resolution order
2010-11-21 17:34:17 -03:00
Werner Almesberger
9272f5057d qpkg/prereq.c (resolve): cleaned up the debugging output mechanism 2010-11-21 10:26:17 -03:00
Werner Almesberger
5a0444fd7e qpkg/prereq.c (prereq): removed confused false error avoidance
The original idea was to just copy "stack" (now called "installed") to
"best" when done. In this case, "best" would remain NULL if "install"
had no entries, which would then be interpreted as a failure to resolve
the prerequisites.

However, since we allocate a new list for "best" anyway, this concern
no longer exists, and we can also get rid of the contorted mechanism
that was designed to work around this problem. (It was never put into
action because I wanted to make a regression test for it first.)

- prereq.c (prereq): removed commented-out and nonsensical avoidance of
  false error
- test/prereq: added test case with no prerequisite
2010-11-21 10:22:37 -03:00
Werner Almesberger
d0a1a9e82f qpkg: rearrange things in prereq.c to free the stack paradigm for other uses
- prereq.c (stack, epoch, push, pop, resolve, prereq): renamed to
  "installs"
- prereq.c (n_stack, stack_max, push, pop, resolve, prereq): changed
  "stack" to "install"
- prereq.c (push): renamed "push" to "append_install"
- prereq.c (pop): renamed "pop" to "backtrack"
2010-11-21 10:22:37 -03:00
Werner Almesberger
dd0ee66304 qpkg: give ID2S macro a more "offical" status
- prereq.c (ID2S), id.h (ID2PF): renamed ID2S to ID2PF and moved it to id.h
- prereq.c (push, satisfies, resolve): change ID2S to ID2PF
2010-11-21 03:25:53 -03:00
Werner Almesberger
a63823e26a qpkg: turn pkg->installed into pkg->flags, allowing for future expansion
- qpkg.h (enum flags, struct pkg): replaced "installed" with "flags", one
  of them being QPKG_INSTALLED
- gobble.c (compact_pkg, gobble_buf), prereq.c (push, resolve): adapted
  for above change
2010-11-20 12:25:45 -03:00
Werner Almesberger
3d1ef02aba qpkg: added copyright headers and changed name to emphasize speediness
- Makefile, gobble.h, gobble.c, id.h, id.c, prereq.h, prereq.c, qpkg.h,
  qpkg.c, rbtest.c: added copyright header
- id.c: include jrb.h (for completeness)
- README: change name from "Query package databases" to "Quick package
  database query"
2010-11-20 07:29:18 -03:00
Werner Almesberger
64c70e77f4 qpkg: use "val" field of jrb nodes instead of keeping one in "struct id"
- id.h (struct id), id.c (make_id): remove field "value"
- gobble.c (compact_pkg, gobble_buf), prereq.c (list_all_packages,
  list_one_package, find_prereq): use id->jrb->val instead of id->value
2010-11-19 22:02:42 -03:00
Werner Almesberger
a8ed4dcb23 qpkg: use -Wmissing-prototypes
- Makefile (CFLAGS): use -Wmissing-prototypes
- jrb.c (lprev, rprev): made "static"
- prereq.c: include prereq.h
2010-11-19 20:51:49 -03:00
Werner Almesberger
0ca4751b77 qpkg: some cleanup, prerequisite search speedup
With the reduction of search depth, "prereq abiword" takes about 3 minutes
on my PC. (Obviously, this can still be improved.)

- gobble.c (gobble_buf): if pkg->id->value is NULL, just it as such
- prereq.c (push): abort if trying to consider a package already considered
  or installed
- prereq.c (conflicts): before being satisfied with using an installed
  package, make sure it really satisfies the requirement
- prereq.c (conflicts): abort if an installed package conflicts
- prereq.c (conflicts): added some debugging output (temporary)
- prereq.c (conflicts): cut the search if we can't do better than a
  previous match
2010-11-19 15:26:24 -03:00
Werner Almesberger
fe14aa01d5 qpkg/prereq.c (resolve): simplify requisites chaining logic
Tried to keep next_dep at the beginning, but that's actually unnecessary.
The historical background is that the dependency list pointer was
originally thought to point to the list currently being processes. But
since it's a list following it, we don't need to maintain the original
order.
2010-11-19 14:25:33 -03:00
Werner Almesberger
43b9dc1972 qpkg/: initial commit (sneak preview only, doesn't work properly yet) 2010-11-19 14:00:15 -03:00