[gentoo-portage-dev] [PATCH v2] emerge --search: auto-detect regular expressions (bug 737480)

2020-09-01 Thread Zac Medico
Automatically detect regular expressions when the search string
contains any of these regular expression characters or character
sequences:

  ^ $ * [ ] { } | ? .+

This simplifies usage, so that users no longer have to remember
to prefix regular expressions with the % character. The new
behavior can be disabled by --regex-search-auto=n, in case the
regular expressions interpretation causes some kind of problem.

Note that fuzzy search and regular expression search are
mutually exclusive, and fuzzy search remains the default for
search strings that do not contain any regular expression
characters.

Bug: https://bugs.gentoo.org/737480
Signed-off-by: Zac Medico 
---
[PATCH v2] Recognize .+ as suggested by Arfrever.

 lib/_emerge/actions.py |  1 +
 lib/_emerge/main.py|  6 ++
 lib/_emerge/search.py  | 12 +++-
 man/emerge.1   | 12 +++-
 4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
index a4ecfe43d..f57269817 100644
--- a/lib/_emerge/actions.py
+++ b/lib/_emerge/actions.py
@@ -2036,6 +2036,7 @@ def action_search(root_config, myopts, myfiles, spinner):
search_index=myopts.get("--search-index", "y") != "n",
search_similarity=myopts.get("--search-similarity"),
fuzzy=myopts.get("--fuzzy-search") != "n",
+   regex_auto=myopts.get("--regex-search-auto") != "n",
)
for mysearch in myfiles:
try:
diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py
index 975738762..5075f7f57 100644
--- a/lib/_emerge/main.py
+++ b/lib/_emerge/main.py
@@ -709,6 +709,12 @@ def parse_opts(tmpcmdline, silent=False):
"action" : "store"
},
 
+   "--regex-search-auto": {
+   "help"   : "Enable or disable automatic regular 
expression detection for search actions",
+   "choices": y_or_n,
+   "default": "y",
+   },
+
"--root": {
 "help"   : "specify the target root filesystem for merging 
packages",
 "action" : "store"
diff --git a/lib/_emerge/search.py b/lib/_emerge/search.py
index a59191c1a..61eed0827 100644
--- a/lib/_emerge/search.py
+++ b/lib/_emerge/search.py
@@ -28,7 +28,7 @@ class search:
#
def __init__(self, root_config, spinner, searchdesc,
verbose, usepkg, usepkgonly, search_index=True,
-   search_similarity=None, fuzzy=True):
+   search_similarity=None, fuzzy=True, regex_auto=False):
"""Searches the available and installed packages for the 
supplied search key.
The list of available and installed packages is created at 
object instantiation.
This makes successive searches faster."""
@@ -42,6 +42,7 @@ class search:
self.spinner = None
self.root_config = root_config
self.setconfig = root_config.setconfig
+   self.regex_auto = regex_auto
self.fuzzy = fuzzy
self.search_similarity = (80 if search_similarity is None
else search_similarity)
@@ -259,6 +260,15 @@ class search:
if '/' in self.searchkey:
match_category = 1
fuzzy = False
+
+   if self.regex_auto and not regexsearch and 
re.search(r'[\^\$\*\[\]\{\}\|\?]|\.\+', self.searchkey) is not None:
+   try:
+   re.compile(self.searchkey, re.I)
+   except Exception:
+   pass
+   else:
+   regexsearch = True
+
if regexsearch:
self.searchre=re.compile(self.searchkey,re.I)
else:
diff --git a/man/emerge.1 b/man/emerge.1
index fe7d05a21..c1bcd0220 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -229,7 +229,9 @@ explicitly discarded by running `emaint \-\-fix 
cleanresume` (see
 .BR \-\-search ", " \-s
 Searches for matches of the supplied string in the ebuild repository.
 By default emerge uses a case-insensitive simple search, but you can
-enable a regular expression search by prefixing the search string with %.
+enable a regular expression search by prefixing the search string with %
+(the % prefix can often be omitted if the
+\fB\-\-regex\-search\-auto\fR option is enabled).
 For example, \fBemerge \-\-search "%^kde"\fR searches for any package whose
 name starts with "kde"; \fBemerge \-\-search "%gcc$"\fR searches for any
 package that ends with "gcc"; \fBemerge \-\-search "office"\fR searches for
@@ -764,6 +766,14 @@ matching packages due to \fB\-\-rebuild\fR.
 A space separated list of package names or slot atoms. Emerge will not rebuild
 packages that depend on matching packages due to 

[gentoo-dev] Last rites: dev-go/siphash

2020-09-01 Thread Marek Szuba
# Marek Szuba  (2020-09-01)
# Uses golang-* eclasses, only a library, all former reverse
# dependencies have long since switched to vendoring.
# Removal in 30 days. Bug #732130.
dev-go/siphash

-- 
Marecki



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-dev] Please port your packages to Python 3.8

2020-09-01 Thread Alexey Sokolov
вт, 1 сент. 2020 г. в 13:06, Rich Freeman :
>
> On Tue, Sep 1, 2020 at 7:02 AM Michał Górny  wrote:
> >
> > QA reports provide a list [2] and a graph [3] of packages needing
> > porting.
>
> These lists would be far more useful if they actually listed the
> maintainer(s) of each package.  Then devs could just grep to discover
> if any of their packages need fixing.
>
> Otherwise I fear that you're just going to run into the same issue as
> last time - most devs will just wait until you take the time to do
> this and file bugs.
>

I would also like a warning shown in p.g.o if the package is in one of
these qa lists



Re: [gentoo-dev] Please port your packages to Python 3.8

2020-09-01 Thread Michał Górny
On Tue, 2020-09-01 at 08:06 -0400, Rich Freeman wrote:
> On Tue, Sep 1, 2020 at 7:02 AM Michał Górny  wrote:
> > QA reports provide a list [2] and a graph [3] of packages needing
> > porting.
> 
> These lists would be far more useful if they actually listed the
> maintainer(s) of each package.  Then devs could just grep to discover
> if any of their packages need fixing.
> 
> Otherwise I fear that you're just going to run into the same issue as
> last time - most devs will just wait until you take the time to do
> this and file bugs.

Hmm, I suppose this won't be hard to add.

-- 
Best regards,
Michał Górny



signature.asc
Description: This is a digitally signed message part


Re: [gentoo-dev] RFC: pgo - a command line interface for packages.g.o

2020-09-01 Thread Michael Orlitzky


On 2020-09-01 08:38, Max Magorsch wrote:
> Do you think this is something you would be interested in? Do you
> have any features you like to see included in this case?
Yes!

Here's a trick that bugzilla cannot do: show me the bugs that are
assigned to me **or a project that I'm a member of**. Killer feature
right there.



[gentoo-dev] RFC: pgo - a command line interface for packages.g.o

2020-09-01 Thread Max Magorsch
Hi all,

The tl;dr is that I'm glad to announce pgo[0] - a command-line
interface for packages.gentoo.org and I'm looking for your feedback
here.

Some more information: Some time ago I announced the new packages.g.o
GraphQL API. Now, pgo is using this API to display information about
packages like versions, metadata, dependencies, QA reports, pull
requests, bugs and the changelog on the command line. It will also be
able to display information for maintainers, as a list of packages
they are maintaining, a list of outdated packages, or bugs related to
the packages they are maintaining. Further functionality might be
added over time.

We do already have a bunch of tools which do display package
information on the command line. Furthermore, these tools do have the
advantage that they work locally. However, the reason I still came up
with pgo is that pgo can now display information (such as bugs, pull
requests, qa-reports or information for maintainers) that other tools
cannot display and bundle these information in one central tool.
That's why I'm looking forward to your feedback here: Do you think
this is something you would be interested in? Do you have any features
you like to see included in this case?

pgo is packaged as app-portage/pgo (you might prefer the live version
as it might still change quickly currently) so that you can give it a
try. You might for instance try

  $ pgo xmona

to show the package information for x11-wm/xmonad. Or try

  $ pgo -s xmona

to search for packages. Or e.g.

 $ pgo -bp grub

to show all bugs and pull requests for sys-boot/grub. However, to be
clear: Currently, it's still in a kind of "Proof of concept" stage. So
don't expect it to be fully useful right now.

So please let me know if you think it's worth spending more time on
this. I'm looking forward to your feedback.

-M

[0] https://packages.gentoo.org/packages/app-portage/pgo



Re: [gentoo-dev] Please port your packages to Python 3.8

2020-09-01 Thread Rich Freeman
On Tue, Sep 1, 2020 at 7:02 AM Michał Górny  wrote:
>
> QA reports provide a list [2] and a graph [3] of packages needing
> porting.

These lists would be far more useful if they actually listed the
maintainer(s) of each package.  Then devs could just grep to discover
if any of their packages need fixing.

Otherwise I fear that you're just going to run into the same issue as
last time - most devs will just wait until you take the time to do
this and file bugs.

-- 
Rich



[gentoo-dev] Please port your packages to Python 3.8

2020-09-01 Thread Michał Górny
Hello,

Following the timeline published earlier (and copied to [1]), Python 3.7
deprecation starts today.  All developers are requested to install
Python 3.8 and start testing their packages against it.  While at it,
testing against Python 3.9 would also be welcome.

QA reports provide a list [2] and a graph [3] of packages needing
porting.  To be honest, the only major nuisance in Python 3.8 I can
recall right now is that 'python-3.8' pkg-config file no longer includes
'-lpython3.8' and packages that need it need to switch to
'python-3.8-embed' instead.  If you can think of other problems, please
ping me and I'll add some tips to python-guide [4] soonish.

As usual, please add or fix tests to your packages.

Python 3.8 is planned to become the default on 2020-12-01.

Thank you all for your hard work!


[1] 
https://wiki.gentoo.org/wiki/Project:Python/Implementations#Implementation_support_timeline
[2] https://qa-reports.gentoo.org/output/gpyutils/37-to-38.txt
[3] https://qa-reports.gentoo.org/output/gpyutils/37-to-38.svg
[4] https://dev.gentoo.org/~mgorny/python-guide/

-- 
Best regards,
Michał Górny



signature.asc
Description: This is a digitally signed message part


[gentoo-dev] Last rites: dev-cpp/icnc, dev-db/tokumx, net-fs/nfstest, sys-boot/udk, sys-cluster/pbs-python

2020-09-01 Thread Michał Górny
# Michał Górny  (2020-09-01)
# The following packages are Python 2 only.  All but sys-boot/udk have
# no reverse dependencies; sys-boot/udk's only revdep is sys-boot/refind
# and it removed support for udk in its newest version.  Their
# maintainers have either not replied or requested removing the package.
# Please do not remove the mask unless you port the package to py3.7+.
# Removal in 30 days.  Package bugs found blocking tracker bug #694800.
dev-cpp/icnc
dev-db/tokumx
net-fs/nfstest
sys-boot/udk
sys-cluster/pbs-python

-- 
Best regards,
Michał Górny



signature.asc
Description: This is a digitally signed message part


[gentoo-portage-dev] [PATCH] egencache --update-pkg-desc-index: emulate esync --verbose output (bug 737470)

2020-09-01 Thread Zac Medico
When the --verbose flag is given, make --update-pkg-desc-index emulate
esync --verbose output. Example:

 * Searching for changes

 [ N] acct-group/ultimaker (0):  Group for ultimaker
 [ N] acct-user/ultimaker (0):  User for ultimaker
 [ U] www-client/opera (70.0.3728.144):  A fast and secure web browser
 [MU] www-client/opera-developer (72.0.3798.0):  A fast and secure web browser
 [ U] x11-libs/gtksourceview (4.6.1-r1):  A text widget implementing syntax 
highlighting and other features

Bug: https://bugs.gentoo.org/737470
Signed-off-by: Zac Medico 
---
 bin/egencache   | 68 ++---
 man/egencache.1 |  3 +++
 2 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/bin/egencache b/bin/egencache
index 264c600fe..968d5706f 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -35,6 +35,7 @@ else:
 
 signal.signal(debug_signum, debug_signal)
 
+import functools
 import io
 import logging
 import subprocess
@@ -50,8 +51,9 @@ portage._internal_caller = True
 from portage import os, _encodings, _unicode_encode, _unicode_decode
 from _emerge.MetadataRegen import MetadataRegen
 from portage.cache.cache_errors import CacheError, StatCollision
-from portage.cache.index.pkg_desc_index import pkg_desc_index_line_format
+from portage.cache.index.pkg_desc_index import pkg_desc_index_line_format, 
pkg_desc_index_line_read
 from portage.const import TIMESTAMP_FORMAT
+from portage.output import colorize, EOutput
 from portage.package.ebuild._parallel_manifest.ManifestScheduler import 
ManifestScheduler
 from portage.util import cmp_sort_key, writemsg_level
 from portage.util._async.AsyncFunction import AsyncFunction
@@ -131,6 +133,9 @@ def parse_args(args):
common.add_argument("--ignore-default-opts",
action="store_true",
help="do not use the EGENCACHE_DEFAULT_OPTS environment 
variable")
+   common.add_argument("-v", "--verbose",
+   action="count", default=0,
+   help="increase verbosity")
common.add_argument("--write-timestamp",
action="store_true",
help="write metadata/timestamp.chk as required for rsync 
repositories")
@@ -448,13 +453,26 @@ class GenCache:
trg_cache._prune_empty_dirs()
 
 class GenPkgDescIndex:
-   def __init__(self, portdb, output_file):
+   def __init__(self, portdb, output_file, verbose=False):
self.returncode = os.EX_OK
self._portdb = portdb
self._output_file = output_file
+   self._verbose = verbose
 
def run(self):
 
+   display_updates = self._verbose > 0
+   old = {}
+   new = {}
+   if display_updates:
+   try:
+   with open(self._output_file, 'rt', 
encoding=_encodings["repo.content"]) as f:
+   for line in f:
+   pkg_desc = 
pkg_desc_index_line_read(line)
+   old[pkg_desc.cp] = pkg_desc
+   except FileNotFoundError:
+   pass
+
portage.util.ensure_dirs(os.path.dirname(self._output_file))
f = portage.util.atomic_ofstream(self._output_file,
encoding=_encodings["repo.content"])
@@ -466,10 +484,51 @@ class GenPkgDescIndex:
continue
desc, = portdb.aux_get(pkgs[-1], ["DESCRIPTION"])
 
-   f.write(pkg_desc_index_line_format(cp, pkgs, desc))
+   line = pkg_desc_index_line_format(cp, pkgs, desc)
+   f.write(line)
+   if display_updates:
+   new[cp] = pkg_desc_index_line_read(line)
 
f.close()
 
+   if display_updates:
+   out = EOutput()
+   out.einfo("Searching for changes")
+   print("")
+   items = sorted(new.values(), key=lambda pkg_desc: 
pkg_desc.cp)
+   haspkgs = False
+   for pkg_desc in items:
+   masked = False
+   version = 
self._portdb.xmatch("bestmatch-visible", pkg_desc.cp)
+   if not version:
+   version = pkg_desc.cpv_list[-1]
+   masked = True
+   old_versions = old.get(pkg_desc.cp)
+   if old_versions is None or version not in 
old_versions.cpv_list:
+   prefix0 = " "
+   prefix1 = " "
+
+   if old_versions is None:
+   color = 

[gentoo-dev] Last rites: app-text/fbless

2020-09-01 Thread Michał Górny
# Michał Górny  (2020-09-01)
# The GitHub repository is gone and upstream's homepage lists only old
# versions.  Python 2 only.  Debian has a py3 patch but it is incomplete
# and fbless crashes when opening a file.
# Removal in 30 days.  Bug #734578.
app-text/fbless

-- 
Best regards,
Michał Górny



signature.asc
Description: This is a digitally signed message part