--subdir="$(SUBDIR)" \
--source="$(FILE)" \
--hash="$(MIRROR_HASH)" \
+ --submodules $(SUBMODULES) \
|| ( $(call DownloadMethod/rawgit) ); \
)
endef
[ \! -d $(SUBDIR) ] && \
git clone $(OPTS) $(URL) $(SUBDIR) && \
(cd $(SUBDIR) && git checkout $(VERSION) && \
- git submodule update --init --recursive) && \
+ $(if $(filter skip,$(SUBMODULES)),true,git submodule update --init --recursive -- $(SUBMODULES))) && \
echo "Packing checkout..." && \
export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
rm -rf $(SUBDIR)/.git && \
MIRROR_MD5SUM:=x
VERSION:=
OPTS:=
+ SUBMODULES:=
endef
define Download/default
URL_FILE:=$(PKG_SOURCE_URL_FILE)
SUBDIR:=$(PKG_SOURCE_SUBDIR)
PROTO:=$(PKG_SOURCE_PROTO)
+ SUBMODULES:=$(PKG_SOURCE_SUBMODULES)
$(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))
$(if $(PKG_MIRROR_MD5SUM),MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM))
$(if $(PKG_MIRROR_HASH),MIRROR_HASH:=$(PKG_MIRROR_HASH))
self.version = args.version
self.subdir = args.subdir
self.source = args.source
+ self.submodules = args.submodules
self.url = args.url
self._init_owner_repo()
self.xhash = args.hash
def download(self):
"""Download and repack GitHub archive tarball."""
+ if self.submodules and self.submodules != ['skip']:
+ raise self._error('Fetching submodules is not yet supported')
self._init_commit_ts()
with Path(TMPDIR_DL, keep=True) as dir_dl:
# fetch tarball from GitHub
dir0 = os.path.join(dir_untar.path, tarball_prefix)
dir1 = os.path.join(dir_untar.path, self.subdir)
# submodules check
- if self._has_submodule(dir0):
+ if self.submodules != ['skip'] and self._has_submodule(dir0):
raise self._error('Fetching submodules is not yet supported')
# rename subdir
os.rename(dir0, dir1)
parser.add_argument('--version', help='Source code version')
parser.add_argument('--source', help='Source tarball filename')
parser.add_argument('--hash', help='Source tarball\'s expected sha256sum')
+ parser.add_argument('--submodules', nargs='*', help='List of submodules, or "skip"')
args = parser.parse_args()
try:
method = DownloadGitHubTarball(args)