[eit] add more man pages

- eit cleanup
- eit inject
- eit key
- eit list
- eit lock
- eit unlock
- eit match
This commit is contained in:
Fabio Erculiani
2011-11-22 19:01:46 +01:00
parent 16ea86b711
commit 7195ca4d8e
19 changed files with 734 additions and 140 deletions

View File

@@ -11,7 +11,7 @@ eit-cleanup - clean expired packages from a repository
SYNOPSIS
--------
eit cleanup [-h] [--quick] [<repo>]
eit cleanup [-h] [--quick] [--days DAYS] [<repo>]
INTRODUCTION
@@ -45,6 +45,9 @@ OPTIONAL ARGUMENTS
*--quick*::
no stupid questions
*--days*::
expired since how many days
AUTHORS
@@ -62,4 +65,4 @@ lxnay@sabayon.org.
SEE ALSO
--------
eit(1), eit-vacuum(1)
eit(1)

View File

@@ -0,0 +1,70 @@
eit-inject(1)
=============
:man source: eit {eitversion}
:man manual: eit {eitversion}
NAME
----
eit-inject - inject package files into repository
SYNOPSIS
--------
eit inject [-h] [--to <repository>] <path> [<path> ...]
INTRODUCTION
------------
A Source Package Manager (Portage, for example) can produce
tarballs containing package metadata and the actual content.
If that's the case, Entropy Server can scan the file and extract
all the information needed to add the same to its repository.
In the Entropy world, this is called "*package injection*",
meaning that you're actually "injecting" a SPM package into
an Entropy repository.
Injected packages are "special", because they're not mapped
to an installed SPM package on the currently running system
(or chroot). This has the side effect of Entropy not being
automatically able to detect library breakages, for example.
So please limit the amount of *injected* packages in your
repositories as much as you can.
OPTIONS
-------
"eit inject" supports the following options which alters its behaviour.
POSITIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~~~
*<path>*::
package paths
OPTIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~
*--help*::
show this help message and exit
*--to*=<repository>::
inject into given repository
AUTHORS
-------
Eit has been accidentally prototyped during a rainy Sunday by Fabio
Erculiani who was looking for innovative ways of handling package
bumps in Sabayon Entropy repositories.
A few months later, Eit saw the light.
REPORTING BUGS
--------------
Report bugs to https://bugs.sabayon.org or directly to the author at
lxnay@sabayon.org.
SEE ALSO
--------
eit(1)

View File

@@ -0,0 +1,65 @@
eit-list(1)
===========
:man source: eit {eitversion}
:man manual: eit {eitversion}
NAME
----
eit-list - show repository content (packages)
SYNOPSIS
--------
eit list [-h] [--quiet] [--verbose] [--injected] <repo> [<repo> ...]
INTRODUCTION
------------
List packages in given repositories.
If you wonder what's inside a repository, you've found the right tool.
OPTIONS
-------
"eit list" supports the following options which alters its behaviour.
POSITIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~~~
*<repo>*::
repository
OPTIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~
*--help*::
show this help message and exit
*-q*::
quiet output, for scripting purposes
*-v*::
output more package info
*--injected*::
only list injected packages
AUTHORS
-------
Eit has been accidentally prototyped during a rainy Sunday by Fabio
Erculiani who was looking for innovative ways of handling package
bumps in Sabayon Entropy repositories.
A few months later, Eit saw the light.
REPORTING BUGS
--------------
Report bugs to https://bugs.sabayon.org or directly to the author at
lxnay@sabayon.org.
SEE ALSO
--------
eit(1)

View File

@@ -0,0 +1,76 @@
eit-lock(1)
===========
:man source: eit {eitversion}
:man manual: eit {eitversion}
NAME
----
eit-lock - lock repository
SYNOPSIS
--------
eit lock [-h] [--client | --status] [--quiet] <repo>
INTRODUCTION
------------
Locking a repository is a way to prevent other Entropy Server
or Entropy Client instances (depending on given switches) from
accessing the remote repository.
In case of Entropy Server locking (default, --client switch not
provided), *eit lock* tries to acquire a remote lock on each configured
mirror that only involves other Entropy Server instances (you won't
be able to update your repositories if you don't own the remote lock).
When --client is provided instead, *eit lock* places a lock on remote
mirrors that prevents Entropy Clients from downloading the repository:
this is just a band aid that avoids users to get broken packages or
repositories.
*eit unlock* does the symmetrical job.
OPTIONS
-------
"eit lock" supports the following options which alters its behaviour.
POSITIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~~~
*<repo>*::
repository
OPTIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~
*--help*::
show this help message and exit
*--client*::
affect entropy clients only
*--status*::
show current status
*-q*::
quiet output, for scripting purposes
AUTHORS
-------
Eit has been accidentally prototyped during a rainy Sunday by Fabio
Erculiani who was looking for innovative ways of handling package
bumps in Sabayon Entropy repositories.
A few months later, Eit saw the light.
REPORTING BUGS
--------------
Report bugs to https://bugs.sabayon.org or directly to the author at
lxnay@sabayon.org.
SEE ALSO
--------
eit(1), eit-unlock(1)

View File

@@ -0,0 +1,61 @@
eit-match(1)
============
:man source: eit {eitversion}
:man manual: eit {eitversion}
NAME
----
eit-match - match packages in repositories
SYNOPSIS
--------
eit match [-h] [--quiet] <package> [<package> ...]
INTRODUCTION
------------
Match a dependency string against the available repositories.
For example: *eit match app-foo/bar:2::repo* will match any version
of app-foo/bar having SLOT=2 in the "repo" repository.
If you are interested in a simple text search, please see *eit search*.
OPTIONS
-------
"eit match" supports the following options which alters its behaviour.
POSITIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~~~
*<package>*::
package name
OPTIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~
*--help*::
show this help message and exit
*-q*::
quiet output, for scripting purposes
AUTHORS
-------
Eit has been accidentally prototyped during a rainy Sunday by Fabio
Erculiani who was looking for innovative ways of handling package
bumps in Sabayon Entropy repositories.
A few months later, Eit saw the light.
REPORTING BUGS
--------------
Report bugs to https://bugs.sabayon.org or directly to the author at
lxnay@sabayon.org.
SEE ALSO
--------
eit(1), eit-search(1)

View File

@@ -0,0 +1,65 @@
eit-search(1)
=============
:man source: eit {eitversion}
:man manual: eit {eitversion}
NAME
----
eit-search - search packages in repositories
SYNOPSIS
--------
eit search [-h] [--in <repository>] [--quiet] <package> [<package> ...]
INTRODUCTION
------------
Search a package into available repositories (unless *--in* is provided).
For example: *eit search app-foo/bar* will search any package name
containing the given string in its name.
If you are interested in dependency string matching, please see
*eit match*.
OPTIONS
-------
"eit search" supports the following options which alters its behaviour.
POSITIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~~~
*<package>*::
package name
OPTIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~
*--help*::
show this help message and exit
*--in*=<repository>::
search packages in given repository
*-q*::
quiet output, for scripting purposes
AUTHORS
-------
Eit has been accidentally prototyped during a rainy Sunday by Fabio
Erculiani who was looking for innovative ways of handling package
bumps in Sabayon Entropy repositories.
A few months later, Eit saw the light.
REPORTING BUGS
--------------
Report bugs to https://bugs.sabayon.org or directly to the author at
lxnay@sabayon.org.
SEE ALSO
--------
eit(1), eit-match(1)

View File

@@ -0,0 +1,56 @@
eit-status(1)
=============
:man source: eit {eitversion}
:man manual: eit {eitversion}
NAME
----
eit-status - show repository status
SYNOPSIS
--------
eit status [-h] [<repo>]
INTRODUCTION
------------
Show repository status (such as: *configured mirrors*,
*current branch*, *unstaged packages*, *packages ready for upload*, etc).
OPTIONS
-------
"eit status" supports the following options which alters its behaviour.
POSITIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~~~
*<repo>*::
repository
OPTIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~
*--help*::
show this help message and exit
AUTHORS
-------
Eit has been accidentally prototyped during a rainy Sunday by Fabio
Erculiani who was looking for innovative ways of handling package
bumps in Sabayon Entropy repositories.
A few months later, Eit saw the light.
REPORTING BUGS
--------------
Report bugs to https://bugs.sabayon.org or directly to the author at
lxnay@sabayon.org.
SEE ALSO
--------
eit(1)

View File

@@ -0,0 +1,65 @@
eit-unlock(1)
=============
:man source: eit {eitversion}
:man manual: eit {eitversion}
NAME
----
eit-unlock - lock repository
SYNOPSIS
--------
eit unlock [-h] [--client | --status] [--quiet] <repo>
INTRODUCTION
------------
Unlocks previously locked repository.
See *eit lock* man page (SEE ALSO section) for more information.
OPTIONS
-------
"eit unlock" supports the following options which alters its behaviour.
POSITIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~~~
*<repo>*::
repository
OPTIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~
*--help*::
show this help message and exit
*--client*::
affect entropy clients only
*--status*::
show current status
*-q*::
quiet output, for scripting purposes
AUTHORS
-------
Eit has been accidentally prototyped during a rainy Sunday by Fabio
Erculiani who was looking for innovative ways of handling package
bumps in Sabayon Entropy repositories.
A few months later, Eit saw the light.
REPORTING BUGS
--------------
Report bugs to https://bugs.sabayon.org or directly to the author at
lxnay@sabayon.org.
SEE ALSO
--------
eit(1), eit-lock(1)

View File

@@ -0,0 +1,61 @@
eit-vacuum(1)
=============
:man source: eit {eitversion}
:man manual: eit {eitversion}
NAME
----
eit-vacuum - clean expired packages from a repository
SYNOPSIS
--------
eit vacuum [-h] [--quick] [--days DAYS] [<repo>]
INTRODUCTION
------------
This is deprecated, please see *eit-cleanup(1)*.
OPTIONS
-------
"eit vacuum" supports the following options which alters its behaviour.
POSITIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~~~
*<repo>*::
repository
OPTIONAL ARGUMENTS
~~~~~~~~~~~~~~~~~~
*--help*::
show this help message and exit
*--quick*::
no stupid questions
*--days*::
expired since how many days
AUTHORS
-------
Eit has been accidentally prototyped during a rainy Sunday by Fabio
Erculiani who was looking for innovative ways of handling package
bumps in Sabayon Entropy repositories.
A few months later, Eit saw the light.
REPORTING BUGS
--------------
Report bugs to https://bugs.sabayon.org or directly to the author at
lxnay@sabayon.org.
SEE ALSO
--------
eit(1), eit-cleanup(1)

View File

@@ -142,7 +142,7 @@ COMMANDS
unlock repository
*vacuum*::
clean expired/removed packages from repository
clean expired packages from a repository
@@ -163,6 +163,7 @@ SEE ALSO
--------
eit-add(1), eit-branch(1), eit-bump(1), eit-checkout(1), eit-cleanup(1)
eit-commit(1), eit-cp(1), eit-deps(1), eit-files(1), eit-graph(1)
eit-init(1), eit-log(1), eit-mv(1), eit-notice(1), eit-own(1)
eit-repack(1), eit-revgraph(1)
eit-init(1), eit-inject(1), eit-list(1), eit-lock(1), eit-log(1)
eit-match(1), eit-mv(1), eit-notice(1), eit-own(1), eit-repack(1)
eit-revgraph(1), eit-search(1), eit-status(1), eit-unlock(1), eit-vacuum(1)

View File

@@ -13,7 +13,7 @@ import sys
import os
import argparse
from entropy.output import darkgreen, blue
from entropy.output import darkgreen, blue, purple
from entropy.i18n import _
from eit.commands.descriptor import EitCommandDescriptor
@@ -28,6 +28,13 @@ class EitCleanup(EitCommand):
NAME = "cleanup"
ALIASES = ["cn", "clean"]
def __init__(self, args):
EitCommand.__init__(self, args)
# ask user before any critical operation
self._ask = True
self._pretend = False
self._days = None
def _get_parser(self):
""" Overridden from EitCommand """
descriptor = EitCommandDescriptor.obtain_descriptor(
@@ -42,8 +49,44 @@ class EitCleanup(EitCommand):
parser.add_argument("--quick", action="store_true",
default=False,
help=_("no stupid questions"))
parser.add_argument('--days', type=int, default=self._days,
help=_("expired since how many days"))
return parser
def bashcomp(self, last_arg):
"""
Overridden from EitCommand
"""
import sys
entropy_server = self._entropy(handle_uninitialized=False,
installed_repo=-1)
outcome = entropy_server.repositories()
for arg in self._args:
if arg in outcome:
# already given a repo
outcome = []
break
outcome += ["--quick", "--days"]
def _startswith(string):
if last_arg is not None:
if last_arg not in outcome:
return string.startswith(last_arg)
return True
if self._args:
# only filter out if last_arg is actually
# something after this.NAME.
outcome = sorted(filter(_startswith, outcome))
for arg in self._args:
if arg in outcome:
outcome.remove(arg)
sys.stdout.write(" ".join(outcome) + "\n")
sys.stdout.flush()
INTRODUCTION = """\
Clean expired packages from remote mirrors. Usually, packages
have a default expiration timeout set to 15 days (entropy.const),
@@ -54,7 +97,6 @@ During the final part of packages sync, expired ones are automatically
removed from remote mirrors.
This commands makes possible to manually force a cleanup.
"""
SEE_ALSO = "eit-vacuum(1)"
def man(self):
"""
@@ -71,15 +113,30 @@ This commands makes possible to manually force a cleanup.
return parser.print_help, []
self._ask = not nsargs.quick
if nsargs.days is not None:
self._days = nsargs.days
return self._call_locked, [self._cleanup, nsargs.repo]
def _cleanup(self, entropy_server):
"""
Actual Entropy Repository cleanup function
"""
if self._days is not None:
entropy_server.output("", level="warning")
entropy_server.output(
purple(_("Removing unavailable packages overriding defaults")),
importance=1,
level="warning")
entropy_server.output(
purple(_("Users with older repositories will have to update")),
importance=1,
level="warning")
entropy_server.output("", level="warning")
repository_id = entropy_server.repository()
entropy_server.Mirrors.tidy_mirrors(repository_id,
ask = self._ask)
entropy_server.Mirrors.tidy_mirrors(
repository_id, ask = self._ask,
pretend = self._pretend, expiration_days = self._days)
return 0
EitCommandDescriptor.register(
@@ -88,3 +145,34 @@ EitCommandDescriptor.register(
EitCleanup.NAME,
_('clean expired packages from a repository'))
)
class EitVacuum(EitCleanup):
"""
Main Eit vacuum command (kept for backward compat).
"""
NAME = "vacuum"
ALIASES = []
def __init__(self, args):
EitCleanup.__init__(self, args)
# default is 0 here
self._days = 0
INTRODUCTION = """\
This is deprecated, please see *eit-cleanup(1)*.
"""
SEE_ALSO = "eit-cleanup(1)"
def man(self):
"""
Overridden from EitCommand.
"""
return self._man()
EitCommandDescriptor.register(
EitCommandDescriptor(
EitVacuum,
EitVacuum.NAME,
_('clean expired packages from a repository'))
)

View File

@@ -48,6 +48,28 @@ class EitInject(EitCommand):
return parser
INTRODUCTION = """\
A Source Package Manager (Portage, for example) can produce
tarballs containing package metadata and the actual content.
If that's the case, Entropy Server can scan the file and extract
all the information needed to add the same to its repository.
In the Entropy world, this is called "*package injection*",
meaning that you're actually "injecting" a SPM package into
an Entropy repository.
Injected packages are "special", because they're not mapped
to an installed SPM package on the currently running system
(or chroot). This has the side effect of Entropy not being
automatically able to detect library breakages, for example.
So please limit the amount of *injected* packages in your
repositories as much as you can.
"""
def man(self):
"""
Overridden from EitCommand.
"""
return self._man()
def parse(self):
parser = self._get_parser()
try:

View File

@@ -105,6 +105,12 @@ class EitKey(EitCommand):
return parser
INTRODUCTION = """\
Toolset for handling repository GPG keys.
Entropy Server offers *built-in* support for digitally signing
package and repository files through *gnupg*.
"""
def parse(self):
""" Overridden from EitCommand """
parser = self._get_parser()

View File

@@ -59,6 +59,17 @@ class EitList(EitCommand):
return parser
INTRODUCTION = """\
List packages in given repositories.
If you wonder what's inside a repository, you've found the right tool.
"""
def man(self):
"""
Overridden from EitCommand.
"""
return self._man()
def parse(self):
parser = self._get_parser()
try:

View File

@@ -95,6 +95,29 @@ class EitLock(EitCommand):
sys.stdout.write(" ".join(outcome) + "\n")
sys.stdout.flush()
INTRODUCTION = """\
Locking a repository is a way to prevent other Entropy Server
or Entropy Client instances (depending on given switches) from
accessing the remote repository.
In case of Entropy Server locking (default, --client switch not
provided), *eit lock* tries to acquire a remote lock on each configured
mirror that only involves other Entropy Server instances (you won't
be able to update your repositories if you don't own the remote lock).
When --client is provided instead, *eit lock* places a lock on remote
mirrors that prevents Entropy Clients from downloading the repository:
this is just a band aid that avoids users to get broken packages or
repositories.
*eit unlock* does the symmetrical job.
"""
SEE_ALSO = "eit-unlock(1)"
def man(self):
"""
Overridden from EitCommand.
"""
return self._man()
def parse(self):
parser = self._get_parser()
try:
@@ -210,6 +233,18 @@ class EitUnlock(EitLock):
self._action_lock = False
self._name = EitUnlock.NAME
INTRODUCTION = """\
Unlocks previously locked repository.
See *eit lock* man page (SEE ALSO section) for more information.
"""
SEE_ALSO = "eit-lock(1)"
def man(self):
"""
Overridden from EitCommand.
"""
return self._man()
EitCommandDescriptor.register(
EitCommandDescriptor(
EitUnlock,

View File

@@ -51,6 +51,20 @@ class EitMatch(EitCommand):
return parser
INTRODUCTION = """\
Match a dependency string against the available repositories.
For example: *eit match app-foo/bar:2::repo* will match any version
of app-foo/bar having SLOT=2 in the "repo" repository.
If you are interested in a simple text search, please see *eit search*.
"""
SEE_ALSO = "eit-search(1)"
def man(self):
"""
Overridden from EitCommand.
"""
return self._man()
def parse(self):
parser = self._get_parser()
try:

View File

@@ -56,6 +56,21 @@ class EitSearch(EitCommand):
return parser
INTRODUCTION = """\
Search a package into available repositories (unless *--in* is provided).
For example: *eit search app-foo/bar* will search any package name
containing the given string in its name.
If you are interested in dependency string matching, please see
*eit match*.
"""
SEE_ALSO = "eit-match(1)"
def man(self):
"""
Overridden from EitCommand.
"""
return self._man()
def parse(self):
""" Overridden from EitCommand """
parser = self._get_parser()

View File

@@ -80,6 +80,17 @@ class EitStatus(EitCommand):
sys.stdout.write(" ".join(outcome) + "\n")
sys.stdout.flush()
INTRODUCTION = """\
Show repository status (such as: *configured mirrors*,
*current branch*, *unstaged packages*, *packages ready for upload*, etc).
"""
def man(self):
"""
Overridden from EitCommand.
"""
return self._man()
def parse(self):
""" Overridden from EitCommand """
parser = self._get_parser()

View File

@@ -1,131 +0,0 @@
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Infrastructure Toolkit}.
"""
import sys
import argparse
from entropy.i18n import _
from entropy.output import purple
from eit.commands.descriptor import EitCommandDescriptor
from eit.commands.command import EitCommand
class EitVacuum(EitCommand):
"""
Main Eit vacuum command.
"""
NAME = "vacuum"
ALIASES = []
def __init__(self, args):
EitCommand.__init__(self, args)
# ask user before any critical operation
self._ask = True
self._pretend = False
self._days = 0
def _get_parser(self):
""" Overridden from EitCommand """
descriptor = EitCommandDescriptor.obtain_descriptor(
EitVacuum.NAME)
parser = argparse.ArgumentParser(
description=descriptor.get_description(),
formatter_class=argparse.RawDescriptionHelpFormatter,
prog="%s %s" % (sys.argv[0], EitVacuum.NAME))
parser.add_argument("repo", nargs='?', default=None,
metavar="<repo>", help=_("repository"))
parser.add_argument("--quick", action="store_true",
default=False,
help=_("no stupid questions"))
parser.add_argument('--days', type=int, default=self._days,
help=_("expired since how many days, default: 0"))
return parser
def bashcomp(self, last_arg):
"""
Overridden from EitCommand
"""
import sys
entropy_server = self._entropy(handle_uninitialized=False,
installed_repo=-1)
outcome = entropy_server.repositories()
for arg in self._args:
if arg in outcome:
# already given a repo
outcome = []
break
outcome += ["--quick", "--days"]
def _startswith(string):
if last_arg is not None:
if last_arg not in outcome:
return string.startswith(last_arg)
return True
if self._args:
# only filter out if last_arg is actually
# something after this.NAME.
outcome = sorted(filter(_startswith, outcome))
for arg in self._args:
if arg in outcome:
outcome.remove(arg)
sys.stdout.write(" ".join(outcome) + "\n")
sys.stdout.flush()
def parse(self):
""" Overridden from EitCommand """
parser = self._get_parser()
try:
nsargs = parser.parse_args(self._args)
except IOError as err:
sys.stderr.write("%s\n" % (err,))
return parser.print_help, []
self._ask = not nsargs.quick
self._days = nsargs.days
return self._call_locked, [self._vacuum, nsargs.repo]
def _vacuum(self, entropy_server):
"""
Actual vacuum code
"""
entropy_server.output("", level="warning")
entropy_server.output(
purple(_("Removing unavailable packages overriding defaults")),
importance=1,
level="warning")
entropy_server.output(
purple(_("Users with old repositories will need to update")),
importance=1,
level="warning")
entropy_server.output("", level="warning")
rc = entropy_server.Mirrors.tidy_mirrors(
entropy_server.repository(), ask = self._ask,
pretend = self._pretend, expiration_days = self._days)
if rc:
return 0
return 1
EitCommandDescriptor.register(
EitCommandDescriptor(
EitVacuum,
EitVacuum.NAME,
_('clean expired/removed packages from repository'))
)