Thread View: linux.debian.bugs.dist
5 messages
5 total messages
Started by Agustin Martin
Wed, 14 Oct 2026 10:30
Bug#1145549: fails to download submodules if run from git checkout and upstream is configured as remote
Author: Agustin Martin
Date: Wed, 14 Oct 2026 10:30
Date: Wed, 14 Oct 2026 10:30
76 lines
5330 bytes
5330 bytes
On Sat, Sep 05, 2026 at 07:55:27PM +0200, Agustin Martin wrote: > On Wed, Aug 26, 2026 at 12:25:01AM +0900, Simon Richter wrote: > > Package: devscripts > > Version: 2.26.11~bpo13+1 > > Severity: normal > > X-Debbugs-Cc: sjr@debian.org > > > > I have upstream's git repository configured as a remote in my work tree. > > Upstream uses submodules, which get squashed into a single archive by > > uscan, and that archive is imported into the git repo for the packages. > > > > As a result, when uscan is run, the checked out branch (with the > > debian/watch file) does not have submodules. uscan detects that a remote > > for the upstream git exists in the current repository, and tries to reuse > > that, which is commendable, but fails to do so: > > > > $ git clone https://salsa.debian.org/electronics-team/nextpnr.git > > $ cd nextpnr > > $ git remote add yosys https://github.com/YosysHQ/nextpnr.git Hi, Cc'ing Hugh McMaster, who did a lot of work in this section in case he can add something. > I tried to manually run what uscan is actually doing in this case (seen > using uscan -vv) after above three commands are issued, only with commands > needed to get result (no tags searching, I already know the result). > > $ git fetch --recurse-submodules yosys > $ git archive --format=tar --prefix=nextpnr-0.11.1/ --output=/home/myuser/src/nextpnr-0.11.1.tar refs/tags/nextpnr-0.11.1 > $ git submodule --quiet foreach 'echo $name' > > git archive creates the base tarball, without modules, but "git submodule > --quiet foreach ..." above gives no result. "git submodule" also gives no > result. submodules are defined in .gitmodules, but repo seems to not know > about them. > > $ git submodule --quiet deinit -- > > fatal: Use '--all' if you really want to deinitialize all submodules > > Above error seems caused when deinit command is called on empty > @sm_deinit. While that can be easily hidden, may be that would hide an > actual problem. > > After this, git submodule foreach --recursive 'git archive ...' on > submodules does nothing, so nothing is added to tarball. > > When no upstream remote is configured, upstream repo is cloned and all the > work is done in that cloned repo, apparently working as expected. I kept trying to understand when this happens, and noticed that submodules are not initialized when cloning from salsa Debian repo, but they are when cloning from upstream repo. # Does not work with salsa repo. Submodules not initialized $ git clone https://salsa.debian.org/electronics-team/nextpnr.git $ cd nextpnr $ git submodule update --init --recursive -- 3rdparty/corrosion himbaechel/uarch/xilinx/meta tests # Works with upstream repo. Submodules are initialized. $ git clone https://github.com/YosysHQ/nextpnr.git $ cd nextpnr $ git submodule update --init --recursive -- 3rdparty/corrosion himbaechel/uarch/xilinx/meta tests This seems to be the origin of the problem. When a remote is defined, local repo is used and submodules are not used since they are not initialized. When no remote is defined, upstream repo is used and submodules are initialized and used. Do not understand why this is happening. Hope this helps in some way. Regards, --- Agustin
Bug#1145549: fails to download submodules if run from git checkout and upstream is configured as remote
Author: Agustin Martin
Date: Wed, 11 Nov 2026 23:20
Date: Wed, 11 Nov 2026 23:20
89 lines
5830 bytes
5830 bytes
On Wed, Oct 14, 2026 at 12:19:30PM +0200, Agustin Martin wrote: > On Sat, Sep 05, 2026 at 07:55:27PM +0200, Agustin Martin wrote: > > On Wed, Aug 26, 2026 at 12:25:01AM +0900, Simon Richter wrote: > > > Package: devscripts > > > Version: 2.26.11~bpo13+1 > > > Severity: normal > > > X-Debbugs-Cc: sjr@debian.org > > > > > > I have upstream's git repository configured as a remote in my work tree. > > > Upstream uses submodules, which get squashed into a single archive by > > > uscan, and that archive is imported into the git repo for the packages. > > > > > > As a result, when uscan is run, the checked out branch (with the > > > debian/watch file) does not have submodules. uscan detects that a remote > > > for the upstream git exists in the current repository, and tries to reuse > > > that, which is commendable, but fails to do so: > > > > > > $ git clone https://salsa.debian.org/electronics-team/nextpnr.git > > > $ cd nextpnr > > > $ git remote add yosys https://github.com/YosysHQ/nextpnr.git > > Hi, > > Cc'ing Hugh McMaster, who did a lot of work in this section in case he can > add something. > > I kept trying to understand when this happens, and noticed that submodules > are not initialized when cloning from salsa Debian repo, but they are when > cloning from upstream repo. > > # Does not work with salsa repo. Submodules not initialized > $ git clone https://salsa.debian.org/electronics-team/nextpnr.git > $ cd nextpnr > $ git submodule update --init --recursive -- 3rdparty/corrosion himbaechel/uarch/xilinx/meta tests > > # Works with upstream repo. Submodules are initialized. > $ git clone https://github.com/YosysHQ/nextpnr.git > $ cd nextpnr > $ git submodule update --init --recursive -- 3rdparty/corrosion himbaechel/uarch/xilinx/meta tests > > This seems to be the origin of the problem. When a remote is defined, local > repo is used and submodules are not used since they are not initialized. > When no remote is defined, upstream repo is used and submodules are > initialized and used. Hi, I have tested this a bit more and I tend to think that this is not a problem in uscan but in nextpnr salsa git repo. $ git clone https://salsa.debian.org/electronics-team/nextpnr.git --recurse-submodules Cloning into 'nextpnr'... ... $ cd nextpnr $ git submodule update --init --recursive -- 3rdparty/corrosion himbaechel/uarch/xilinx/meta tests $ git submodule add https://github.com/YosysHQ/nextpnr-tests tests fatal: 'tests' already exists in the index $ git submodule add -f https://github.com/YosysHQ/nextpnr-tests tests fatal: 'tests' already exists in the index and is not a submodule Then tried to see what happens after removing tests contents for git $ git rm -r tests/ rm 'tests/COPYING' ... $ git commit tests -m 'Removing tests submodule contents' [master 8e1cd0e] Removing tests submodule contents ... and adding it again, now really as a submodule, $ git submodule add https://github.com/YosysHQ/nextpnr-tests tests Cloning into '/home/unsafe/.nobackup/src/kk/nextpnr/tests'... ... $ git fetch --recurse-submodules Fetching submodule tests $ git submodule aea0b4bac59e07e0c5088a0966af73abdd8ab217 tests (heads/master) So, seems that intially submodules were not declared as submodules, but present in the repo. This did not happen when using upstream git repo (what happens when there is no remote defined). If I now add the remote and run "uscan --download-current-version" created upstream tarball contains tests/ contents, but not the contents for other submodules. Regards, -- Agustin
Bug#1145549: fails to download submodules if run from git checkout and upstream is configured as remote
Author: Simon Richter
Date: Thu, 12 Nov 2026 03:40
Date: Thu, 12 Nov 2026 03:40
84 lines
5651 bytes
5651 bytes
Hi,
On 11/12/26 8:12 AM, Agustin Martin wrote:
> $ git clone https://salsa.debian.org/electronics-team/nextpnr.git --recurse-submodules
That does not set up submodules, because none of the existing git
mappings for Debian source packages has submodule support, so the
"upstream" branch merges them (and omits the excluded files). It should
perhaps omit the .gitmodules file, but that's a different problem.
The watch file points to another git server though, which *does* have
submodules.
Now uscan, when run from a checkout, will check if we already have a
remote configured for the server listed in the watch file, to avoid a
clone if we already have one. That is good.
The problem is that in order to also get the submodule contents from the
existing clone, the submodule's base URL must also be configured as a
remote.
So, after
> Cloning into 'nextpnr'...
> ...
> $ cd nextpnr
You can run uscan there with no problem, but it will do a full clone
into a temporary directory:
$ uscan -ddd
[some warnings]
Successfully repacked ../nextpnr-0.11.1.tar.xz as
../nextpnr_0.11.1+dfsg.orig.tar.xz, deleting 461 files from it.
$ tar -tJvvf ../nextpnr_0.11.1+dfsg.orig.tar.xz nextpnr-0.11.1/tests/ |
wc -l
260
If you add
$ git remote add yosyshq https://github.com/YosysHQ/nextpnr.git
running uscan will detect that the "yosyshq" remote can be used, and no
fresh clone is necessary. It will even fetch from the remote first:
$ uscan -ddd
[fetch output]
Could not access submodule '3rdparty/abseil-cpp' at commit 0afa0da1
Could not access submodule '3rdparty/corrosion' at commit 06992bda
Could not access submodule '3rdparty/googletest' at commit 64db93e3
Could not access submodule '3rdparty/fpga-interchange-schema' at commit
ba69b355
Could not access submodule 'himbaechel/uarch/xilinx/meta' at commit 0cd6e72d
Could not access submodule 'tests' at commit cd7f7c12
Could not access submodule 'torc' at commit 36edbdcb
fatal: Use '--all' if you really want to deinitialize all submodules
Successfully repacked ../nextpnr-0.11.1.tar.xz as
../nextpnr_0.11.1+dfsg.orig.tar.xz, deleting 461 files from it.
but tests/ is empty:
$ tar -tJvvf ../nextpnr_0.11.1+dfsg.orig.tar.xz nextpnr-0.11.1/tests/ |
wc -l
1
The problem seems to be that uscan tries to avoid using the working
directory, except during submodule handling, where it uses whatever is
currently checked out (so if upstream changes the list of submodules,
that is ignored as well).
> So, seems that intially submodules were not declared as submodules, but
> present in the repo. This did not happen when using upstream git repo (what
> happens when there is no remote defined). If I now add the remote and run
> "uscan --download-current-version" created upstream tarball contains
> tests/ contents, but not the contents for other submodules.
Yes, because now tests/ is a submodule in the current working directory
-- but that is local state influencing the output of uscan, when all we
want is to use the cached objects -- and what's probably worse, uscan
also changes local state by attempting to deinitialize and reinitialize
the submodules.
Simon
Bug#1145549: fails to download submodules if run from git checkout and upstream is configured as remote
Author: Agustin Martin
Date: Tue, 01 Dec 2026 16:40
Date: Tue, 01 Dec 2026 16:40
103 lines
6288 bytes
6288 bytes
--D1NNyyKw5nvwsHNl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Control: tags -1 + patch
On Thu, Nov 12, 2026 at 12:32:44PM +0900, Simon Richter wrote:
> Hi,
>
> On 11/12/26 8:12 AM, Agustin Martin wrote:
>
> The problem seems to be that uscan tries to avoid using the working
> directory, except during submodule handling, where it uses whatever is
> currently checked out (so if upstream changes the list of submodules, that
> is ignored as well).
>
> > So, seems that intially submodules were not declared as submodules, but
> > present in the repo. This did not happen when using upstream git repo (what
> > happens when there is no remote defined). If I now add the remote and run
> > "uscan --download-current-version" created upstream tarball contains
> > tests/ contents, but not the contents for other submodules.
> Yes, because now tests/ is a submodule in the current working directory --
> but that is local state influencing the output of uscan, when all we want is
> to use the cached objects -- and what's probably worse, uscan also changes
> local state by attempting to deinitialize and reinitialize the submodules.
Hi, Simon,
Seems you are completely right. With all the above info I think that the
sensible choice is to always use a cloned git repo if submodules are
requested in debian/watch. As you say, even in the best case local state
will be changed.
I have done some approaches and I am attaching a patch with the approach
that seems to be working with plain uscan and makes devscripts build tests
succeed.
What do you think?
Regards,
--
Agustin
--D1NNyyKw5nvwsHNl
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename=0001-uscan-Git.pm-Clone-git-repo-if-submodules-are-reques.patch
From 69c84a5ebee965f338a8c1c19ff7b9a068a837c5 Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <agmartin@debian.org>
Date: Tue, 1 Dec 2026 14:56:50 +0100
Subject: [PATCH] uscan::Git.pm: Clone git repo if submodules are requested,
even with remote.
Otherwise changes in local state are required to properly handle
submodules together with a remote.
Closes: #1145549
Signed-off-by: Agustin Martin Domingo <agmartin@debian.org>
---
lib/Devscripts/Uscan/Modes/Git.pm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/Devscripts/Uscan/Modes/Git.pm b/lib/Devscripts/Uscan/Modes/Git.pm
index 451ebd79..21245eb8 100644
--- a/lib/Devscripts/Uscan/Modes/Git.pm
+++ b/lib/Devscripts/Uscan/Modes/Git.pm
@@ -29,11 +29,15 @@ sub git_search {
. "========\n";
# Check whether any remote repository URLs match debian/watch Source
- if ($out and $out =~ /^(\S+)\s+\Q$self->{parse_result}->{base}\E/m) {
+ # and no submodules are requested (will clone git repo otherwise)
+ if ( $out
+ and $out =~ /^(\S+)\s+\Q$self->{parse_result}->{base}\E/m
+ and not $self->git->{modules}) {
my $remote = $1;
$self->downloader->git_upstream($remote);
uscan_verbose join ' ',
- "'$self->{parse_result}->{base}' matches debian/watch;",
+ "'$self->{parse_result}->{base}' matches debian/watch",
+ "and no submodules requested;",
"using remote '$remote'";
# Run `git fetch` to update the repository
@@ -46,6 +50,10 @@ sub git_search {
);
$newfile = "$remote/HEAD" if $self->versionless;
+ } else {
+ uscan_verbose join ' ',
+ "Submodules requested or no match for remote;",
+ "not using remote";
}
}
--
2.55.0
--D1NNyyKw5nvwsHNl--
Bug#1145549: fails to download submodules if run from git checkout and upstream is configured as remote
Author: Simon Richter
Date: Tue, 01 Dec 2026 23:50
Date: Tue, 01 Dec 2026 23:50
26 lines
3734 bytes
3734 bytes
Hi,
On 12/2/26 1:30 AM, Agustin Martin wrote:
>> Yes, because now tests/ is a submodule in the current working directory --
>> but that is local state influencing the output of uscan, when all we want is
>> to use the cached objects -- and what's probably worse, uscan also changes
>> local state by attempting to deinitialize and reinitialize the submodules.
> Seems you are completely right. With all the above info I think that the
> sensible choice is to always use a cloned git repo if submodules are
> requested in debian/watch. As you say, even in the best case local state
> will be changed.
That, or a workdir, but we need to take care to clean it up properly.
Most of my packages use git-describe, so they need full clones, making
this a rather expensive and slow operation (that could possibly be fixed
by making it a treeless clone using "--filter=tree:0").
> What do you think?
I'll probably look into it over the weekend, depending on how much I'm
in the mood to deal with the AI fanboys after a relaxing week at work
with the luddites. :)
Simon
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads