Skip to content

Commit 1d39c48

Browse files
committed
deps: remove go-libedit
The libedit-based editor was deprecated in 23.1. We can remove it in 23.2. This simplifies the build system. Release note: None
1 parent aacba20 commit 1d39c48

14 files changed

+5
-374
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
[submodule "c-deps/krb5"]
55
path = c-deps/krb5
66
url = https://github.com/cockroachdb/krb5.git
7-
[submodule "c-deps/libedit"]
8-
path = c-deps/libedit
9-
url = https://github.com/cockroachdb/libedit.git
107
[submodule "c-deps/geos"]
118
path = c-deps/geos
129
url = https://github.com/cockroachdb/geos.git

DEPS.bzl

-10
Original file line numberDiff line numberDiff line change
@@ -5459,16 +5459,6 @@ def go_deps():
54595459
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/knz/catwalk/com_github_knz_catwalk-v0.1.4.zip",
54605460
],
54615461
)
5462-
go_repository(
5463-
name = "com_github_knz_go_libedit",
5464-
build_file_proto_mode = "disable_global",
5465-
importpath = "github.com/knz/go-libedit",
5466-
sha256 = "de5a038a75f45e5c4d19321d39b85b7007b73eb77f9ec3fcca16798236fb081f",
5467-
strip_prefix = "github.com/knz/[email protected]",
5468-
urls = [
5469-
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/knz/go-libedit/com_github_knz_go_libedit-v1.10.2-0.20230621133438-5f2b2e7387c5.zip",
5470-
],
5471-
)
54725462
go_repository(
54735463
name = "com_github_knz_lipgloss_convert",
54745464
build_file_proto_mode = "disable_global",

Makefile

+4-36
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ C_DEPS_DIR := $(abspath c-deps)
464464
JEMALLOC_SRC_DIR := $(C_DEPS_DIR)/jemalloc
465465
GEOS_SRC_DIR := $(C_DEPS_DIR)/geos
466466
PROJ_SRC_DIR := $(C_DEPS_DIR)/proj
467-
LIBEDIT_SRC_DIR := $(C_DEPS_DIR)/libedit
468467
KRB5_SRC_DIR := $(C_DEPS_DIR)/krb5
469468

470469
# Derived build variants.
@@ -484,11 +483,9 @@ endif
484483
JEMALLOC_DIR := $(BUILD_DIR)/jemalloc
485484
GEOS_DIR := $(BUILD_DIR)/geos
486485
PROJ_DIR := $(BUILD_DIR)/proj
487-
LIBEDIT_DIR := $(BUILD_DIR)/libedit
488486
KRB5_DIR := $(BUILD_DIR)/krb5
489487

490488
LIBJEMALLOC := $(JEMALLOC_DIR)/lib/libjemalloc.a
491-
LIBEDIT := $(LIBEDIT_DIR)/src/.libs/libedit.a
492489
LIBPROJ := $(PROJ_DIR)/lib/libproj$(if $(target-is-windows),_4_9).a
493490
LIBKRB5 := $(KRB5_DIR)/lib/libgssapi_krb5.a
494491

@@ -505,7 +502,6 @@ LIBGEOS := $(DYN_LIB_DIR)/libgeos.$(DYN_EXT)
505502

506503
C_LIBS_COMMON = \
507504
$(if $(use-stdmalloc),,$(LIBJEMALLOC)) \
508-
$(if $(target-is-windows),,$(LIBEDIT)) \
509505
$(LIBPROJ)
510506
C_LIBS_SHORT = $(C_LIBS_COMMON)
511507
C_LIBS_OSS = $(C_LIBS_COMMON)
@@ -551,13 +547,11 @@ CGO_PKGS := \
551547
pkg/cli/clisqlshell \
552548
pkg/server/status \
553549
pkg/ccl/gssapiccl \
554-
pkg/geo/geoproj \
555-
vendor/github.com/knz/go-libedit/unix
556-
vendor/github.com/knz/go-libedit/unix-package := libedit_unix
550+
pkg/geo/geoproj
557551
CGO_UNSUFFIXED_FLAGS_FILES := $(addprefix ./,$(addsuffix /zcgo_flags.go,$(CGO_PKGS)))
558552
CGO_SUFFIXED_FLAGS_FILES := $(addprefix ./,$(addsuffix /zcgo_flags_$(native-tag).go,$(CGO_PKGS)))
559553
BASE_CGO_FLAGS_FILES := $(CGO_UNSUFFIXED_FLAGS_FILES) $(CGO_SUFFIXED_FLAGS_FILES)
560-
CGO_FLAGS_FILES := $(BASE_CGO_FLAGS_FILES) vendor/github.com/knz/go-libedit/unix/zcgo_flags_extra.go
554+
CGO_FLAGS_FILES := $(BASE_CGO_FLAGS_FILES)
561555

562556
$(BASE_CGO_FLAGS_FILES): Makefile build/defs.mk.sig | bin/.submodules-initialized vendor/modules.txt
563557
@echo "regenerating $@"
@@ -569,17 +563,7 @@ $(BASE_CGO_FLAGS_FILES): Makefile build/defs.mk.sig | bin/.submodules-initialize
569563
@echo 'package $(if $($(@D)-package),$($(@D)-package),$(notdir $(@D)))' >> $@
570564
@echo >> $@
571565
@echo '// #cgo CPPFLAGS: $(addprefix -I,$(JEMALLOC_DIR)/include $(KRB_CPPFLAGS))' >> $@
572-
@echo '// #cgo LDFLAGS: $(addprefix -L,$(JEMALLOC_DIR)/lib $(LIBEDIT_DIR)/src/.libs $(KRB_DIR) $(PROJ_DIR)/lib)' >> $@
573-
@echo 'import "C"' >> $@
574-
575-
vendor/github.com/knz/go-libedit/unix/zcgo_flags_extra.go: Makefile | bin/.submodules-initialized vendor/modules.txt
576-
@echo "regenerating $@"
577-
@echo '// GENERATED FILE DO NOT EDIT' > $@
578-
@echo >> $@
579-
@echo 'package $($(@D)-package)' >> $@
580-
@echo >> $@
581-
@echo '// #cgo CPPFLAGS: -DGO_LIBEDIT_NO_BUILD' >> $@
582-
@echo '// #cgo !windows LDFLAGS: -ledit -lncurses' >> $@
566+
@echo '// #cgo LDFLAGS: $(addprefix -L,$(JEMALLOC_DIR)/lib $(KRB_DIR) $(PROJ_DIR)/lib)' >> $@
583567
@echo 'import "C"' >> $@
584568

585569
# BUILD ARTIFACT CACHING
@@ -650,18 +634,6 @@ $(PROJ_DIR)/Makefile: $(C_DEPS_DIR)/proj-rebuild | bin/.submodules-initialized
650634
mkdir -p $(PROJ_DIR)
651635
cd $(PROJ_DIR) && cmake $(xcmake-flags) $(PROJ_SRC_DIR) -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBPROJ_SHARED=OFF
652636

653-
$(LIBEDIT_SRC_DIR)/configure.ac: | bin/.submodules-initialized
654-
655-
$(LIBEDIT_SRC_DIR)/configure: $(LIBEDIT_SRC_DIR)/configure.ac
656-
cd $(LIBEDIT_SRC_DIR) && autoconf
657-
658-
$(LIBEDIT_DIR)/Makefile: $(C_DEPS_DIR)/libedit-rebuild $(LIBEDIT_SRC_DIR)/configure
659-
rm -rf $(LIBEDIT_DIR)
660-
mkdir -p $(LIBEDIT_DIR)
661-
@# NOTE: If you change the configure flags below, bump the version in
662-
@# $(C_DEPS_DIR)/libedit-rebuild. See above for rationale.
663-
cd $(LIBEDIT_DIR) && $(LIBEDIT_SRC_DIR)/configure $(xconfigure-flags) --disable-examples --disable-shared
664-
665637
# Most of our C and C++ dependencies use Makefiles that are generated by CMake,
666638
# which are rather slow, taking upwards of 500ms to determine that nothing has
667639
# changed. The no-op case is the common case, as C and C++ code is modified
@@ -734,15 +706,11 @@ libgeos_inner: $(GEOS_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
734706
$(LIBPROJ): $(PROJ_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
735707
@uptodate $@ $(PROJ_SRC_DIR) || $(MAKE) --no-print-directory -C $(PROJ_DIR) proj
736708

737-
$(LIBEDIT): $(LIBEDIT_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
738-
@uptodate $@ $(LIBEDIT_SRC_DIR) || $(MAKE) --no-print-directory -C $(LIBEDIT_DIR)/src
739-
740709
$(LIBKRB5): $(KRB5_DIR)/Makefile bin/uptodate .ALWAYS_REBUILD
741710
@uptodate $@ $(KRB5_SRC_DIR)/src || $(MAKE) --no-print-directory -C $(KRB5_DIR)
742711

743712
# Convenient names for maintainers. Not used by other targets in the Makefile.
744713
.PHONY: libjemalloc libgeos libproj libkrb5
745-
libedit: $(LIBEDIT)
746714
libjemalloc: $(LIBJEMALLOC)
747715
libgeos: $(LIBGEOS)
748716
libproj: $(LIBPROJ)
@@ -961,7 +929,7 @@ $(COCKROACHSHORT): TAGS += short
961929
$(COCKROACHSHORT): $(C_LIBS_SHORT) | $(C_LIBS_DYNAMIC)
962930

963931
$(COCKROACHSQL): BUILDTARGET = ./pkg/cmd/cockroach-sql
964-
$(COCKROACHSQL): $(if $(target-is-windows),,$(LIBEDIT))
932+
$(COCKROACHSQL):
965933

966934
# For test targets, add a tag (used to enable extra assertions).
967935
$(test-targets): TAGS += crdb_test

build/bazelutil/distdir_files.bzl

-1
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ DISTDIR_FILES = {
697697
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/klauspost/pgzip/com_github_klauspost_pgzip-v1.2.5.zip": "1143b6417d4bb46d26dc8e6223407b84b6cd5f32e5d705cd4a9fb142220ce4ba",
698698
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/knz/bubbline/com_github_knz_bubbline-v0.0.0-20230422210153-e176cdfe1c43.zip": "b9699be473d5dc3c1254f0e9a26f77a06cc0455135b72c2b82d85146bcfe5863",
699699
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/knz/catwalk/com_github_knz_catwalk-v0.1.4.zip": "f422f7974090494e54226262586c7b34fe57b33ab7d668151ca55eba8e309c1e",
700-
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/knz/go-libedit/com_github_knz_go_libedit-v1.10.2-0.20230621133438-5f2b2e7387c5.zip": "de5a038a75f45e5c4d19321d39b85b7007b73eb77f9ec3fcca16798236fb081f",
701700
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/knz/lipgloss-convert/com_github_knz_lipgloss_convert-v0.1.0.zip": "f9f9ffa12e7df4007cc60c87327d47ad42d1f71a80e360af4014674138de8bef",
702701
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/knz/strtime/com_github_knz_strtime-v0.0.0-20200318182718-be999391ffa9.zip": "c1e1b06c339798387413af1444f06f31a483d4f5278ab3a91b6cd5d7cd8d91a1",
703702
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/konsorten/go-windows-terminal-sequences/com_github_konsorten_go_windows_terminal_sequences-v1.0.3.zip": "429b01413b972b108ea86bbde3d5e660913f3e8099190d07ccfb2f186bc6d837",

build/variables.mk

-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ define VALID_VARS
9090
KRB_DIR
9191
LC_ALL
9292
LDFLAGS
93-
LIBEDIT
94-
LIBEDIT_DIR
95-
LIBEDIT_SRC_DIR
9693
LIBGEOS
9794
LIBJEMALLOC
9895
LIBPROJ

c-deps/libedit

-1
This file was deleted.

c-deps/libedit-rebuild

-4
This file was deleted.

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ require (
167167
github.com/klauspost/compress v1.15.15
168168
github.com/klauspost/pgzip v1.2.5
169169
github.com/knz/bubbline v0.0.0-20230422210153-e176cdfe1c43
170-
github.com/knz/go-libedit v1.10.2-0.20230621133438-5f2b2e7387c5
171170
github.com/knz/strtime v0.0.0-20200318182718-be999391ffa9
172171
github.com/kr/pretty v0.3.1
173172
github.com/kr/text v0.2.0

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -1524,8 +1524,6 @@ github.com/knz/bubbline v0.0.0-20230422210153-e176cdfe1c43 h1:uhwfuoL9LDMUGlxcs3
15241524
github.com/knz/bubbline v0.0.0-20230422210153-e176cdfe1c43/go.mod h1:ucXvyrucVy4jp/4afdKWNW1TVO73GMI72VNINzyT678=
15251525
github.com/knz/catwalk v0.1.4 h1:GgCxHbPp+nzyZBJcNL/CJd1aba4ACoeuI1lnsshAPkY=
15261526
github.com/knz/catwalk v0.1.4/go.mod h1:Q+Yj4ny4AXgrOOyWyDGY/HJzmbGH8MFnsUqvCAiUT5s=
1527-
github.com/knz/go-libedit v1.10.2-0.20230621133438-5f2b2e7387c5 h1:62iTw+D4JtoXL7yp4S5Ruyc82qmbWdnwuuSZ3tmcuSw=
1528-
github.com/knz/go-libedit v1.10.2-0.20230621133438-5f2b2e7387c5/go.mod h1:dmDChGdWopkB61HsdDN0/fxKAMIYljKTu+AG9uc4qVY=
15291527
github.com/knz/lipgloss-convert v0.1.0 h1:qUPUt6r8mqvi9DIV3nBPu3kEmFyHrZtXzv0BlPBPLNQ=
15301528
github.com/knz/lipgloss-convert v0.1.0/go.mod h1:S14GmtoiW/VAHqB7xEzuZOt0/G6GQ2dfjJN0fHpm30Q=
15311529
github.com/knz/strtime v0.0.0-20200318182718-be999391ffa9 h1:GQE1iatYDRrIidq4Zf/9ZzKWyrTk2sXOYc1JADbkAjQ=

pkg/acceptance/generated_cli_test.go

-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cli/clisqlshell/BUILD.bazel

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ go_library(
1212
"editor_bimodal.go",
1313
"editor_bubbline.go",
1414
"editor_bufio.go",
15-
"editor_editline.go",
1615
"parser.go",
1716
"scan_local_cmd.go",
1817
"sql.go",
@@ -46,7 +45,6 @@ go_library(
4645
"@com_github_knz_bubbline//computil",
4746
"@com_github_knz_bubbline//editline",
4847
"@com_github_knz_bubbline//history",
49-
"@com_github_knz_go_libedit//:go-libedit",
5048
],
5149
)
5250

pkg/cli/clisqlshell/editor.go

+1-10
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010

1111
package clisqlshell
1212

13-
import (
14-
"os"
15-
16-
"github.com/cockroachdb/cockroach/pkg/util/envutil"
17-
)
13+
import "os"
1814

1915
// editor is the interface between the shell and a line editor.
2016
type editor interface {
@@ -44,13 +40,8 @@ func getEditor(useEditor bool, displayPrompt bool) editor {
4440
if !useEditor {
4541
return &bufioReader{displayPrompt: displayPrompt}
4642
}
47-
if useLibEdit {
48-
return &editlineReader{}
49-
}
5043
return &bimodalEditor{
5144
main: &bubblineReader{},
5245
copy: &bufioReader{displayPrompt: displayPrompt},
5346
}
5447
}
55-
56-
var useLibEdit = envutil.EnvOrDefaultBool("COCKROACH_SQL_FORCE_LIBEDIT", false)

pkg/cli/clisqlshell/editor_editline.go

-163
This file was deleted.

0 commit comments

Comments
 (0)