NAME
Slackware::SBoKeeper::Database - Read/write sbokeeper databases
SYNOPSIS
use Slackware::SBoKeeper::Database;
my $database = Slackware::SBoKeeper::Database->new($file, $repo);
...
DESCRIPTION
Slackware::SBoKeeper::Database is a module that handles reading and writing sbokeeper package database files. It is not meant to be used outside of sbokeeper. For user documentation of sbokeeper, please consult its manual.
SUBROUTINES/METHODS
new($path, $sbodir)
Returns blessed Slackware::SBoKeeper::Database object. $path is the path to a file containing sbokeeper data. If $path is '', creates an empty database. $sbodir is the directory where the SBo repository is stored.
add($pkgs, $manual)
Add array ref of pkgs and their dependencies to object. If $manual is true, $pkgs are set to manually added (dependencies are still not).
Returns array of packages added.
tack($pkgs, $manual)
Add array ref of pkgs to database. $manual determines whether they are marked as manually added or not. Does not pull in dependencies.
Returns array of packages added.
remove($pkgs)
Remove array ref pkgs from object. Dependencies pulled in from removed packages will still remain.
Returns array of packages removed.
depadd($pkg, $deps)
Add array ref $deps to $pkg's dependencies. $deps must be a list of packages already present in the database.
Returns list of dependencies added to $pkg.
depremove($pkg, $deps)
Removes array ref $deps from $pkg's dependency list.
Returns list of dependencies removed.
has($pkg)
Returns 1 or 0 depending on whether $pkg is currently in the database.
packages($category)
Returns array of added packages that are in $category. The following are valid categories:
- all
-
All packages present in database.
- manual
-
All packages that were added manually.
- nonmanual
-
All packages that were not added manually.
- necessary
-
Packages that were either manually added or dependencies of a manually added package.
- unnecessary
-
Packages that were neither manually added or dependencies of a manually added package.
- missing
-
Packages that are not present in the database but are needed by packages in the database.
If $category is omitted, do the same thing as 'all'.
missing()
Returns hash of packages and their missing dependencies, according to the SlackBuild repo.
extradeps()
Returns hash of packages with extra dependencies. An extra dependency is a dependency that is not required by the package in the SlackBuild repo.
is_necessary($pkg)
Checks to see if $pkg is necessary (manually added or dependency on a manually added package). Returns 1 for yes, 0 for no.
is_dependency($dep, $of)
Checks to see if $dep is a dependency (or a dependency of a dependency, etc.) of $of. Returns 1 for yes, 0 for no.
$dep and $of must already be added to the object.
is_manual($pkg)
Checks if $pkg is manually installed. Returns 1 for yes, 0 no.
exists($pkg)
Checks if $pkg is present in repo. Returns 1 for yes, 0 for no.
dependencies($pkg)
Returns list of packages that are a dependency of $pkg, according to the database.
immediate_dependencies($pkg)
Returns list of packages that are an immediate dependency of $pkg, according to the database. Does not return dependencies of those dependencies.
real_dependencies($pkg)
Returns list of packages that are a dependency of $pkg, according to the SlackBuild repo. $pkg does not have to have been added previously.
real_immediate_dependencies($pkg)
Returns list of packages that are an immediate dependency of $pkg, according to the SlackBuild repo. Does not return packages that are dependencies of those dependencies. $pkg does not have to have been added previously.
unmanual($pkg)
Unset $pkg as manually installed. Returns 1 if successful, 0 if not.
write($path)
Write data file to $path.
AUTHOR
Written by Samuel Young <samyoung12788@gmail.com>.
BUGS
This module does not know how to handle circular dependencies. This should not be a problem if you stick with the official SlackBuild repo. One should exercise caution when using the depadd method, as it can easily introduce circular dependencies.
Report bugs on my Codeberg, https://codeberg.org/1-1sam.
COPYRIGHT
Copyright (C) 2024 Samuel Young
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.