mirror of
https://github.com/pygos/pkg-utils.git
synced 2024-11-22 04:49:46 +01:00
Move dependency graph handling out of install command
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
parent
f038cc52b3
commit
90667fbf8a
6 changed files with 41 additions and 32 deletions
|
@ -1,28 +1,6 @@
|
||||||
/* SPDX-License-Identifier: ISC */
|
/* SPDX-License-Identifier: ISC */
|
||||||
#ifndef INSTALL_H
|
#ifndef DEPGRAPH_H
|
||||||
#define INSTALL_H
|
#define DEPGRAPH_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include "util/util.h"
|
|
||||||
|
|
||||||
#include "filelist/image_entry.h"
|
|
||||||
|
|
||||||
#include "pkgreader.h"
|
|
||||||
#include "command.h"
|
|
||||||
#include "pkgio.h"
|
|
||||||
|
|
||||||
enum {
|
|
||||||
INSTALL_MODE_INSTALL = 0,
|
|
||||||
INSTALL_MODE_LIST_PKG,
|
|
||||||
INSTALL_MODE_LIST_FILES,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct pkg_dep_node {
|
struct pkg_dep_node {
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -52,4 +30,4 @@ int collect_dependencies(int repofd, struct pkg_dep_list *list);
|
||||||
|
|
||||||
int sort_by_dependencies(struct pkg_dep_list *list);
|
int sort_by_dependencies(struct pkg_dep_list *list);
|
||||||
|
|
||||||
#endif /* INSTALL_H */
|
#endif /* DEPGRAPH_H */
|
|
@ -1,7 +1,11 @@
|
||||||
pkg_SOURCES = include/pkgformat.h include/pkgreader.h include/pkgio.h
|
pkg_SOURCES = include/pkgformat.h include/pkgreader.h include/pkgio.h
|
||||||
pkg_SOURCES += include/compressor.h include/command.h include/pkgwriter.h
|
pkg_SOURCES += include/compressor.h include/command.h include/pkgwriter.h
|
||||||
|
pkg_SOURCES += include/depgraph.h
|
||||||
pkg_SOURCES += main/pkg.c main/compressor.c main/command.c main/pkgreader.c
|
pkg_SOURCES += main/pkg.c main/compressor.c main/command.c main/pkgreader.c
|
||||||
pkg_SOURCES += main/pkgwriter.c main/pkgio_rd_image_entry.c main/pkg_unpack.c
|
pkg_SOURCES += main/pkgwriter.c main/pkgio_rd_image_entry.c main/pkg_unpack.c
|
||||||
|
pkg_SOURCES += main/depgraph/collect.c main/depgraph/pkglist.c
|
||||||
|
pkg_SOURCES += main/depgraph/tsort.c
|
||||||
|
|
||||||
pkg_CFLAGS = $(AM_CFLAGS)
|
pkg_CFLAGS = $(AM_CFLAGS)
|
||||||
pkg_LDADD = libutil.a libfilelist.a
|
pkg_LDADD = libutil.a libfilelist.a
|
||||||
|
|
||||||
|
@ -18,9 +22,7 @@ pkg_SOURCES += main/cmd/dump/dump.c main/cmd/dump/dump.h
|
||||||
pkg_SOURCES += main/cmd/dump/dump_header.c
|
pkg_SOURCES += main/cmd/dump/dump_header.c
|
||||||
|
|
||||||
# install command
|
# install command
|
||||||
pkg_SOURCES += main/cmd/install/collect.c main/cmd/install/install.c
|
pkg_SOURCES += main/cmd/install.c
|
||||||
pkg_SOURCES += main/cmd/install/install.h main/cmd/install/pkglist.c
|
|
||||||
pkg_SOURCES += main/cmd/install/tsort.c
|
|
||||||
|
|
||||||
# buildstrategy command
|
# buildstrategy command
|
||||||
pkg_SOURCES += main/cmd/buildstrategy/buildstrategy.h
|
pkg_SOURCES += main/cmd/buildstrategy/buildstrategy.h
|
||||||
|
|
|
@ -1,5 +1,22 @@
|
||||||
/* SPDX-License-Identifier: ISC */
|
/* SPDX-License-Identifier: ISC */
|
||||||
#include "install.h"
|
#include <stdbool.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include "util/util.h"
|
||||||
|
#include "depgraph.h"
|
||||||
|
#include "command.h"
|
||||||
|
#include "pkgio.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
INSTALL_MODE_INSTALL = 0,
|
||||||
|
INSTALL_MODE_LIST_PKG,
|
||||||
|
INSTALL_MODE_LIST_FILES,
|
||||||
|
};
|
||||||
|
|
||||||
static const struct option long_opts[] = {
|
static const struct option long_opts[] = {
|
||||||
{ "root", required_argument, NULL, 'r' },
|
{ "root", required_argument, NULL, 'r' },
|
|
@ -1,5 +1,10 @@
|
||||||
/* SPDX-License-Identifier: ISC */
|
/* SPDX-License-Identifier: ISC */
|
||||||
#include "install.h"
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "pkgreader.h"
|
||||||
|
#include "depgraph.h"
|
||||||
|
|
||||||
int collect_dependencies(int repofd, struct pkg_dep_list *list)
|
int collect_dependencies(int repofd, struct pkg_dep_list *list)
|
||||||
{
|
{
|
|
@ -1,5 +1,9 @@
|
||||||
/* SPDX-License-Identifier: ISC */
|
/* SPDX-License-Identifier: ISC */
|
||||||
#include "install.h"
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "depgraph.h"
|
||||||
|
|
||||||
struct pkg_dep_node *append_pkg(struct pkg_dep_list *list, const char *name)
|
struct pkg_dep_node *append_pkg(struct pkg_dep_list *list, const char *name)
|
||||||
{
|
{
|
|
@ -1,5 +1,8 @@
|
||||||
/* SPDX-License-Identifier: ISC */
|
/* SPDX-License-Identifier: ISC */
|
||||||
#include "install.h"
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "depgraph.h"
|
||||||
|
|
||||||
static void remove_dependency(struct pkg_dep_list *list,
|
static void remove_dependency(struct pkg_dep_list *list,
|
||||||
struct pkg_dep_node *pkg)
|
struct pkg_dep_node *pkg)
|
Loading…
Reference in a new issue