Commit Graph

2162 Commits

Author SHA1 Message Date
Wez Furlong
b936bf4243 fbcode_builder: getdeps: add list-deps subcommand
Summary:
While the command isn't necessarily super useful
on its own, it does show that the plumbing for walking the
deps is functioning, and that is important when it comes
to building.

The output lists the projects in the order that they
would be built.

The `fetch` command has been augmented to add a `--recursive`
flag that uses the same mechanism to recursively fetch
the dependencies.

Reviewed By: simpkins

Differential Revision: D14691004

fbshipit-source-id: b00bf6ad4742f8bb0a70698f71a5fe03d6a1f453
2019-05-03 15:59:40 -07:00
Wez Furlong
955804d469 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
2019-05-03 15:59:40 -07:00
Wez Furlong
749d6a25ca fbcode_builder: getdeps: add SimpleShipitTransformer fetcher
Summary:
This fetcher knows how to transform a 1st party project
from fbsource into approximately the same shape as ShipIt produces
for the github repo mirrors.  It does this by reading shipit
mapping information from the manifest file for the project.

Since this fetcher uses data in the manifest and is implemented
directly in the getdeps codebase, it is suitable for iterating
on the opensource builds directly out of fbsource on both devservers
and laptops inside FB.

Reviewed By: simpkins

Differential Revision: D14691012

fbshipit-source-id: 05f68a7be64a2e465937b24b8825d25d3348ed13
2019-05-03 15:59:40 -07:00
Wez Furlong
1487071305 fbcode_builder: getdeps: add ShipitTransformer fetcher
Summary:
This fetcher knows how to take a 1st party FB project
from fbsource and transform it to the same shape as our github
repos using ShipIt.  The transformation creates a transformed
mirror of the code in scratch space (rather than mutating fbsource
directly).

This can only be used in environments where shipit is available.
A later diff implements an alternative that works in more environments.

Reviewed By: simpkins

Differential Revision: D14691013

fbshipit-source-id: 539e307755c9fc0a098a235868ab622652061494
2019-05-03 15:59:39 -07:00
Wez Furlong
fbacd6695b fbcode_builder: getdeps: add ArchiveFetcher
Summary:
this fetcher knows how to download a URL that references
an archive and extract the sources from it.  Compressed tarballs
and zipfiles are supported.

Reviewed By: simpkins

Differential Revision: D14690994

fbshipit-source-id: ffbbd1d9479b0d5aa3e5cd13fe11a560e9d01c2a
2019-05-03 15:59:39 -07:00
Wez Furlong
56639c769f fbcode_builder: getdeps: add GitFetcher
Summary: this fetcher knows how to check out sources via git.

Reviewed By: simpkins

Differential Revision: D14691000

fbshipit-source-id: 60f1ffbfed7b32a019aef6aa70ae0903f2782451
2019-05-03 15:59:39 -07:00
Wez Furlong
681e3b5278 fbcode_builder: getdeps: define the Fetcher interface
Summary:
Fetchers are used to fetch a source directory from a
source defined in a manifest file.

More details can be found in comments on the various methods.

The Manifest class offers a create_fetcher method for constructing
an appropriate fetcher.  This is just a stub in this commit, but
will expand over the course of the next few diffs as concrete
fetcher instances are added.

Reviewed By: simpkins

Differential Revision: D14691001

fbshipit-source-id: 8c9038eacae3345e9403d5d1304bf979a9ee1555
2019-05-03 15:59:39 -07:00
Wez Furlong
76276d4921 fbcode_builder: getdeps: add build options
Summary:
The build options class contains some environmental and
build related information that will be passed down to fetcher
and builder objects that will be introduced in later diffs.

Reviewed By: simpkins

Differential Revision: D14691007

fbshipit-source-id: e8fe7322f590667ac28a5a3925a072056df0b3e3
2019-05-03 15:59:38 -07:00
Wez Furlong
ac0e9c91c6 fbcode_builder: getdeps: add platform type tuple helper
Summary:
This will feed into the manifest context for system
dependent manifest sections.  This is essentially the same
code borrowed from the watchman and eden getdeps.py.

Reviewed By: simpkins

Differential Revision: D14690997

fbshipit-source-id: 3d3ae146237a2cd49609aaa2bd0e785ebe21f02c
2019-05-03 15:59:38 -07:00
Wez Furlong
192a4108a6 fbcode_builder: getdeps: add copytree helper
Summary:
this module adds some functions that help with copying
directory trees.  The copytree function is aware of eden and will
issue a prefetch prior to walking the directory.

Reviewed By: simpkins

Differential Revision: D14691006

fbshipit-source-id: 079bf850756f61aca17978453d07bc73b2f91788
2019-05-03 15:59:38 -07:00
Wez Furlong
3d0d9e6d53 fbcode_builder: getdeps: add run_cmd() function
Summary:
This runs a command, raising an exception if it exits with a non-zero error status.

It prints out the arguments in a mostly copy-and-pasteable form, with PATH-like
env vars pretty printed to make it easier to see what is being invoked; here's
an example of how cmake is being invoked later in this stack:

```
 ---
+ CMAKE_PREFIX_PATH=\
+      /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/installed/ninja-5d7ec7:\
+      /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/installed/cmake-91dc9a:\
+ PKG_CONFIG_PATH=\
+      /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/installed/ninja-5d7ec7/lib/pkgconfig:\
+      /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/installed/cmake-91dc9a/lib/pkgconfig:\
+ cd /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/build/zstd-470344 && \
+ cmake configure /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/repos/github.com-facebook-zstd.git/build/cmake -DCMAKE_INST
ALL_PREFIX=/data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/installed/zstd-470344 -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=R
elWithDebInfo -G Ninja
```

Reviewed By: simpkins

Differential Revision: D14690999

fbshipit-source-id: cdb0c681c7dfdfdc6e8c96bf4830bfbcf666411b
2019-05-03 15:59:38 -07:00
Wez Furlong
0bc46905d0 fbcode_builder: add getdeps main entrypoint
Summary:
This is the new getdeps entrypoint.  It lives in `opensource/fbcode_builder` so that
it is synced into the various opensource projects at FB.

In the incarnation in this diff is has a single subcommand that can be used to validate
a manifest file.

Reviewed By: sinancepel

Differential Revision: D14690995

fbshipit-source-id: 53f8ec9bafb7b1930970079e3ce20f496ac1c188
2019-05-03 15:59:37 -07:00
Wez Furlong
4b50455edb fbcode_builder: getdeps: add envfuncs.py
Summary:
Add some helpers for manipulating environment variables
that will hold either compiler flags or paths.

These are used in later diffs when setting up arguments/environment
for eg: cmake.

Reviewed By: sinancepel, simpkins

Differential Revision: D14690993

fbshipit-source-id: 7f9753cd99d968550fe9e3ba8b7017a44683061e
2019-05-03 15:59:37 -07:00
Wez Furlong
5ec4990bc8 fbcode_builder: add manifest files for some dependencies
Summary:
These are ported over from the logic in the watchman and eden getdeps
scripts, with additions to help bootstrap a build environment.

These are sufficient to build watchman with thrift support on windows, mac and
linux, and eden on mac and linux when combined with the getdeps code that
follows in later diffs in this stack.

Reviewed By: simpkins

Differential Revision: D14691005

fbshipit-source-id: 7f8b02fedcdc020e2d0e758c466959d8161d4587
2019-05-03 15:59:37 -07:00
Wez Furlong
f272c533f3 fbcode_builder: add manifest file parser
Summary:
Adds a parser for manifest files that describe projects
that may be either 1st party or 3rd party.

A selection of manifest files appears in a later diff in this stack.

This diff provides the raw parser and a couple of low level helpers.
It also defines a mechanism for validating the schema to help catch
structural (rather than semantic) issues with manifest file contents.

Later diffs in the stack add helpers for accessing the data in
a higher level way.

Reviewed By: sinancepel

Differential Revision: D14691003

fbshipit-source-id: 7d2930a3359ede0f6e21fdc45686b083ab7a9ffa
2019-05-03 15:59:37 -07:00
Wez Furlong
04281b1122 fbcode_builder: getdeps: add boolean expression parser
Summary:
As part of folding getdeps into fbcode_builder, this
expression parser is needed to allow constrained and deterministic
conditionals in the manifest file format.

For example, the watchman manifest will use this cargo-inspired syntax
for system dependent sections:

```
[dependencies]
folly

[dependencies.not(os=windows)]
thrift
```

Reviewed By: sinancepel

Differential Revision: D14691014

fbshipit-source-id: 080bcdb20579da40d225799f5f22debe65708b03
2019-05-03 15:59:37 -07:00
svcscm
0625ec48dc Updating submodules
Reviewed By: yns88

fbshipit-source-id: 345b0ecaa54caf0c4e07824749d884f9a024c57e
2019-05-02 21:48:57 -07:00
Adam Simpkins
f497a29d04 stop calling hg debugedenimporthelper with an extra repo argument
Summary:
This argument is unnecessary since D14222323, which should be deployed
everywhere by now.  Passing in the extra repo argument forces hg to open the
repository object twice, which is unnecessary.

We already set the current working directory to the repository when invoking
the import helper, so hg will find the repository correctly from that.

Reviewed By: pkaush

Differential Revision: D15179667

fbshipit-source-id: 838cbee91748c41c713731187608a9823b971a53
2019-05-02 20:42:35 -07:00
Adam Simpkins
f0b14c5139 use hg debugedenimporthelper by default
Summary:
Update HgImporter to use `hg debugedenimporthelper` instead of the separate
`hg_import_helper.py` script by default on all platforms now.  The
`debugedenimporthelper` subcommand has existed in our deployed versions of hg
for a while now.

Reviewed By: pkaush

Differential Revision: D15179668

fbshipit-source-id: 2fb8c4c9f92aed54c84899d6643f746baac73327
2019-05-02 20:42:35 -07:00
svcscm
cc9f3b92c2 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 7988b6e87f28004495c59a3a94e93204f392e36f
2019-05-02 20:42:35 -07:00
svcscm
a131c46009 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 3d32d5e564285b9d60e6c84944e89acfaac43153
2019-05-02 19:32:56 -07:00
Zeyi (Rice) Fan
9d3a6a13ee improve thrift mononoke backing store implementation
Summary:
This diff tries to improve the Thrift Mononoke backing store implementation by:

* Re-creating thrift client for every request since thrift has builtin connection pooling
* Using Eden's CPU thread pool for processing data fetched from remote
* Calling thrift methods within correct executor

Reviewed By: wez

Differential Revision: D15170818

fbshipit-source-id: c8be70755a851f63fb62e4d4f36833703283565e
2019-05-02 18:21:49 -07:00
svcscm
3587e4fd7d Updating submodules
Reviewed By: yns88

fbshipit-source-id: 89fcc80618a65cea87d30988a498cf50d948b5f5
2019-05-02 16:18:40 -07:00
Chad Austin
2267e75bda require treemanifest support
Summary: We intend to break support for flatmanifest hg, so require that treemanifest is available in the build.

Reviewed By: wez

Differential Revision: D15057150

fbshipit-source-id: 449399cfb9d018f3b722598091eead1bd5d7c77d
2019-05-02 12:35:21 -07:00
Chad Austin
8ec4c11d3e remove flatmanifest fallback when importing trees fails
Summary: Flatmanifest is on its way out. Remove support for falling back to it if a tree import fails.

Reviewed By: pkaush

Differential Revision: D15056459

fbshipit-source-id: a4df820322ee354d77f50a0ec92e9705d0f152ec
2019-05-02 12:35:20 -07:00
Puneet Kaushik
bfd0882aba Use the original log level instead of extended.
Summary: In the past we used different log level to get more logs. Going back to the original log level. In future, we will be able to set it from the cli.

Reviewed By: chadaustin

Differential Revision: D15159110

fbshipit-source-id: 115718ed667d9896bbd60653f586ae5665598df9
2019-05-02 09:59:40 -07:00
svcscm
4d41f562ee Updating submodules
Reviewed By: yns88

fbshipit-source-id: c3448d193e49051cc00769ad43e7a59daaa979db
2019-05-02 09:59:39 -07:00
svcscm
3d3e525821 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 79aa2ff2fc1a08bce3e34c5123cc0559902a6bf1
2019-05-01 20:31:18 -07:00
Wez Furlong
7a35cb49da eden: on macos LOCAL_PEERCRED has SOL_LOCAL level
Summary:
Interestingly, the request doesn't fail, but does leave
our stack garbage intact.   Let's be sure to zero it out to make
it more obvious what is happening.

While we're in here, let's make sure that we get the same
results from both ends of the socket pair.

Reviewed By: simpkins

Differential Revision: D14994593

fbshipit-source-id: 9aec957dfcd80d88c3d8fbce6bf45480502ea812
2019-05-01 20:09:44 -07:00
svcscm
2c29080a9b Updating submodules
Reviewed By: yns88

fbshipit-source-id: 8a8c2e064e41bcfc7eaea0e6d6413277a6db7823
2019-05-01 20:09:44 -07:00
svcscm
812b99977a Updating submodules
Reviewed By: yns88

fbshipit-source-id: d8c980be58a6f17abc38b8ea19d71d0efd8f7100
2019-05-01 17:41:32 -07:00
Wez Furlong
0077748a32 eden: move test implementation to .cpp file to avoid ODR violation
Summary: this fixes linking the tests when building with cmake in D14993344

Reviewed By: chadaustin

Differential Revision: D15167223

fbshipit-source-id: 1dda3beed3b6ff3788f3992783c58b4b92f697f2
2019-05-01 16:10:23 -07:00
Wez Furlong
ea27d85e64 eden: fix cmake build for store library
Summary:
D15043209 missed fixing up the name of the variable
containing the list of sources.

The result is that we compile the `main` from `eden_store_util`
in to the tests and break gtest discovery in D14993344

Reviewed By: chadaustin

Differential Revision: D15167219

fbshipit-source-id: 95e9dc8ba74965f41bfebed1c1776605d8c9443a
2019-05-01 16:10:23 -07:00
Wez Furlong
cccc64752c eden: add fmt to cmake deps
Summary:
Folly and thrift now require fmt, so we have to probe for it before
we probe for folly.

Reviewed By: chadaustin

Differential Revision: D15165394

fbshipit-source-id: 00d5f0cd5e9421ce0e3a4ea0de850deb4d4b5e3f
2019-05-01 16:10:23 -07:00
Joe Loser
14e791a7dc Don't clobber CXXFLAGS/CMAKE_CXX_FLAGS (#8)
Summary:
- CMake allows the user to add additional compilation options using
  `CXXFLAGS=<flags>` or `-DCMAKE_CXX_FLAGS=<flags>`.
- Eden clobbers these CMAKE_CXX_FLAGS for both debug and release modes
  which prevents the user from passing additional flags.
- Teach Eden to respect user-supplied compiler flags instead of simply
  overriding them.
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/8

Reviewed By: simpkins

Differential Revision: D14481846

Pulled By: wez

fbshipit-source-id: 4d2034ddb4f9b781dde603a140c4d199eb0ad7d6
2019-05-01 10:15:09 -07:00
svcscm
4387530823 Updating submodules
Reviewed By: yns88

fbshipit-source-id: e7090567ddcb01dbcb8b1823525938c44df4a0ce
2019-05-01 10:04:21 -07:00
Wez Furlong
01d5402485 eden: fixup sendmsg() macos portability problem in tests
Summary:
UnixSocketTest would block forever on macos if the message
size was larger than approx 1kb.  It turns out that MSG_DONTWAIT
isn't documented in the `sendmsg` man pages and apparently has
no effect at all.  Instead, the socket must be placed in non-blocking
mode.  This appears to be the case for the client side of the sockets
but I need to follow up for the server side.

Reviewed By: simpkins, strager

Differential Revision: D14994588

fbshipit-source-id: 2a0a1c26a7b45ece82f8f79c15fb7756844bc86f
2019-05-01 09:22:58 -07:00
Wez Furlong
5f656eefd0 eden: canonicalize makeTempDir results for macOS
Summary:
on macOS `/var/tmp` is a symlink to `/private/var/tmp`
which means that our tests for path canonicalization end up
trying to compare the non-canonical `/var/tmp` prefix of the
temporary paths generated by the tests with `/private/var/tmp`
and failing.

Reviewed By: simpkins

Differential Revision: D14994584

fbshipit-source-id: e69addca8e315855d3ca87feb576ca7c54567c31
2019-05-01 09:22:57 -07:00
svcscm
a0f6e720d6 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 80b839b89f04818388d339ef8e801fc065a26c2b
2019-05-01 09:22:57 -07:00
svcscm
150ac51f9a Updating submodules
Reviewed By: yns88

fbshipit-source-id: b8f638d43ab0d8ce61ca964bd2a4248540d13001
2019-04-30 18:55:23 -07:00
Puneet Kaushik
0ad7318ae3 Parallelize the code to get the file size.
Summary:
Currently we get the file size one after the other - parallelizing it.

Performance numbers:

On my quadcore laptop, there is a 70% improvement when there is a no cache and the trees need to be fetched across the network. There is no real difference when the contents are fetched from the cache.

Before:
Without both hgcache and SQLite cache
PS C:\edenrepos\fbsource25\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 356.8000769

Before:
With both hgcache and SQLite cache
PS C:\edenrepos\fbsource25\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 3.7510672

After:
Without both hgcache and SQLite cache
PS C:\edenrepos\fbsource26\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 104.3658952

After:
With both hgcache and SQLite cache
PS C:\edenrepos\fbsource26\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 3.8377893

PS C:\edenrepos\fbsource26\fbcode\scm> Measure-Command {dir -r}

TotalSeconds      : 3.7362488

Reviewed By: chadaustin

Differential Revision: D15151463

fbshipit-source-id: f771281592162471717b971d1b858c5047e886f5
2019-04-30 17:21:26 -07:00
Puneet Kaushik
18f99f1a6c Fetch the correct file size for the directory entries.
Summary: For the POC, we hardcoded file size. Fixing that now.

Reviewed By: chadaustin

Differential Revision: D14711498

fbshipit-source-id: b5c7f3652a37765f93e245e1bc0d892f0a63afb9
2019-04-30 15:20:37 -07:00
svcscm
789c6131b2 Updating submodules
Reviewed By: yns88

fbshipit-source-id: 4967478aee4a308095460545bf3dbe0f3cded657
2019-04-30 15:20:37 -07:00
svcscm
8498a633b1 Updating submodules
Reviewed By: yns88

fbshipit-source-id: d03118e363bf26c0bc437fe04c4e3d0f314b82ef
2019-04-29 19:21:48 -07:00
Matt Glazar
a50418112f Optimize TLS lookup in HgImporter
Summary:
D14677339 added tracing to all HgImporter requests. Each trace loads a thread-local variable through EdenStats::getStatsForCurrentThread(). Each of these loads has a small but non-trivial cost.

Because each instance of HgImporter is used only on one thread, each getStatsForCurrentThread() call returns the same EdenThreadStats object. Avoid the thread-local-variable lookups by caching the result of getStatsForCurrentThread() in HgImporter.

This diff should not change behavior.

Reviewed By: simpkins

Differential Revision: D14794284

fbshipit-source-id: d1609a1720d44c680dc0ebaa2536779def2a6f37
2019-04-29 19:21:48 -07:00
svcscm
c736f2adc9 Updating submodules
Reviewed By: yns88

fbshipit-source-id: a1db5d4e3d0520adcc3bb91b3a901ded46dde12d
2019-04-29 19:21:48 -07:00
Adam Simpkins
f13e0d9f83 Fix-up commit to resync shipit
Summary:
The previous commit did not update the facebookincubator/fizz-rev.txt
hash (due to running an older version of the shipit code), which is
confusing newer shipit releases that want to keep this file up-to-date.

fbshipit-source-id: 459ae013d33f3f157856320e67a8f6b16ea5e32a
2019-04-29 16:32:15 -07:00
svcscm
bdb8dea71f Updating submodules
Reviewed By: zpao

fbshipit-source-id: 459ae013d33f3f157856320e67a8f6b16ea5e32a
2019-04-26 16:53:29 -07:00
Adam Simpkins
1cdee770a5 update copyright headers in some of the common/ stub headers
Summary: Update copyright messages to match the patterns expected by our open source linters.

Reviewed By: chadaustin

Differential Revision: D15105843

fbshipit-source-id: 6c66b4e3a552f9d71e6b43f9a5e6fcda48fd00d9
2019-04-26 14:38:28 -07:00
Adam Simpkins
5976103fd6 add a copyright header to glibc_en.po
Summary:
Update this file with a copyright header to satisfy our open source lint
checks.

Reviewed By: chadaustin

Differential Revision: D15105844

fbshipit-source-id: ba2bfe0e62899a20d0fb526bc247159643e1ecab
2019-04-26 14:38:27 -07:00