from errors import *
Pakfire = base.Pakfire
+PakfireBuilder = base.PakfireBuilder
def install(requires, ignore_recommended=False, **pakfire_args):
pakfire = Pakfire(**pakfire_args)
return pakfire.grouplist(group)
def _build(pkg, resultdir, **kwargs):
- pakfire = Pakfire(mode="builder", **kwargs)
+ pakfire = PakfireBuilder(**kwargs)
return pakfire._build(pkg, resultdir, **kwargs)
from i18n import _
class Pakfire(object):
+ mode = None
+
RELATIONS = (
(">=", satsolver.REL_GE,),
("<=", satsolver.REL_LE,),
(">" , satsolver.REL_GT,),
)
- def __init__(self, mode=None, path="/", config=None, configs=None, arch=None,
+ def __init__(self, path="/", config=None, configs=None, arch=None,
enable_repos=None, disable_repos=None, **kwargs):
- # Set the mode.
- assert mode in ("normal", "builder", "server",)
- self.mode = mode
-
# Check if we are operating as the root user.
self.check_root_user()
self.path = path
# Configure the instance of Pakfire we just started.
- if mode == "builder":
+ if self.mode == "builder":
self.path = os.path.join(BUILD_ROOT, util.random_string())
- elif mode == "normal":
+ elif not mode:
# check if we are actually running on an ipfire system.
if self.path == "/":
self.check_is_ipfire()
# Process the transaction.
t.run()
+
+
+class PakfireBuilder(Pakfire):
+ mode = "builder"
+
+
+class PakfireServer(Pakfire):
+ mode = "server"
log.error(_("Please do so in builder.conf or on the CLI."))
raise ConfigError, _("Distribution configuration is missing.")
- self.pakfire = base.Pakfire(
- mode="builder",
- config=config,
- arch=arch,
- **pakfire_args
- )
+ self.pakfire = base.PakfireBuilder(config=config, arch=arch, **pakfire_args)
self.distro = self.pakfire.distro
self.path = self.pakfire.path