Skip to content

Commit

Permalink
fix todo
Browse files Browse the repository at this point in the history
  • Loading branch information
bufdev committed Feb 12, 2024
1 parent d798b26 commit d929544
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 42 deletions.
46 changes: 32 additions & 14 deletions private/buf/bufworkspace/testdata/basic/scripts/fakebuflock.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,49 @@ set -euo pipefail
DIR="$(CDPATH= cd "$(dirname "${0}")/.." && pwd)"
cd "${DIR}"

DATE_DIGEST="$(buf-digest bsr/buf.testing/acme/date bsr/buf.testing/acme/extension | grep date | cut -f 2 -d ' ')"
EXTENSION_DIGEST="$(buf-digest bsr/buf.testing/acme/date bsr/buf.testing/acme/extension | grep extension | cut -f 2 -d ' ')"
DATE_COMMIT_ID="ffded0b4-cf6b-47ca-b74d-a08d291a3c2f"
EXTENSION_COMMIT_ID="b8488077-ea6d-4f6d-9562-a337b98259c8"
B4_DATE_DIGEST="$(buf-digest --digest-type shake256 bsr/buf.testing/acme/date bsr/buf.testing/acme/extension | grep date | cut -f 2 -d ' ')"
B4_EXTENSION_DIGEST="$(buf-digest --digest-type shake256 bsr/buf.testing/acme/date bsr/buf.testing/acme/extension | grep extension | cut -f 2 -d ' ')"
B4_DATE_COMMIT_ID="ffded0b4cf6b47cab74da08d291a3c2f"
B4_EXTENSION_COMMIT_ID="b8488077ea6d4f6d9562a337b98259c8"

B5_DATE_DIGEST="$(buf-digest --digest-type b5 bsr/buf.testing/acme/date bsr/buf.testing/acme/extension | grep date | cut -f 2 -d ' ')"
B5_EXTENSION_DIGEST="$(buf-digest --digest-type b5 bsr/buf.testing/acme/date bsr/buf.testing/acme/extension | grep extension | cut -f 2 -d ' ')"
B5_DATE_COMMIT_ID="ffded0b4-cf6b-47ca-b74d-a08d291a3c2f"
B5_EXTENSION_COMMIT_ID="b8488077-ea6d-4f6d-9562-a337b98259c8"

rm -f workspacev1/finance/bond/proto/buf.lock
cat <<EOF > workspacev1/finance/bond/proto/buf.lock
version: v2
version: v1
deps:
- name: buf.testing/acme/date
commit: ${DATE_COMMIT_ID}
digest: ${DATE_DIGEST}
- name: buf.testing/acme/extension
commit: ${EXTENSION_COMMIT_ID}
digest: ${EXTENSION_DIGEST}
- remote: buf.testing
owner: acme
repository: date
commit: ${B4_DATE_COMMIT_ID}
digest: ${B4_DATE_DIGEST}
- remote: buf.testing
owner: acme
repository: extension
commit: ${B4_EXTENSION_COMMIT_ID}
digest: ${B4_EXTENSION_DIGEST}
EOF

rm -f workspacev1/finance/portfolio/proto/buf.lock
cp workspacev1/finance/bond/proto/buf.lock workspacev1/finance/portfolio/proto/buf.lock

rm -f workspacev2/buf.lock
cp workspacev1/finance/bond/proto/buf.lock workspacev2/buf.lock
cat <<EOF > workspacev2/buf.lock
version: v2
deps:
- name: buf.testing/acme/date
commit: ${B5_DATE_COMMIT_ID}
digest: ${B5_DATE_DIGEST}
- name: buf.testing/acme/extension
commit: ${B5_EXTENSION_COMMIT_ID}
digest: ${B5_EXTENSION_DIGEST}
EOF

rm -f workspace_undeclared_dep/buf.lock
cp workspacev1/finance/bond/proto/buf.lock workspace_undeclared_dep/buf.lock
cp workspacev2/buf.lock workspace_undeclared_dep/buf.lock

rm -f workspace_unused_dep/buf.lock
cp workspacev1/finance/bond/proto/buf.lock workspace_unused_dep/buf.lock
cp workspacev2/buf.lock workspace_unused_dep/buf.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
version: v2
version: v1
deps:
- name: buf.testing/acme/date
commit: ffded0b4-cf6b-47ca-b74d-a08d291a3c2f
digest: b5:24ed4f13925cf89ea0ae0127fa28540704c7ae14750af027270221b737a1ce658f8014ca2555f6f7fcd95ea84e071d33f37f86cc36d07fe0d0963329a5ec2462
- name: buf.testing/acme/extension
commit: b8488077-ea6d-4f6d-9562-a337b98259c8
digest: b5:d2c1da8f8331c5c75b50549c79fc360394dedfb6a11f5381c4523592018964119f561088fc8aaddfc9f5773ba02692e6fd9661853450f76a3355dec62c1f57b4
- remote: buf.testing
owner: acme
repository: date
commit: ffded0b4cf6b47cab74da08d291a3c2f
digest: shake256:0d698ce17cbe2d0f4e927005e03822423747d759ba7948c53e89baa1303a9e6d090594ba8ba7bc7d83ac57bb4346426f186846dd610562663e83f095b5bf6c00
- remote: buf.testing
owner: acme
repository: extension
commit: b8488077ea6d4f6d9562a337b98259c8
digest: shake256:6892463bdaa65fd9944c39cbc8398d3154bf54c6725c1e8096d28de25ad83b0200fccc8da0d96979171b905342b9553b7d4db15cbe243a708f472e43926affc0
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
version: v2
version: v1
deps:
- name: buf.testing/acme/date
commit: ffded0b4-cf6b-47ca-b74d-a08d291a3c2f
digest: b5:24ed4f13925cf89ea0ae0127fa28540704c7ae14750af027270221b737a1ce658f8014ca2555f6f7fcd95ea84e071d33f37f86cc36d07fe0d0963329a5ec2462
- name: buf.testing/acme/extension
commit: b8488077-ea6d-4f6d-9562-a337b98259c8
digest: b5:d2c1da8f8331c5c75b50549c79fc360394dedfb6a11f5381c4523592018964119f561088fc8aaddfc9f5773ba02692e6fd9661853450f76a3355dec62c1f57b4
- remote: buf.testing
owner: acme
repository: date
commit: ffded0b4cf6b47cab74da08d291a3c2f
digest: shake256:0d698ce17cbe2d0f4e927005e03822423747d759ba7948c53e89baa1303a9e6d090594ba8ba7bc7d83ac57bb4346426f186846dd610562663e83f095b5bf6c00
- remote: buf.testing
owner: acme
repository: extension
commit: b8488077ea6d4f6d9562a337b98259c8
digest: shake256:6892463bdaa65fd9944c39cbc8398d3154bf54c6725c1e8096d28de25ad83b0200fccc8da0d96979171b905342b9553b7d4db15cbe243a708f472e43926affc0
3 changes: 1 addition & 2 deletions private/buf/bufworkspace/workspace_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ func (w *workspaceProvider) getWorkspaceForBucketAndModuleDirPathsV1Beta1OrV1(
switch fileVersion := bufLockFile.FileVersion(); fileVersion {
case bufconfig.FileVersionV1Beta1, bufconfig.FileVersionV1:
case bufconfig.FileVersionV2:
// TODO: re-enable once we fix tests
//return nil, errors.New("got a v2 buf.lock file for a v1 buf.yaml")
return nil, errors.New("got a v2 buf.lock file for a v1 buf.yaml - this is not allowed, run buf mod update to update your buf.lock file")
default:
return nil, syserror.Newf("unknown FileVersion: %v", fileVersion)
}
Expand Down
6 changes: 4 additions & 2 deletions private/buf/cmd/buf/testdata/imports/failure/school/buf.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
version: v1
name: bufbuild.test/bufbot/school
version: v2
modules:
- name: bufbuild.test/bufbot/school
directory: .
deps:
- bufbuild.test/bufbot/students
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
version: v1
name: bufbuild.test/bufbot/students
version: v2
modules:
- name: bufbuild.test/bufbot/students
directory: .
deps:
- bufbuild.test/bufbot/people
6 changes: 4 additions & 2 deletions private/buf/cmd/buf/testdata/imports/success/school/buf.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
version: v1
name: bufbuild.test/bufbot/school
version: v2
modules:
- name: bufbuild.test/bufbot/school
directory: .
deps:
- bufbuild.test/bufbot/students
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
version: v1
name: bufbuild.test/bufbot/students
version: v2
modules:
- name: bufbuild.test/bufbot/students
directory: .
deps:
- bufbuild.test/bufbot/people
10 changes: 6 additions & 4 deletions private/buf/cmd/buf/testdata/workspace/success/lock/a/buf.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Generated by buf. DO NOT EDIT.
version: v2
version: v1
deps:
- name: bufbuild.test/workspace/second
commit: 69f147a9-d686-496d-bbfc-dd30ffda9d20
digest: b5:a2db383c1a54738e12966b87af5a65d054cfe0da14da3aba40447e65f884d6667cfcc1078fd321d1b36e9436f58846d97de5a8e2481c1b4fae5cea179de29ac7
- remote: bufbuild.test
owner: workspace
repository: second
commit: 69f147a9d686496dbbfcdd30ffda9d20
digest: shake256:7f424416ce379930da892e3fe4903b1ef1bb174a805cea0b7e4bbf91ac222277a0ee2e83b0f7886ccd8e03cd619f96bea7fe350966bea25d848eb82298cba752

0 comments on commit d929544

Please sign in to comment.