Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 712106

Summary: app-portage/repoman: improve handling of stale or missing git index
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: RepomanAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: jer
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---

Description Zac Medico gentoo-dev 2020-03-11 06:16:21 UTC
If I remove the git index, then repoman doesn't handle it very well:

> $ rm ../../.git/index
> $ repoman commit
> 
> RepoMan scours the neighborhood...
> >>> Creating Manifest for /var/db/repos/gentoo/app-portage/repoman
>   ebuild.notadded               3
>    app-portage/repoman/repoman-2.3.16.ebuild
>    app-portage/repoman/repoman-2.3.20.ebuild
>    app-portage/repoman/repoman-9999.ebuild
> !!! The following files are in your local tree but are not added to the master
> !!! tree. Please remove them from the local tree or add them to the master tree.
>     ./metadata.xml
>     ./repoman-2.3.16.ebuild
>     ./repoman-2.3.20.ebuild
>     ./repoman-9999.ebuild
Possibly triggered by stale index, I've seen repoman update the copyright header for files that haven't changed.
Comment 1 Larry the Git Cow gentoo-dev 2020-03-15 01:47:03 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=c93dc19cb0f8d5769ee13b7f2ccaeaf661013f30

commit c93dc19cb0f8d5769ee13b7f2ccaeaf661013f30
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-03-15 01:44:27 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-03-15 01:46:24 +0000

    repoman.modules.vcs.git.changes: reindex (bug 712106)
    
    For files returned by git diff-index, call git update-index in order
    to ensure that the index reflects the state on disk. This will prevent
    incorrect assumptions in cases where the index is missing or stale for
    some reason. Since repoman uses this information to decide when to
    update copyright header dates, this can prevent spurious copyright
    header updates.
    
    Signed-off-by: Zac Medico <zmedico@gentoo.org>
    Bug: https://bugs.gentoo.org/712106

 repoman/lib/repoman/modules/vcs/git/changes.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
Comment 2 Larry the Git Cow gentoo-dev 2020-03-15 02:08:25 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d99d1052a0d4d2d54b12098dd9c5aa60eae00ea9

commit d99d1052a0d4d2d54b12098dd9c5aa60eae00ea9
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-03-15 02:03:52 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-03-15 02:08:17 +0000

    app-portage/repoman: Bump to version 2.3.21
    
     #712106 prevent spurious copyright header updates
    
    Bug: https://bugs.gentoo.org/712106
    Package-Manager: Portage-2.3.94, Repoman-2.3.21
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 app-portage/repoman/Manifest              |  1 +
 app-portage/repoman/repoman-2.3.21.ebuild | 64 +++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2020-03-25 08:49:21 UTC
I found myself wondering what had done the equivalent of a `git add` and it turns out the changes to address this issue might be the cause. Running `repoman full` now stages changes. Is there a way to turn this off?
Comment 4 Zac Medico gentoo-dev 2020-03-25 16:00:17 UTC
(In reply to Jeroen Roovers from comment #3)
> I found myself wondering what had done the equivalent of a `git add` and it
> turns out the changes to address this issue might be the cause. Running
> `repoman full` now stages changes. Is there a way to turn this off?

There's currently no way to turn it off. Ideally, we'd find some sort of comprise that solves the test case shown in comment #0 without causing unnecessary modification to the index.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2020-03-25 18:30:18 UTC
So I guess I should propose that it should only be run when repoman actually changes files itself (except Manifest?) - `repoman manifest` and repoman's testing features should not change the git index.
Comment 6 Larry the Git Cow gentoo-dev 2020-03-25 19:57:34 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=f11cabb3c9fe7d09d86f40cc716f14e9b0aed765

commit f11cabb3c9fe7d09d86f40cc716f14e9b0aed765
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-03-25 19:53:45 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-03-25 19:54:48 +0000

    repoman.modules.vcs.git.changes: reindex only for commit mode (bug 712106)
    
    Automatically reindex for commit mode, but not for other modes
    were the user might not want changes to be staged in the index.
    
    Bug: https://bugs.gentoo.org/712106
    Suggested-by: Jeroen Roovers <jer@gentoo.org>
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 repoman/lib/repoman/modules/vcs/git/changes.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 7 Larry the Git Cow gentoo-dev 2020-03-25 20:58:26 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a6073793d5e5c1c96dc9b1435dda478b5fe3767

commit 1a6073793d5e5c1c96dc9b1435dda478b5fe3767
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-03-25 20:54:44 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-03-25 20:58:18 +0000

    app-portage/repoman: Bump to version 2.3.22
    
     #712106 only stage changes in index for commit mode
    
    Bug: https://bugs.gentoo.org/712106
    Package-Manager: Portage-2.3.96, Repoman-2.3.22
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 app-portage/repoman/Manifest              |  1 +
 app-portage/repoman/repoman-2.3.22.ebuild | 64 +++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)