1
0
Fork 0
mirror of https://github.com/pygos/pkg-utils.git synced 2024-12-22 18:00:49 +01:00

Move dependency graph handling out of install command

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-03-09 00:23:06 +01:00
parent f038cc52b3
commit 90667fbf8a
6 changed files with 41 additions and 32 deletions

View file

@ -1,28 +1,6 @@
/* SPDX-License-Identifier: ISC */
#ifndef INSTALL_H
#define 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 "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,
};
#ifndef DEPGRAPH_H
#define DEPGRAPH_H
struct pkg_dep_node {
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);
#endif /* INSTALL_H */
#endif /* DEPGRAPH_H */

View file

@ -1,7 +1,11 @@
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/depgraph.h
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/depgraph/collect.c main/depgraph/pkglist.c
pkg_SOURCES += main/depgraph/tsort.c
pkg_CFLAGS = $(AM_CFLAGS)
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
# install command
pkg_SOURCES += main/cmd/install/collect.c main/cmd/install/install.c
pkg_SOURCES += main/cmd/install/install.h main/cmd/install/pkglist.c
pkg_SOURCES += main/cmd/install/tsort.c
pkg_SOURCES += main/cmd/install.c
# buildstrategy command
pkg_SOURCES += main/cmd/buildstrategy/buildstrategy.h

View file

@ -1,5 +1,22 @@
/* 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[] = {
{ "root", required_argument, NULL, 'r' },

View file

@ -1,5 +1,10 @@
/* 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)
{

View file

@ -1,5 +1,9 @@
/* 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)
{

View file

@ -1,5 +1,8 @@
/* 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,
struct pkg_dep_node *pkg)