How to reliably get the current manifest name

285 views
Skip to first unread message

Nicolas CARRIER

unread,
Mar 29, 2021, 11:54:27 AM3/29/21
to Repo and Gerrit Discussion
Hello,
We used to use an old repo version (1.12.37) in which .repo/manifest.xml was a symlink to the manifest currently used.
With repo 2.13.7, it's not the case anymore, a text manifest is created which includes the real one.
I used to use readlink to obtain the original manifest name but that won't obviously work...

So is there a way to reliably obtain the name of the manifest currently in use in a workspace?

Nicolas CARRIER

unread,
Mar 30, 2021, 2:25:35 AM3/30/21
to Christian Gagneraud, Repo and Gerrit Discussion
Hello,
Thank you for your answer, but I think I wasn't explicit enough.
Since the way the current manifest is referenced has changed, my understanding is that it's considered as an internal implementation detail of repo. And I'd like to have a future proof way of getting it.
ATM, I'm using this bash function:

# Return the manifest currently in use in the workspace we're in.
# In version 1.12.37, .repo/manifest.xml was a symlink to the manifest in use.
# In 2.13.7, it's an xml file, with an include directive.
get_current_manifest() {
    local manifest=.repo/manifest.xml

    if [ -L ${manifest} ]; then
        readlink ${manifest}
    else
        xpath -q -e 'string(/manifest/include/@name)' ${manifest}
    fi
}

which works fine, but if the way the current manifest changes yet once more in the future, this function will break too.

So my question is, is there a way to query it using a repo command ? Something like `repo manifest get_current`?

Le mar. 30 mars 2021 à 06:24, Christian Gagneraud <chg...@gmail.com> a écrit :
AFAIU, the include in .repo/manifest.xml gives you the name of the
file, this file is located in .repo/manifest/

Chris

Christian Gagneraud

unread,
Mar 30, 2021, 2:40:08 AM3/30/21
to Nicolas CARRIER, Repo and Gerrit Discussion
On Tue, 30 Mar 2021 at 04:54, Nicolas CARRIER
<carrier....@gmail.com> wrote:
>
Reply all
Reply to author
Forward
0 new messages