Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: move most of the packages to 'pkg' #47123

Merged
merged 1 commit into from
Oct 13, 2023
Merged

Conversation

bb7133
Copy link
Member

@bb7133 bb7133 commented Sep 20, 2023

What problem does this PR solve?

Issue Number: ref #41241

Problem Summary:

What is changed and how it works?

As mentioned in #41241, this PR will move most of first-level packages to a new 'pkg' directory. However, dumpling and br are not moved since further discussions are needed.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test

    Just move files.

Side effects

  • NA

Documentation

  • [] No end-user documents update is needed, but we need to update some developer-faced documents.

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@bb7133 bb7133 added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 20, 2023
@bb7133 bb7133 requested a review from a team as a code owner September 20, 2023 06:46
@ti-chi-bot ti-chi-bot bot added release-note-none size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 20, 2023
@bb7133
Copy link
Member Author

bb7133 commented Sep 20, 2023

I used the following scripts to update all '.go' files:

#!/bin/bash
#
set -x

# Define an array called pkg_list, each element containing a tuple of source and target directories
pkg_list=(
  "autoid_service pkg/autoid_service"
  "bindinfo pkg/bindinfo"
  "config pkg/config"
  "ddl pkg/ddl"
  "distsql pkg/distsql"
  "disttask pkg/disttask"
  "domain pkg/domain"
  "errno pkg/errno"
  "executor pkg/executor"
  "extension pkg/extension"
  "expression pkg/expression"
  "infoschema pkg/infoschema"
  "keyspace pkg/keyspace"
  "kv pkg/kv"
  "lock pkg/lock"
  "metrics pkg/metrics"
  "owner pkg/owner"
  "meta pkg/meta"
  "parser pkg/parser"
  "privilege pkg/privilege"
  "planner pkg/planner"
  "plugin pkg/plugin"
  "resourcemanager pkg/resourcemanager"
  "server pkg/server"
  "session pkg/session"
  "sessionctx pkg/sessionctx"
  "sessiontxn pkg/sessiontxn"
  "statistics pkg/statistics"
  "structure pkg/structure"
  "store pkg/store"
  "table pkg/table"
  "tablecodec pkg/tablecodec"
  "telemetry pkg/telemetry"
  "testkit pkg/testkit"
  "tidb-binlog pkg/tidb-binlog"
  "util pkg/util"
  "timer pkg/timer"
  "ttl pkg/ttl"
  "types pkg/types"
  "tidb-server cmd/tidb-server"
)

mkdir -p pkg

for entry in "${pkg_list[@]}"; do
  source_dir="${entry%% *}"
  target_dir="${entry#* }"

  if [ -d "$target_dir" ]; then
    echo "Error: The target directory '$target_dir' already exists."
    exit 1
  fi

  git mv "$source_dir" "$target_dir"

  n_source="github.com/pingcap/tidb/$source_dir"
  n_target="github.com/pingcap/tidb/$target_dir"

if [[ $(uname) == "Darwin" ]]; then
  find . -type f -name "*.go" -exec sed -i '' -e "s|$n_source|$n_target|g" {} +
else
  find . -type f -name "*.go" -exec sed -i -e "s|$n_source|$n_target|g" {} +
fi
done

@lcwangchao lcwangchao mentioned this pull request Sep 21, 2023
13 tasks
@bb7133 bb7133 force-pushed the bb7133/pkg branch 8 times, most recently from bfe4b2c to 48be5a1 Compare October 10, 2023 14:59
@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Merging #47123 (15b3de1) into master (93a834a) will increase coverage by 1.1359%.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #47123        +/-   ##
================================================
+ Coverage   71.7785%   72.9145%   +1.1359%     
================================================
  Files          1353       1418        +65     
  Lines        401276     410541      +9265     
================================================
+ Hits         288030     299344     +11314     
+ Misses        93707      92369      -1338     
+ Partials      19539      18828       -711     
Flag Coverage Δ
integration 41.2415% <ø> (?)
unit 72.0212% <ø> (+0.2427%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9913% <ø> (ø)
parser ∅ <ø> (∅)
br 49.0345% <ø> (-4.3345%) ⬇️

@bb7133 bb7133 force-pushed the bb7133/pkg branch 2 times, most recently from 0e9b4f5 to 1ed882a Compare October 10, 2023 15:24
@bb7133 bb7133 changed the title (WIP) *: move most of the packages to 'pkg' *: move most of the packages to 'pkg' Oct 11, 2023
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 11, 2023
@wuhuizuo
Copy link
Contributor

I used the following scripts to update all '.go' files:

#!/bin/bash

# Define an array called pkg_list, each element containing a tuple of source and target directories
pkg_list=(
  "autoid_service pkg/autoid_service"
  "bindinfo pkg/bindinfo"
  "config pkg/config"
  "ddl pkg/ddl"
  "distsql pkg/distsql"
  "disttask pkg/disttask"
  "domain pkg/domain"
  "errno pkg/errno"
  "executor pkg/executor"
  "extension pkg/extension"
  "expression pkg/expression"
  "infoschema pkg/infoschema"
  "keyspace pkg/keyspace"
  "kv pkg/kv"
  "lock pkg/lock"
  "metrics pkg/metrics"
  "owner pkg/owner"
  "meta pkg/meta"
  "parser pkg/parser"
  "privilege pkg/privilege"
  "planner pkg/planner"
  "plugin pkg/plugin"
  "resourcemanager pkg/resourcemanager"
  "server pkg/server"
  "session pkg/session"
  "sessionctx pkg/sessionctx"
  "sessiontxn pkg/sessiontxn"
  "statistics pkg/statistics"
  "structure pkg/structure"
  "store pkg/store"
  "table pkg/table"
  "tablecodec pkg/tablecodec"
  "telemetry pkg/telemetry"
  "testkit pkg/testkit"
  "tidb-binlog pkg/tidb-binlog"
  "timer pkg/timer"
  "ttl pkg/ttl"
  "types pkg/types"
  "tidb-server cmd/tidb-server"
)

mkdir -p pkg

if [[ $(uname) == "Darwin" ]]; then
  sed_command="sed -i ''"
else
  sed_command="sed -i"
fi

for entry in "${pkg_list[@]}"; do
  source_dir="${entry%% *}"
  target_dir="${entry#* }"

  if [ -d "$target_dir" ]; then
    echo "Error: The target directory '$target_dir' already exists."
    exit 1
  fi

  git mv "$source_dir" "$target_dir"

  n_source="github.com/pingcap/tidb/$source_dir"
  n_target="github.com/pingcap/tidb/$target_dir"

  find . -type f -name "*.go" -exec $sed_command -i '' -e "s|$n_source|$n_target|g" {} +
done

Could you also add a shell script attachment in this comment?

@wuhuizuo
Copy link
Contributor

/priority p0

@ti-chi-bot ti-chi-bot bot added the Priority/P0 Features that will be implemented in the latest major/minor version label Oct 11, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 13, 2023

@chrysan: Your lgtm message is repeated, so it is ignored.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@wuhuizuo
Copy link
Contributor

/approve

just refresh the OWNERS links

yibin87 pushed a commit to yibin87/tidb that referenced this pull request Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Priority/P0 Features that will be implemented in the latest major/minor version release-note-none size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet