mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-10 05:22:59 +03:00
fbcode_builder: getdeps: add fetch subcommand
Summary: Adds a command that can be used to trigger a fetch for a project ``` $ ./opensource/fbcode_builder/getdeps.py fetch zstd Cloning https://github.com/facebook/zstd.git... --- + git clone --depth=100 https://github.com/facebook/zstd.git /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/repos/github.com-facebook-zstd.git Cloning into '/data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/repos/github.com-facebook-zstd.git'... remote: Enumerating objects: 3816, done. remote: Counting objects: 100% (3816/3816), done. remote: Compressing objects: 100% (1415/1415), done. remote: Total 3816 (delta 2556), reused 3312 (delta 2288), pack-reused 0 Receiving objects: 100% (3816/3816), 2.93 MiB | 9.59 MiB/s, done. Resolving deltas: 100% (2556/2556), done. Updating /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/repos/github.com-facebook-zstd.git -> v1.3.8 --- + git -C /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/repos/github.com-facebook-zstd.git fetch origin v1.3.8 From https://github.com/facebook/zstd * tag v1.3.8 -> FETCH_HEAD --- + git -C /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/repos/github.com-facebook-zstd.git checkout FETCH_HEAD Note: checking out 'FETCH_HEAD'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new-branch-name> HEAD is now at 470344d Merge pull request #1479 from facebook/visualTest --- + git -C /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/repos/github.com-facebook-zstd.git submodule update --init ``` Reviewed By: simpkins Differential Revision: D14691008 fbshipit-source-id: 3afa391360518a08ebd6ff97f5b8b4993f10c4e8
This commit is contained in:
committed by
Facebook Github Bot
parent
10b8a8191c
commit
1c49eff9ca
@@ -14,6 +14,8 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from getdeps.buildopts import setup_build_options
|
||||||
|
from getdeps.load import resolve_manifest_path
|
||||||
from getdeps.manifest import ManifestParser
|
from getdeps.manifest import ManifestParser
|
||||||
from getdeps.platform import HostType
|
from getdeps.platform import HostType
|
||||||
from getdeps.subcmd import SubCmd, add_subcommands, cmd
|
from getdeps.subcmd import SubCmd, add_subcommands, cmd
|
||||||
@@ -45,6 +47,25 @@ class ShowHostType(SubCmd):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
@cmd("fetch", "fetch the code for a given project")
|
||||||
|
class FetchCmd(SubCmd):
|
||||||
|
def setup_parser(self, parser):
|
||||||
|
parser.add_argument(
|
||||||
|
"project",
|
||||||
|
help=(
|
||||||
|
"name of the project or path to a manifest "
|
||||||
|
"file describing the project"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
def run(self, args):
|
||||||
|
opts = setup_build_options(args)
|
||||||
|
manifest_path = resolve_manifest_path(opts, args.project)
|
||||||
|
manifest = ManifestParser(manifest_path)
|
||||||
|
fetcher = manifest.create_fetcher(opts, ctx={})
|
||||||
|
fetcher.update()
|
||||||
|
|
||||||
|
|
||||||
def build_argparser():
|
def build_argparser():
|
||||||
common_args = argparse.ArgumentParser(add_help=False)
|
common_args = argparse.ArgumentParser(add_help=False)
|
||||||
common_args.add_argument(
|
common_args.add_argument(
|
||||||
|
19
build/fbcode_builder/getdeps/load.py
Normal file
19
build/fbcode_builder/getdeps/load.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Copyright (c) 2019-present, Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD-style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_manifest_path(build_opts, project_name):
|
||||||
|
if "/" in project_name or "\\" in project_name:
|
||||||
|
# Assume this is a path already
|
||||||
|
return project_name
|
||||||
|
|
||||||
|
# Otherwise, resolve it relative to the manifests dir
|
||||||
|
return os.path.join(build_opts.fbcode_builder_dir, "manifests", project_name)
|
Reference in New Issue
Block a user