From 7195ca4d8e6a844b4b08a7a7fb24efecce2ffd4a Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Tue, 22 Nov 2011 19:01:46 +0100 Subject: [PATCH] [eit] add more man pages - eit cleanup - eit inject - eit key - eit list - eit lock - eit unlock - eit match --- server/doc/mansrc/eit-cleanup.1.txt | 7 +- server/doc/mansrc/eit-inject.1.txt | 70 +++++++++++++++ server/doc/mansrc/eit-list.1.txt | 65 ++++++++++++++ server/doc/mansrc/eit-lock.1.txt | 76 ++++++++++++++++ server/doc/mansrc/eit-match.1.txt | 61 +++++++++++++ server/doc/mansrc/eit-search.1.txt | 65 ++++++++++++++ server/doc/mansrc/eit-status.1.txt | 56 ++++++++++++ server/doc/mansrc/eit-unlock.1.txt | 65 ++++++++++++++ server/doc/mansrc/eit-vacuum.1.txt | 61 +++++++++++++ server/doc/mansrc/eit.1.txt | 7 +- server/eit/commands/cleanup.py | 96 +++++++++++++++++++- server/eit/commands/inject.py | 22 +++++ server/eit/commands/key.py | 6 ++ server/eit/commands/list.py | 11 +++ server/eit/commands/lock.py | 35 ++++++++ server/eit/commands/match.py | 14 +++ server/eit/commands/search.py | 15 ++++ server/eit/commands/status.py | 11 +++ server/eit/commands/vacuum.py | 131 ---------------------------- 19 files changed, 734 insertions(+), 140 deletions(-) create mode 100644 server/doc/mansrc/eit-inject.1.txt create mode 100644 server/doc/mansrc/eit-list.1.txt create mode 100644 server/doc/mansrc/eit-lock.1.txt create mode 100644 server/doc/mansrc/eit-match.1.txt create mode 100644 server/doc/mansrc/eit-search.1.txt create mode 100644 server/doc/mansrc/eit-status.1.txt create mode 100644 server/doc/mansrc/eit-unlock.1.txt create mode 100644 server/doc/mansrc/eit-vacuum.1.txt delete mode 100644 server/eit/commands/vacuum.py diff --git a/server/doc/mansrc/eit-cleanup.1.txt b/server/doc/mansrc/eit-cleanup.1.txt index 44f412dd8..8ede76b36 100644 --- a/server/doc/mansrc/eit-cleanup.1.txt +++ b/server/doc/mansrc/eit-cleanup.1.txt @@ -11,7 +11,7 @@ eit-cleanup - clean expired packages from a repository SYNOPSIS -------- -eit cleanup [-h] [--quick] [] +eit cleanup [-h] [--quick] [--days DAYS] [] 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) diff --git a/server/doc/mansrc/eit-inject.1.txt b/server/doc/mansrc/eit-inject.1.txt new file mode 100644 index 000000000..c031c3aa5 --- /dev/null +++ b/server/doc/mansrc/eit-inject.1.txt @@ -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 ] [ ...] + + +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 +~~~~~~~~~~~~~~~~~~~~ +**:: + package paths + +OPTIONAL ARGUMENTS +~~~~~~~~~~~~~~~~~~ +*--help*:: + show this help message and exit + +*--to*=:: + 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) diff --git a/server/doc/mansrc/eit-list.1.txt b/server/doc/mansrc/eit-list.1.txt new file mode 100644 index 000000000..21b521ddd --- /dev/null +++ b/server/doc/mansrc/eit-list.1.txt @@ -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] [ ...] + + +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 +~~~~~~~~~~~~~~~~~~~~ +**:: + 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) diff --git a/server/doc/mansrc/eit-lock.1.txt b/server/doc/mansrc/eit-lock.1.txt new file mode 100644 index 000000000..966bb5ca4 --- /dev/null +++ b/server/doc/mansrc/eit-lock.1.txt @@ -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] + + +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 +~~~~~~~~~~~~~~~~~~~~ +**:: + 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) diff --git a/server/doc/mansrc/eit-match.1.txt b/server/doc/mansrc/eit-match.1.txt new file mode 100644 index 000000000..6b1b6776a --- /dev/null +++ b/server/doc/mansrc/eit-match.1.txt @@ -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] [ ...] + + +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 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) diff --git a/server/doc/mansrc/eit-search.1.txt b/server/doc/mansrc/eit-search.1.txt new file mode 100644 index 000000000..7f4030b8a --- /dev/null +++ b/server/doc/mansrc/eit-search.1.txt @@ -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 ] [--quiet] [ ...] + + +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 name + +OPTIONAL ARGUMENTS +~~~~~~~~~~~~~~~~~~ +*--help*:: + show this help message and exit + +*--in*=:: + 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) diff --git a/server/doc/mansrc/eit-status.1.txt b/server/doc/mansrc/eit-status.1.txt new file mode 100644 index 000000000..c9c021c7b --- /dev/null +++ b/server/doc/mansrc/eit-status.1.txt @@ -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] [] + + +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 +~~~~~~~~~~~~~~~~~~~~ +**:: + 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) diff --git a/server/doc/mansrc/eit-unlock.1.txt b/server/doc/mansrc/eit-unlock.1.txt new file mode 100644 index 000000000..2a1d39641 --- /dev/null +++ b/server/doc/mansrc/eit-unlock.1.txt @@ -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] + + +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 +~~~~~~~~~~~~~~~~~~~~ +**:: + 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) diff --git a/server/doc/mansrc/eit-vacuum.1.txt b/server/doc/mansrc/eit-vacuum.1.txt new file mode 100644 index 000000000..e4e496916 --- /dev/null +++ b/server/doc/mansrc/eit-vacuum.1.txt @@ -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] [] + + +INTRODUCTION +------------ +This is deprecated, please see *eit-cleanup(1)*. + + + +OPTIONS +------- +"eit vacuum" supports the following options which alters its behaviour. + + +POSITIONAL ARGUMENTS +~~~~~~~~~~~~~~~~~~~~ +**:: + 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) diff --git a/server/doc/mansrc/eit.1.txt b/server/doc/mansrc/eit.1.txt index 59bd3ddb2..7090c5763 100644 --- a/server/doc/mansrc/eit.1.txt +++ b/server/doc/mansrc/eit.1.txt @@ -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) diff --git a/server/eit/commands/cleanup.py b/server/eit/commands/cleanup.py index 7105231f6..880a5cbcf 100644 --- a/server/eit/commands/cleanup.py +++ b/server/eit/commands/cleanup.py @@ -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')) + ) diff --git a/server/eit/commands/inject.py b/server/eit/commands/inject.py index 75ef8edfb..b1a1c8daf 100644 --- a/server/eit/commands/inject.py +++ b/server/eit/commands/inject.py @@ -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: diff --git a/server/eit/commands/key.py b/server/eit/commands/key.py index 9e203ebd5..85f3cdcea 100644 --- a/server/eit/commands/key.py +++ b/server/eit/commands/key.py @@ -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() diff --git a/server/eit/commands/list.py b/server/eit/commands/list.py index 49fab6d0c..4f91f6562 100644 --- a/server/eit/commands/list.py +++ b/server/eit/commands/list.py @@ -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: diff --git a/server/eit/commands/lock.py b/server/eit/commands/lock.py index bb50ffc87..3dbbaa9af 100644 --- a/server/eit/commands/lock.py +++ b/server/eit/commands/lock.py @@ -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, diff --git a/server/eit/commands/match.py b/server/eit/commands/match.py index f2e0fd336..feb2d0b0b 100644 --- a/server/eit/commands/match.py +++ b/server/eit/commands/match.py @@ -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: diff --git a/server/eit/commands/search.py b/server/eit/commands/search.py index de3b5d870..9bc505e2b 100644 --- a/server/eit/commands/search.py +++ b/server/eit/commands/search.py @@ -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() diff --git a/server/eit/commands/status.py b/server/eit/commands/status.py index 855916d1d..0832a196d 100644 --- a/server/eit/commands/status.py +++ b/server/eit/commands/status.py @@ -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() diff --git a/server/eit/commands/vacuum.py b/server/eit/commands/vacuum.py deleted file mode 100644 index 53dd05bd9..000000000 --- a/server/eit/commands/vacuum.py +++ /dev/null @@ -1,131 +0,0 @@ -# -*- coding: utf-8 -*- -""" - - @author: Fabio Erculiani - @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="", 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')) - )