mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-23 15:06:15 +02:00
qpkg: added parsing and recording of Provides data
- pkg.h (enum flags): new flags QPKG_PROVIDED to indicate that the package is only a provision, not an installable package - fixup.h, fixup.c (complete_provisions): search for provisions that do not have a real package associated with them, create a package for them, and mark it as QPKG_PROVIDED - qpkg.c (do_fixups): invoke complete_provisions - pkg.h (struct pkg): add list of (virtual or real) packages a given package provides - pkg.c (new_pkg): initialize pkg->provides - pkg.c (free_pkg): deallocate pkg->provides - gobble.c (gobble_buf): parse the list of packages a package provides - TODO: updated status of Provides support
This commit is contained in:
parent
bbf9c42bc8
commit
9d208dd855
@ -6,6 +6,9 @@ Still left to do
|
||||
|
||||
- handle Provides:
|
||||
|
||||
Update: Provides data is now parsed and properly integrated in the
|
||||
package database, but not yet used to resolve prerequisites.
|
||||
|
||||
- sort prerequisites such that they can be installed in the specified order
|
||||
|
||||
- consider Architecture:
|
||||
|
11
qpkg/fixup.c
11
qpkg/fixup.c
@ -42,3 +42,14 @@ void sort_versions(void)
|
||||
(*b)->more = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void complete_provisions(void)
|
||||
{
|
||||
struct jrb *n;
|
||||
|
||||
for (n = jrb_first(packages->root); n != jrb_nil(packages->root);
|
||||
n = jrb_next(n))
|
||||
if (!n->val)
|
||||
new_pkg(n)->flags |= QPKG_PROVIDED;
|
||||
}
|
||||
|
@ -14,5 +14,6 @@
|
||||
#define FIXUP_H
|
||||
|
||||
void sort_versions(void);
|
||||
void complete_provisions(void);
|
||||
|
||||
#endif /* !FIXUP_H */
|
||||
|
@ -321,8 +321,13 @@ architecture:
|
||||
goto skip_data;
|
||||
|
||||
provides:
|
||||
/* @@@ later */
|
||||
goto skip_data;
|
||||
anchor = &pkg->provides;
|
||||
/*
|
||||
* There should never be a version in the provisions, so it's a bit
|
||||
* wasteful to use a structure that has a version field. But then, code
|
||||
* reuse is nice, too.
|
||||
*/
|
||||
goto list_with_version;
|
||||
|
||||
status:
|
||||
pkg->flags |= QPKG_INSTALLED;
|
||||
|
@ -30,7 +30,7 @@ struct pkg *new_pkg(struct jrb *jrb)
|
||||
jrb->val = pkg;
|
||||
pkg->version = NULL;
|
||||
pkg->arch = NULL;
|
||||
pkg->conflicts = pkg->depends = NULL;
|
||||
pkg->conflicts = pkg->depends = pkg->provides = NULL;
|
||||
pkg->filename = NULL;
|
||||
pkg->flags = 0;
|
||||
pkg->mark = 0;
|
||||
@ -55,5 +55,6 @@ void free_pkg(struct pkg *pkg)
|
||||
{
|
||||
free_refs(pkg->conflicts);
|
||||
free_refs(pkg->depends);
|
||||
free_refs(pkg->provides);
|
||||
free(pkg);
|
||||
}
|
||||
|
@ -19,8 +19,9 @@
|
||||
|
||||
|
||||
enum flags {
|
||||
/* parse-time flags */
|
||||
/* parse-time and fixup-time flags */
|
||||
QPKG_INSTALLED = 1 << 0, /* installed on target */
|
||||
QPKG_PROVIDED = 1 << 1, /* virtual package */
|
||||
|
||||
/* run-time flags */
|
||||
QPKG_ADDING = 1 << 10, /* resolving dependencies */
|
||||
@ -47,6 +48,7 @@ struct pkg {
|
||||
const char *arch;
|
||||
struct ref *conflicts;
|
||||
struct ref *depends;
|
||||
struct ref *provides;
|
||||
const char *filename;
|
||||
int flags; /* see enum flags */
|
||||
struct pkg *more;
|
||||
|
@ -121,6 +121,7 @@ static void find_prereq(const char *name, const char *version)
|
||||
static void do_fixups(void)
|
||||
{
|
||||
sort_versions();
|
||||
complete_provisions();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user