Opened 3 years ago

Last modified 7 weeks ago

#4503 closed defect

ensure_dependencies.py fails for git submodule — at Version 6

Reported by: asmirnov Assignee: asmirnov
Priority: P4 Milestone:
Module: Automation Keywords:
Cc: fhd, sebastian, kvas Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29356341/
https://codereview.adblockplus.org/29370933/

Description (last modified by trev)

Background

ensure_dependencies.py script is used to extract required dependencies from git/mercurial repositories. However, it currently fails when running within a git submodule. This is a problem for 3rd-party projects integrating libadblockplus-android as a submodule of their git repository.

How to reproduce

Run the following commands:

  1. git submodule add https://github.com/4ntoine/libadblockplus-android.git
  2. cd ./libadblockplus-android
  3. ./ensure_dependencies.py

Observed behaviour

An error is thrown:

INFO: Cloning repository https://github.com/adblockplus/libadblockplus-binaries into ./libadblockplus-android/jni/libadblockplus-binaries
Traceback (most recent call last):
  File "./ensure_dependencies.py", line 299, in <module>
    resolve_deps(repo)
  File "./ensure_dependencies.py", line 245, in resolve_deps
    ensure_repo(repodir, target, config.get("_root", {}), revisions["_source"])
  File "./ensure_dependencies.py", line 200, in ensure_repo
    repo.ignore(target, parentrepo)
  File "./ensure_dependencies.py", line 105, in ignore
    _ensure_line_exists(exclude_file, module)
  File "./ensure_dependencies.py", line 275, in _ensure_line_exists
    with open(path, 'a+') as f:
IOError: [Errno 20] Not a directory: './.git/info/exclude'

Expected behaviour

Dependencies for libadblockplus-android are fetched correctly.

What to change

Git submodules don't have their own .git/info/exclude file, ensure_dependencies.py should modify the file for the parent directory instead.

Change History (6)

comment:1 Changed 3 years ago by asmirnov

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 3 years ago by fhd

  • Cc sebastian added

comment:3 Changed 3 years ago by sebastian

  • Cc trev kvas added
  • Priority changed from Unknown to P4

comment:4 Changed 3 years ago by trev

  • Component changed from Libadblockplus-Android to Build-and-Release-Tools
  • Description modified (diff)
  • Ready unset

ensure_dependencies.py is part of our buildtools repository, so the correct component is Build-and-Release-Tools. I've also modified the description to make it more clear - initially I misunderstood what is being proposed here.

comment:5 Changed 3 years ago by sebastian

  • Ready set

comment:6 Changed 3 years ago by asmirnov

  • Review URL(s) modified (diff)
Note: See TracTickets for help on using tickets.