Radix cross Linux package tools

Package Tools – is a set of utilities to create, install, and update RcL packages

3 Commits   0 Branches   2 Tags
author: kx <kx@radix.pro> 2023-04-11 01:18:34 +0300 committer: kx <kx@radix.pro> 2023-04-11 01:18:34 +0300 commit: 11c606a6888dc269ef018359469a7276c3ad8f67 parent: 8c55752ed5b29a22fdab9faaa6ff27b7cafa6791
Commit Summary:
Version 0.2.1
Diffstat:
1 file changed, 121 insertions, 0 deletions
diff --git a/src/pkglist.h b/src/pkglist.h
new file mode 100644
index 0000000..2688a70
--- /dev/null
+++ b/src/pkglist.h
@@ -0,0 +1,169 @@
+
+/**********************************************************************
+
+  Copyright 2019 Andrey V.Kosteltsev
+
+  Licensed under the Radix.pro License, Version 1.0 (the "License");
+  you may not use this file  except  in compliance with the License.
+  You may obtain a copy of the License at
+
+     https://radix.pro/licenses/LICENSE-1.0-en_US.txt
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  implied.
+
+ **********************************************************************/
+
+#ifndef _PKG_LIST_H_
+#define _PKG_LIST_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <dlist.h>
+
+
+enum _tree_format {
+  TFMT_BIN = 0,
+  TFMT_DAG,
+
+  TFMT_UNKNOWN
+};
+
+enum _procedure
+{
+  INSTALL = 0, /* 'install' */
+  UPDATE       /* 'update'  */
+};
+
+enum _priority
+{
+  REQUIRED = 0, /* synonims: REQUIRED    | required    | REQ | req */
+  RECOMMENDED,  /* synonims: RECOMMENDED | recommended | REC | rec */
+  OPTIONAL,     /* synonims: OPTIONAL    | optional    | OPT | opt */
+  SKIP          /* synonims: SKIP        | skip        | SKP | skp */
+};
+
+
+struct pkginfo
+{
+  char   *name;
+  char   *version;
+  char   *arch;
+  char   *distro_name;
+  char   *distro_version;
+  char   *group;
+  char   *short_description;
+  char   *url;
+  char   *license;
+  size_t  uncompressed_size; /* size in 1024-byte blocks */
+  size_t  compressed_size;   /* size in bytes            */
+  int     total_files;
+};
+
+struct pkg
+{
+  char *group;
+  char *name;
+  char *version;
+
+  enum  _procedure procedure; /* install procedure */
+};
+
+struct references
+{
+  int    size;
+  struct dlist *list; /* list of pkg structs */
+};
+
+struct requires
+{
+  int    size;
+  struct dlist *list; /* list of pkg structs */
+};
+
+struct files
+{
+  int    size;
+  struct dlist *list;     /* list of strings */
+};
+
+
+struct package
+{
+  struct pkginfo *pkginfo;
+
+  char  *hardware;      /* optional parameter for JSON */
+
+  char  *tarball;
+  enum  _procedure procedure; /* install procedure     */
+  enum  _priority  priority;  /* install user priority */
+
+  struct references *references;
+  struct requires   *requires;
+
+  char  *description;
+
+  char  *restore_links;
+  char  *install_script;
+
+  struct files *files;
+};
+
+
+extern char *htmlroot;
+extern char *hardware;
+extern int   minimize;
+
+extern char *strprio( enum _priority priority, int short_name );
+extern char *strproc( enum _procedure procedure );
+
+extern struct dlist *tarballs;
+
+extern void add_tarball( char *tarball ); /* append the tarballs list */
+extern void free_tarballs( void );
+extern const char *find_tarball( const char *name );
+extern void print_tarballs( void );
+
+
+extern struct dlist *srcpkgs;
+
+extern struct pkg *pkg_alloc( void );
+extern void pkg_free( struct pkg *pkg );
+
+extern void add_srcpkg( struct pkg *pkg );
+extern void free_srcpkgs( void );
+
+extern struct dlist *packages;
+
+extern struct package *package_alloc( void );
+extern void package_free( struct package *package );
+
+extern void add_reference( struct package *package, struct pkg *pkg );
+extern void add_required( struct package *package, struct pkg *pkg );
+extern void add_file( struct package *package, const char *fname );
+extern void package_print_references( struct package *package );
+extern void package_print_requires( struct package *package );
+extern void package_print_files( struct package *package );
+
+extern void add_package( struct package *package ); /* append the packages list */
+extern void free_packages( void );
+
+
+extern struct dlist *provides;
+extern struct dlist *extern_requires;
+
+extern  int create_provides_list( struct dlist *srcpkgs );
+extern void print_provides_list( const char *plist_fname );
+extern void print_provides_tree( const char *json_fname, enum _tree_format tree_format );
+extern void free_provides_list( void );
+
+
+#ifdef __cplusplus
+}  /* ... extern "C" */
+#endif
+
+#endif /* _PKG_LIST_H_ */