* [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
@ 2014-02-14 17:31 David James
2014-02-14 20:31 ` Sebastian Luther
2014-02-17 7:45 ` Mike Frysinger
0 siblings, 2 replies; 13+ messages in thread
From: David James @ 2014-02-14 17:31 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 10284 bytes --]
The --newrepo flag tells emerge to recompile a package if it is now being
pulled from a different repository.
BUG=chromium:200417
TEST=Verify ebuilds get pulled in when repo changes.
---
man/emerge.1 | 5 +++
pym/_emerge/create_depgraph_params.py | 1 +
pym/_emerge/depgraph.py | 80
++++++++++++++++++-----------------
pym/_emerge/help.py | 2 +-
4 files changed, 48 insertions(+), 40 deletions(-)
diff --git a/man/emerge.1 b/man/emerge.1
index 7b507fe..eacb77a 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -553,6 +553,11 @@ a list of packages with similar names when a package
doesn't exist.
The \fIEMERGE_DEFAULT_OPTS\fR variable may be used to disable this
option by default.
.TP
+.BR "\-\-newrepo "
+Tells emerge to recompile a package if it is now being pulled from a
+different repository. This option also implies the
+\fB\-\-selective\fR option.
+.TP
.BR "\-\-newuse " (\fB\-N\fR)
Tells emerge to include installed packages where USE
flags have changed since compilation. This option
diff --git a/pym/_emerge/create_depgraph_params.py
b/pym/_emerge/create_depgraph_params.py
index 98a7646..f9accf0 100644
--- a/pym/_emerge/create_depgraph_params.py
+++ b/pym/_emerge/create_depgraph_params.py
@@ -46,6 +46,7 @@ def create_depgraph_params(myopts, myaction):
myparams['rebuild_if_new_slot'] = rebuild_if_new_slot
if "--update" in myopts or \
+ "--newrepo" in myopts or \
"--newuse" in myopts or \
"--reinstall" in myopts or \
"--noreplace" in myopts or \
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index ae6b883..fe1b48e 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -5389,54 +5389,56 @@ class depgraph(object):
break
# Compare built package to current
config and
# reject the built package if
necessary.
+ reinstall_use = ("--newuse" in
self._frozen_config.myopts or \
+ "--reinstall" in
self._frozen_config.myopts)
+ respect_use =
self._dynamic_config.myparams.get("binpkg_respect_use") in ("y", "auto")
if built and not useoldpkg and \
(not installed or
matched_packages) and \
not (installed and
self._frozen_config.excluded_pkgs.findAtomForPackage(pkg,
-
modified_use=self._pkg_use_enabled(pkg))) and \
- ("--newuse" in
self._frozen_config.myopts or \
- "--reinstall" in
self._frozen_config.myopts or \
- (not installed and
self._dynamic_config.myparams.get(
- "binpkg_respect_use") in
("y", "auto"))):
- iuses = pkg.iuse.all
- old_use =
self._pkg_use_enabled(pkg)
- if myeb:
-
pkgsettings.setcpv(myeb)
- else:
-
pkgsettings.setcpv(pkg)
- now_use =
pkgsettings["PORTAGE_USE"].split()
- forced_flags = set()
-
forced_flags.update(pkgsettings.useforce)
-
forced_flags.update(pkgsettings.usemask)
- cur_iuse = iuses
- if myeb and not usepkgonly
and not useoldpkg:
- cur_iuse =
myeb.iuse.all
- reinstall_for_flags =
self._reinstall_for_flags(pkg,
- forced_flags,
old_use, iuses, now_use, cur_iuse)
- if reinstall_for_flags:
- if not
pkg.installed:
-
self._dynamic_config.ignored_binaries.setdefault(pkg,
set()).update(reinstall_for_flags)
+
modified_use=self._pkg_use_enabled(pkg))):
+ if myeb and "--newrepo" in
self._frozen_config.myopts and myeb.repo != pkg.repo:
break
+ elif reinstall_use or (not
installed and respect_use):
+ iuses = pkg.iuse.all
+ old_use =
self._pkg_use_enabled(pkg)
+ if myeb:
+
pkgsettings.setcpv(myeb)
+ else:
+
pkgsettings.setcpv(pkg)
+ now_use =
pkgsettings["PORTAGE_USE"].split()
+ forced_flags = set()
+
forced_flags.update(pkgsettings.useforce)
+
forced_flags.update(pkgsettings.usemask)
+ cur_iuse = iuses
+ if myeb and not
usepkgonly and not useoldpkg:
+ cur_iuse =
myeb.iuse.all
+ reinstall_for_flags
= self._reinstall_for_flags(pkg,
+
forced_flags, old_use, iuses, now_use, cur_iuse)
+ if
reinstall_for_flags:
+ if not
pkg.installed:
+
self._dynamic_config.ignored_binaries.setdefault(pkg,
set()).update(reinstall_for_flags)
+ break
# Compare current config to
installed package
# and do not reinstall if possible.
- if not installed and not useoldpkg
and \
- ("--newuse" in
self._frozen_config.myopts or \
- "--reinstall" in
self._frozen_config.myopts) and \
- cpv in vardb.match(atom):
- forced_flags = set()
-
forced_flags.update(pkg.use.force)
-
forced_flags.update(pkg.use.mask)
+ if not installed and not useoldpkg
and cpv in vardb.match(atom):
inst_pkg =
vardb.match_pkgs('=' + pkg.cpv)[0]
- old_use =
inst_pkg.use.enabled
- old_iuse = inst_pkg.iuse.all
- cur_use =
self._pkg_use_enabled(pkg)
- cur_iuse = pkg.iuse.all
- reinstall_for_flags = \
-
self._reinstall_for_flags(pkg,
- forced_flags,
old_use, old_iuse,
- cur_use, cur_iuse)
- if reinstall_for_flags:
+ if "--newrepo" in
self._frozen_config.myopts and pkg.repo != inst_pkg.repo:
reinstall = True
+ elif reinstall_use:
+ forced_flags = set()
+
forced_flags.update(pkg.use.force)
+
forced_flags.update(pkg.use.mask)
+ old_use =
inst_pkg.use.enabled
+ old_iuse =
inst_pkg.iuse.all
+ cur_use =
self._pkg_use_enabled(pkg)
+ cur_iuse =
pkg.iuse.all
+ reinstall_for_flags
= \
+
self._reinstall_for_flags(pkg,
+
forced_flags, old_use, old_iuse,
+ cur_use,
cur_iuse)
+ if
reinstall_for_flags:
+ reinstall =
True
if
reinstall_atoms.findAtomForPackage(pkg, \
modified_use=self._pkg_use_enabled(pkg)):
reinstall = True
diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py
index 52cfd00..ab4e88f 100644
--- a/pym/_emerge/help.py
+++ b/pym/_emerge/help.py
@@ -17,7 +17,7 @@ def help():
print(" [ " + green("--color")+" < " + turquoise("y") + "
| "+ turquoise("n")+" > ] [ "+green("--columns")+" ]")
print(" [ "+green("--complete-graph")+" ] [
"+green("--deep")+" ]")
print(" [ "+green("--jobs") + " " + turquoise("JOBS")+" ]
[ "+green("--keep-going")+" ] [ " + green("--load-average")+" " +
turquoise("LOAD") + " ]")
- print(" [ "+green("--newuse")+" ] [
"+green("--noconfmem")+" ] [ "+green("--nospinner")+" ]")
+ print(" [ "+green("--newrepo")+" ] [
"+green("--newuse")+" ] [ "+green("--noconfmem")+" ] [
"+green("--nospinner")+" ]")
print(" [ "+green("--oneshot")+" ] [
"+green("--onlydeps")+" ] [ "+ green("--quiet-build")+" [ " +
turquoise("y") + " | "+ turquoise("n")+" ] ]")
print(" [ "+green("--reinstall
")+turquoise("changed-use")+" ] [ " + green("--with-bdeps")+" < " +
turquoise("y") + " | "+ turquoise("n")+" > ]")
print(bold("Actions:")+" [ "+green("--depclean")+" |
"+green("--list-sets")+" | "+green("--search")+" | "+green("--sync")+" |
"+green("--version")+" ]")
--
1.8.0.2
[-- Attachment #2: Type: text/html, Size: 16096 bytes --]
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-14 17:31 [gentoo-portage-dev] [PATCH] Implement --newrepo flag David James
@ 2014-02-14 20:31 ` Sebastian Luther
2014-02-14 20:43 ` David James
2014-02-17 7:45 ` Mike Frysinger
1 sibling, 1 reply; 13+ messages in thread
From: Sebastian Luther @ 2014-02-14 20:31 UTC (permalink / raw
To: gentoo-portage-dev
Am 14.02.2014 18:31, schrieb David James:
> The --newrepo flag tells emerge to recompile a package if it is now being
> pulled from a different repository.
>
> BUG=chromium:200417
> TEST=Verify ebuilds get pulled in when repo changes.
> ---
> man/emerge.1 | 5 +++
> pym/_emerge/create_depgraph_params.py | 1 +
> pym/_emerge/depgraph.py | 80
> ++++++++++++++++++-----------------
Do you have this patch in some public repo to pull from? I just can't
manage to get it out of the mail with thunderbird...
For now one thing:
Please add some tests.
- Sebastian
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-14 20:31 ` Sebastian Luther
@ 2014-02-14 20:43 ` David James
2014-02-14 21:37 ` Sebastian Luther
0 siblings, 1 reply; 13+ messages in thread
From: David James @ 2014-02-14 20:43 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Mike Frysinger
[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]
On Fri, Feb 14, 2014 at 12:31 PM, Sebastian Luther
<SebastianLuther@gmx.de>wrote:
> Am 14.02.2014 18:31, schrieb David James:
> > The --newrepo flag tells emerge to recompile a package if it is now being
> > pulled from a different repository.
> >
> > BUG=chromium:200417
> > TEST=Verify ebuilds get pulled in when repo changes.
> > ---
> > man/emerge.1 | 5 +++
> > pym/_emerge/create_depgraph_params.py | 1 +
> > pym/_emerge/depgraph.py | 80
> > ++++++++++++++++++-----------------
>
> Do you have this patch in some public repo to pull from? I just can't
> manage to get it out of the mail with thunderbird...
>
> For now one thing:
> Please add some tests.
>
Uploaded here: https://chromium-review.googlesource.com/#/c/186651/
You should be able to cherry-pick using this command:
git fetch
https://chromium.googlesource.com/chromiumos/third_party/portage_toolrefs/changes/51/186651/1
&& git cherry-pick FETCH_HEAD
I haven't added automated tests yet.
Cheers,
David
[-- Attachment #2: Type: text/html, Size: 1810 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-14 20:43 ` David James
@ 2014-02-14 21:37 ` Sebastian Luther
2014-02-17 4:57 ` David James
0 siblings, 1 reply; 13+ messages in thread
From: Sebastian Luther @ 2014-02-14 21:37 UTC (permalink / raw
To: gentoo-portage-dev
Am 14.02.2014 21:43, schrieb David James:
>
> Uploaded here: https://chromium-review.googlesource.com/#/c/186651/
>
> You should be able to cherry-pick using this command:
> git fetch
> https://chromium.googlesource.com/chromiumos/third_party/portage_tool
> refs/changes/51/186651/1 && git cherry-pick FETCH_HEAD
>
The patch has conflicts in depgraph.py.
> I haven't added automated tests yet.
>
> Cheers,
>
> David
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-14 21:37 ` Sebastian Luther
@ 2014-02-17 4:57 ` David James
2014-02-17 7:49 ` Mike Frysinger
0 siblings, 1 reply; 13+ messages in thread
From: David James @ 2014-02-17 4:57 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 764 bytes --]
On Fri, Feb 14, 2014 at 1:37 PM, Sebastian Luther <SebastianLuther@gmx.de>wrote:
> Am 14.02.2014 21:43, schrieb David James:
> >
> > Uploaded here: https://chromium-review.googlesource.com/#/c/186651/
> >
> > You should be able to cherry-pick using this command:
> > git fetch
> > https://chromium.googlesource.com/chromiumos/third_party/portage_tool
> > refs/changes/51/186651/1 && git cherry-pick FETCH_HEAD
> >
>
> The patch has conflicts in depgraph.py.
Rebased against latest master. I've also added a bunch of tests.
Review URL:
https://chromium-review.googlesource.com/#/c/186651/3
Fetch command:
git fetch
https://chromium.googlesource.com/chromiumos/third_party/portage_toolrefs/changes/51/186651/3
&& git cherry-pick FETCH_HEAD
Cheers,
David
[-- Attachment #2: Type: text/html, Size: 1695 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-14 17:31 [gentoo-portage-dev] [PATCH] Implement --newrepo flag David James
2014-02-14 20:31 ` Sebastian Luther
@ 2014-02-17 7:45 ` Mike Frysinger
1 sibling, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2014-02-17 7:45 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: David James
[-- Attachment #1: Type: text/plain, Size: 826 bytes --]
On Friday, February 14, 2014 09:31:19 David James wrote:
> The --newrepo flag tells emerge to recompile a package if it is now being
> pulled from a different repository.
>
> BUG=chromium:200417
> TEST=Verify ebuilds get pulled in when repo changes.
> ---
> man/emerge.1 | 5 +++
> pym/_emerge/create_depgraph_params.py | 1 +
> pym/_emerge/depgraph.py | 80
> ++++++++++++++++++-----------------
> pym/_emerge/help.py | 2 +-
> 4 files changed, 48 insertions(+), 40 deletions(-)
looks like your client line wrapped everything which is why it's unusable. i
guess you need to use `git send-email` or tell your client to disable line
wrapping when sending out patches. unless gmail is your client in which case
you have to use `git` ;).
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-17 4:57 ` David James
@ 2014-02-17 7:49 ` Mike Frysinger
2014-02-17 16:39 ` Brian Dolbec
0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2014-02-17 7:49 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: David James
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
On Sunday, February 16, 2014 20:57:29 David James wrote:
> On Fri, Feb 14, 2014 at 1:37 PM, Sebastian Luther wrote:
> > Am 14.02.2014 21:43, schrieb David James:
> > > Uploaded here: https://chromium-review.googlesource.com/#/c/186651/
> > >
> > > You should be able to cherry-pick using this command:
> > > git fetch
> > >
> > > https://chromium.googlesource.com/chromiumos/third_party/portage_tool
> > > refs/changes/51/186651/1 && git cherry-pick FETCH_HEAD
> >
> > The patch has conflicts in depgraph.py.
>
> Rebased against latest master. I've also added a bunch of tests.
LGTM
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-17 7:49 ` Mike Frysinger
@ 2014-02-17 16:39 ` Brian Dolbec
2014-02-17 17:52 ` David James
2014-02-17 18:23 ` Sebastian Luther
0 siblings, 2 replies; 13+ messages in thread
From: Brian Dolbec @ 2014-02-17 16:39 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]
On Mon, 17 Feb 2014 02:49:24 -0500
Mike Frysinger <vapier@gentoo.org> wrote:
> On Sunday, February 16, 2014 20:57:29 David James wrote:
> > On Fri, Feb 14, 2014 at 1:37 PM, Sebastian Luther wrote:
> > > Am 14.02.2014 21:43, schrieb David James:
> > > > Uploaded here:
> > > > https://chromium-review.googlesource.com/#/c/186651/
> > > >
> > > > You should be able to cherry-pick using this command:
> > > > git fetch
> > > >
> > > > https://chromium.googlesource.com/chromiumos/third_party/portage_tool
> > > > refs/changes/51/186651/1 && git cherry-pick FETCH_HEAD
> > >
> > > The patch has conflicts in depgraph.py.
> >
> > Rebased against latest master. I've also added a bunch of tests.
>
> LGTM
> -mike
Well, it looks fine looking at it from your review link. But I am
unable to fetch it from your link to test.
fatal: remote error: Git repository not found.
Mike, if you can confirm the tests pass. Go ahead and merge it.
--
Brian Dolbec <dolsen>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-17 16:39 ` Brian Dolbec
@ 2014-02-17 17:52 ` David James
2014-02-17 20:09 ` Sebastian Luther
2014-02-17 18:23 ` Sebastian Luther
1 sibling, 1 reply; 13+ messages in thread
From: David James @ 2014-02-17 17:52 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: David James
The --newrepo flag tells emerge to recompile a package if it is now
being pulled from a different repository.
BUG=chromium:200417
TEST=Verify ebuilds get pulled in when repo changes.
TEST=New test cases.
Change-Id: I8d5ff1cfc8c1d23e00c733b861547d3626bc2ece
---
man/emerge.1 | 5 ++
pym/_emerge/create_depgraph_params.py | 1 +
pym/_emerge/depgraph.py | 80 ++++++++++++++-------------
pym/_emerge/help.py | 2 +-
pym/_emerge/main.py | 1 +
pym/portage/tests/emerge/test_simple.py | 1 +
pym/portage/tests/resolver/test_multirepo.py | 82 +++++++++++++++++++++++++++-
7 files changed, 131 insertions(+), 41 deletions(-)
diff --git a/man/emerge.1 b/man/emerge.1
index 7b507fe..eacb77a 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -553,6 +553,11 @@ a list of packages with similar names when a package doesn't exist.
The \fIEMERGE_DEFAULT_OPTS\fR variable may be used to disable this
option by default.
.TP
+.BR "\-\-newrepo "
+Tells emerge to recompile a package if it is now being pulled from a
+different repository. This option also implies the
+\fB\-\-selective\fR option.
+.TP
.BR "\-\-newuse " (\fB\-N\fR)
Tells emerge to include installed packages where USE
flags have changed since compilation. This option
diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py
index 98a7646..f9accf0 100644
--- a/pym/_emerge/create_depgraph_params.py
+++ b/pym/_emerge/create_depgraph_params.py
@@ -46,6 +46,7 @@ def create_depgraph_params(myopts, myaction):
myparams['rebuild_if_new_slot'] = rebuild_if_new_slot
if "--update" in myopts or \
+ "--newrepo" in myopts or \
"--newuse" in myopts or \
"--reinstall" in myopts or \
"--noreplace" in myopts or \
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 2ed7aeb..b741c47 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -5389,54 +5389,56 @@ class depgraph(object):
break
# Compare built package to current config and
# reject the built package if necessary.
+ reinstall_use = ("--newuse" in self._frozen_config.myopts or \
+ "--reinstall" in self._frozen_config.myopts)
+ respect_use = self._dynamic_config.myparams.get("binpkg_respect_use") in ("y", "auto")
if built and not useoldpkg and \
(not installed or matched_packages) and \
not (installed and
self._frozen_config.excluded_pkgs.findAtomForPackage(pkg,
- modified_use=self._pkg_use_enabled(pkg))) and \
- ("--newuse" in self._frozen_config.myopts or \
- "--reinstall" in self._frozen_config.myopts or \
- (not installed and self._dynamic_config.myparams.get(
- "binpkg_respect_use") in ("y", "auto"))):
- iuses = pkg.iuse.all
- old_use = self._pkg_use_enabled(pkg)
- if myeb:
- pkgsettings.setcpv(myeb)
- else:
- pkgsettings.setcpv(pkg)
- now_use = pkgsettings["PORTAGE_USE"].split()
- forced_flags = set()
- forced_flags.update(pkgsettings.useforce)
- forced_flags.update(pkgsettings.usemask)
- cur_iuse = iuses
- if myeb and not usepkgonly and not useoldpkg:
- cur_iuse = myeb.iuse.all
- reinstall_for_flags = self._reinstall_for_flags(pkg,
- forced_flags, old_use, iuses, now_use, cur_iuse)
- if reinstall_for_flags:
- if not pkg.installed:
- self._dynamic_config.ignored_binaries.setdefault(pkg, set()).update(reinstall_for_flags)
+ modified_use=self._pkg_use_enabled(pkg))):
+ if myeb and "--newrepo" in self._frozen_config.myopts and myeb.repo != pkg.repo:
break
+ elif reinstall_use or (not installed and respect_use):
+ iuses = pkg.iuse.all
+ old_use = self._pkg_use_enabled(pkg)
+ if myeb:
+ pkgsettings.setcpv(myeb)
+ else:
+ pkgsettings.setcpv(pkg)
+ now_use = pkgsettings["PORTAGE_USE"].split()
+ forced_flags = set()
+ forced_flags.update(pkgsettings.useforce)
+ forced_flags.update(pkgsettings.usemask)
+ cur_iuse = iuses
+ if myeb and not usepkgonly and not useoldpkg:
+ cur_iuse = myeb.iuse.all
+ reinstall_for_flags = self._reinstall_for_flags(pkg,
+ forced_flags, old_use, iuses, now_use, cur_iuse)
+ if reinstall_for_flags:
+ if not pkg.installed:
+ self._dynamic_config.ignored_binaries.setdefault(pkg, set()).update(reinstall_for_flags)
+ break
# Compare current config to installed package
# and do not reinstall if possible.
- if not installed and not useoldpkg and \
- ("--newuse" in self._frozen_config.myopts or \
- "--reinstall" in self._frozen_config.myopts) and \
- cpv in vardb.match(atom):
- forced_flags = set()
- forced_flags.update(pkg.use.force)
- forced_flags.update(pkg.use.mask)
+ if not installed and not useoldpkg and cpv in vardb.match(atom):
inst_pkg = vardb.match_pkgs('=' + pkg.cpv)[0]
- old_use = inst_pkg.use.enabled
- old_iuse = inst_pkg.iuse.all
- cur_use = self._pkg_use_enabled(pkg)
- cur_iuse = pkg.iuse.all
- reinstall_for_flags = \
- self._reinstall_for_flags(pkg,
- forced_flags, old_use, old_iuse,
- cur_use, cur_iuse)
- if reinstall_for_flags:
+ if "--newrepo" in self._frozen_config.myopts and pkg.repo != inst_pkg.repo:
reinstall = True
+ elif reinstall_use:
+ forced_flags = set()
+ forced_flags.update(pkg.use.force)
+ forced_flags.update(pkg.use.mask)
+ old_use = inst_pkg.use.enabled
+ old_iuse = inst_pkg.iuse.all
+ cur_use = self._pkg_use_enabled(pkg)
+ cur_iuse = pkg.iuse.all
+ reinstall_for_flags = \
+ self._reinstall_for_flags(pkg,
+ forced_flags, old_use, old_iuse,
+ cur_use, cur_iuse)
+ if reinstall_for_flags:
+ reinstall = True
if reinstall_atoms.findAtomForPackage(pkg, \
modified_use=self._pkg_use_enabled(pkg)):
reinstall = True
diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py
index 52cfd00..ab4e88f 100644
--- a/pym/_emerge/help.py
+++ b/pym/_emerge/help.py
@@ -17,7 +17,7 @@ def help():
print(" [ " + green("--color")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ] [ "+green("--columns")+" ]")
print(" [ "+green("--complete-graph")+" ] [ "+green("--deep")+" ]")
print(" [ "+green("--jobs") + " " + turquoise("JOBS")+" ] [ "+green("--keep-going")+" ] [ " + green("--load-average")+" " + turquoise("LOAD") + " ]")
- print(" [ "+green("--newuse")+" ] [ "+green("--noconfmem")+" ] [ "+green("--nospinner")+" ]")
+ print(" [ "+green("--newrepo")+" ] [ "+green("--newuse")+" ] [ "+green("--noconfmem")+" ] [ "+green("--nospinner")+" ]")
print(" [ "+green("--oneshot")+" ] [ "+green("--onlydeps")+" ] [ "+ green("--quiet-build")+" [ " + turquoise("y") + " | "+ turquoise("n")+" ] ]")
print(" [ "+green("--reinstall ")+turquoise("changed-use")+" ] [ " + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]")
print(bold("Actions:")+" [ "+green("--depclean")+" | "+green("--list-sets")+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+" ]")
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index da223a6..6225fc9 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -36,6 +36,7 @@ options=[
"--fetchonly", "--fetch-all-uri",
"--ignore-default-opts",
"--noconfmem",
+"--newrepo",
"--newuse",
"--nodeps", "--noreplace",
"--nospinner", "--oneshot",
diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index d3bb866..bf0af8b 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -247,6 +247,7 @@ pkg_preinst() {
ebuild_cmd + (test_ebuild, "manifest", "clean", "package", "merge"),
emerge_cmd + ("--pretend", "--tree", "--complete-graph", "dev-libs/A"),
emerge_cmd + ("-p", "dev-libs/B"),
+ emerge_cmd + ("-p", "--newrepo", "dev-libs/B"),
emerge_cmd + ("-B", "dev-libs/B",),
emerge_cmd + ("--oneshot", "--usepkg", "dev-libs/B",),
diff --git a/pym/portage/tests/resolver/test_multirepo.py b/pym/portage/tests/resolver/test_multirepo.py
index 8d65b2c..5c3ef7e 100644
--- a/pym/portage/tests/resolver/test_multirepo.py
+++ b/pym/portage/tests/resolver/test_multirepo.py
@@ -37,11 +37,20 @@ class MultirepoTestCase(TestCase):
"dev-libs/I-1::repo2": { "SLOT" : "1"},
"dev-libs/I-2::repo2": { "SLOT" : "2"},
+
+ "dev-libs/K-1::repo2": { },
}
installed = {
"dev-libs/H-1": { "RDEPEND" : "|| ( dev-libs/I:2 dev-libs/I:1 )"},
"dev-libs/I-2::repo1": {"SLOT" : "2"},
+ "dev-libs/K-1::repo1": { },
+ }
+
+ binpkgs = {
+ "dev-libs/C-1::repo2": { },
+ "dev-libs/I-2::repo1": {"SLOT" : "2"},
+ "dev-libs/K-1::repo2": { },
}
sets = {
@@ -96,6 +105,68 @@ class MultirepoTestCase(TestCase):
check_repo_names = True,
mergelist = ["dev-libs/D-1::repo2"]),
+ #--usepkg: don't reinstall on new repo without --newrepo
+ ResolverPlaygroundTestCase(
+ ["dev-libs/C"],
+ options = {"--usepkg": True, "--selective": True},
+ success = True,
+ check_repo_names = True,
+ mergelist = ["[binary]dev-libs/C-1::repo2"]),
+
+ #--usepkgonly: don't reinstall on new repo without --newrepo
+ ResolverPlaygroundTestCase(
+ ["dev-libs/C"],
+ options = {"--usepkgonly": True, "--selective": True},
+ success = True,
+ check_repo_names = True,
+ mergelist = ["[binary]dev-libs/C-1::repo2"]),
+
+ #--newrepo: pick ebuild if binpkg/ebuild have different repo
+ ResolverPlaygroundTestCase(
+ ["dev-libs/C"],
+ options = {"--usepkg": True, "--newrepo": True, "--selective": True},
+ success = True,
+ check_repo_names = True,
+ mergelist = ["dev-libs/C-1::repo1"]),
+
+ #--newrepo --usepkgonly: ebuild is ignored
+ ResolverPlaygroundTestCase(
+ ["dev-libs/C"],
+ options = {"--usepkgonly": True, "--newrepo": True, "--selective": True},
+ success = True,
+ check_repo_names = True,
+ mergelist = ["[binary]dev-libs/C-1::repo2"]),
+
+ #--newrepo: pick ebuild if binpkg/ebuild have different repo
+ ResolverPlaygroundTestCase(
+ ["dev-libs/I"],
+ options = {"--usepkg": True, "--newrepo": True, "--selective": True},
+ success = True,
+ check_repo_names = True,
+ mergelist = ["dev-libs/I-2::repo2"]),
+
+ #--newrepo --usepkgonly: if binpkg matches installed, do nothing
+ ResolverPlaygroundTestCase(
+ ["dev-libs/I"],
+ options = {"--usepkgonly": True, "--newrepo": True, "--selective": True},
+ success = True,
+ mergelist = []),
+
+ #--newrepo --usepkgonly: reinstall if binpkg has new repo.
+ ResolverPlaygroundTestCase(
+ ["dev-libs/K"],
+ options = {"--usepkgonly": True, "--newrepo": True, "--selective": True},
+ success = True,
+ check_repo_names = True,
+ mergelist = ["[binary]dev-libs/K-1::repo2"]),
+
+ #--usepkgonly: don't reinstall on new repo without --newrepo.
+ ResolverPlaygroundTestCase(
+ ["dev-libs/K"],
+ options = {"--usepkgonly": True, "--selective": True},
+ success = True,
+ mergelist = []),
+
#Atoms with slots
ResolverPlaygroundTestCase(
["dev-libs/E"],
@@ -137,6 +208,15 @@ class MultirepoTestCase(TestCase):
success = True,
mergelist = []),
+ # Dependency on installed dev-libs/I-2 ebuild should trigger reinstall
+ # when --newrepo flag is used.
+ ResolverPlaygroundTestCase(
+ ["dev-libs/H"],
+ options = {"--update": True, "--deep": True, "--newrepo": True},
+ success = True,
+ check_repo_names = True,
+ mergelist = ["dev-libs/I-2::repo2"]),
+
# Check interaction between repo priority and unsatisfied
# REQUIRED_USE, for bug #350254.
ResolverPlaygroundTestCase(
@@ -147,7 +227,7 @@ class MultirepoTestCase(TestCase):
)
playground = ResolverPlayground(ebuilds=ebuilds,
- installed=installed, sets=sets)
+ binpkgs=binpkgs, installed=installed, sets=sets)
try:
for test_case in test_cases:
playground.run_TestCase(test_case)
--
1.8.0.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-17 16:39 ` Brian Dolbec
2014-02-17 17:52 ` David James
@ 2014-02-17 18:23 ` Sebastian Luther
1 sibling, 0 replies; 13+ messages in thread
From: Sebastian Luther @ 2014-02-17 18:23 UTC (permalink / raw
To: gentoo-portage-dev
Am 17.02.2014 17:39, schrieb Brian Dolbec:
>
> Mike, if you can confirm the tests pass. Go ahead and merge it.
>
Please give me some more time to review it. I'll commit it if it lgtm.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-17 17:52 ` David James
@ 2014-02-17 20:09 ` Sebastian Luther
2014-02-17 21:44 ` David James
0 siblings, 1 reply; 13+ messages in thread
From: Sebastian Luther @ 2014-02-17 20:09 UTC (permalink / raw
To: gentoo-portage-dev
Am 17.02.2014 18:52, schrieb David James:
> @@ -96,6 +105,68 @@ class MultirepoTestCase(TestCase):
<snip>
> +
> + #--newrepo: pick ebuild if binpkg/ebuild have different repo
> + ResolverPlaygroundTestCase(
> + ["dev-libs/C"],
> + options = {"--usepkg": True, "--newrepo": True, "--selective": True},
> + success = True,
> + check_repo_names = True,
> + mergelist = ["dev-libs/C-1::repo1"]),
Why should it take the ebuild from the repo with lower priority?
I thought the intend was that the package should be reinstalled if it is
now pulled from a repo with higher priority than the repo from which the
installed package came.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-17 20:09 ` Sebastian Luther
@ 2014-02-17 21:44 ` David James
2014-02-18 17:35 ` Sebastian Luther
0 siblings, 1 reply; 13+ messages in thread
From: David James @ 2014-02-17 21:44 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 1800 bytes --]
On Mon, Feb 17, 2014 at 12:09 PM, Sebastian Luther
<SebastianLuther@gmx.de>wrote:
> Am 17.02.2014 18:52, schrieb David James:
> > @@ -96,6 +105,68 @@ class MultirepoTestCase(TestCase):
> <snip>
> > +
> > + #--newrepo: pick ebuild if binpkg/ebuild have
> different repo
> > + ResolverPlaygroundTestCase(
> > + ["dev-libs/C"],
> > + options = {"--usepkg": True, "--newrepo":
> True, "--selective": True},
> > + success = True,
> > + check_repo_names = True,
> > + mergelist = ["dev-libs/C-1::repo1"]),
>
> Why should it take the ebuild from the repo with lower priority?
>
> I thought the intend was that the package should be reinstalled if it is
> now pulled from a repo with higher priority than the repo from which the
> installed package came.
Interesting idea -- but no, that's not what I implemented. The intent here
is that a package will be reinstalled if it is now pulled from a different
repo than the repo from which the installed package came. This is actually
an important difference for our use case -- it allows you to switch in both
directions, both to higher priority repos and to lower priority repos.
From a theoretical perspective, the reason why I implemented this is
because "ebuilds" are the source of truth. According to the ebuilds, the
owner repo of dev-libs/C-1 is repo1, so this means that, with --newrepo,
any binpkg for dev-libs/C-1 from repo2 would be invalid.
This functionality is useful in the case where an ebuild changes repos. In
this case, with --newrepo, you would want the package to be rebuilt and any
binaries to be invalidated, and our tests validate this.
Cheers,
David
[-- Attachment #2: Type: text/html, Size: 2557 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Implement --newrepo flag.
2014-02-17 21:44 ` David James
@ 2014-02-18 17:35 ` Sebastian Luther
0 siblings, 0 replies; 13+ messages in thread
From: Sebastian Luther @ 2014-02-18 17:35 UTC (permalink / raw
To: gentoo-portage-dev
Am 17.02.2014 22:44, schrieb David James:
> From a theoretical perspective, the reason why I implemented this is
> because "ebuilds" are the source of truth. According to the ebuilds, the
> owner repo of dev-libs/C-1 is repo1, so this means that, with --newrepo,
> any binpkg for dev-libs/C-1 from repo2 would be invalid.
Actually this test passes even without --new-repo. So yes, your
interpretation is what's used by portage. Patch is committed.
>
> This functionality is useful in the case where an ebuild changes repos.
> In this case, with --newrepo, you would want the package to be rebuilt
> and any binaries to be invalidated, and our tests validate this.
>
> Cheers,
>
> David
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-02-18 17:35 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-14 17:31 [gentoo-portage-dev] [PATCH] Implement --newrepo flag David James
2014-02-14 20:31 ` Sebastian Luther
2014-02-14 20:43 ` David James
2014-02-14 21:37 ` Sebastian Luther
2014-02-17 4:57 ` David James
2014-02-17 7:49 ` Mike Frysinger
2014-02-17 16:39 ` Brian Dolbec
2014-02-17 17:52 ` David James
2014-02-17 20:09 ` Sebastian Luther
2014-02-17 21:44 ` David James
2014-02-18 17:35 ` Sebastian Luther
2014-02-17 18:23 ` Sebastian Luther
2014-02-17 7:45 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox