Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
876 changes: 876 additions & 0 deletions tools/pika_migrate_v4.0/CMakeLists.txt

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions tools/pika_migrate_v4.0/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
1 change: 1 addition & 0 deletions tools/pika_migrate_v4.0/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
### Contributing to pika
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add actual contribution guidelines.

This file currently contains only a placeholder heading without any guidance for contributors. Consider adding sections on:

  • How to set up the development environment
  • Coding standards and style guides
  • How to submit pull requests
  • Testing requirements
  • Communication channels

Would you like me to generate a comprehensive contribution guide template?

🤖 Prompt for AI Agents
In tools/pika_migrate_v4.0/CONTRIBUTING.md around lines 1 to 1, the file only
has a placeholder heading and lacks contribution guidance; replace the
placeholder with a structured CONTRIBUTING guide that includes sections for:
development environment setup (prereqs, install, run), coding standards/style
and linting rules, testing requirements and how to run tests, PR process and
commit message format, and communication channels/issue templates; keep sections
concise, include example commands where helpful, and ensure the document links
to relevant config files (eslint, prettier, CI) and a template PR checklist.

169 changes: 169 additions & 0 deletions tools/pika_migrate_v4.0/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#!/bin/bash

set -x

#color code
C_RED="\033[31m"
C_GREEN="\033[32m"

C_END="\033[0m"

CMAKE_MIN_VERSION="3.18"
TAR_MIN_VERSION="1.26"

BUILD_DIR=output

CLEAN_BUILD="false"
ARGS=()

for i in "$@"; do
case $i in
-c*|--clean*)
CLEAN_BUILD="true"
;;
-*|--*)
echo "Unknown option $i"
exit 1
;;
*)
ARGS=("${ARGS[@]}" $i)
;;
esac
done

if [ ! -f "/proc/cpuinfo" ];then
CPU_CORE=$(sysctl -n hw.ncpu)
else
CPU_CORE=$(cat /proc/cpuinfo| grep "processor"| wc -l)
fi
if [ ${CPU_CORE} -eq 0 ]; then
CPU_CORE=1
fi

echo "cpu core ${CPU_CORE}"

if [[ "${CLEAN_BUILD}" = "true" ]]; then
rm -rf "${BUILD_DIR}" buildtrees deps pkg
fi

if [[ "${ARGS[0]}" = "clean" ]]; then
rm -rf "${BUILD_DIR}" buildtrees deps pkg
exit 0
fi

if [[ "${ARGS[0]}" = "codis" ]]; then
export GOPATH=${PWD}
export CGO_ENABLED=1
pushd codis
if [[ "${CLEAN_BUILD}" = "true" ]]; then
make -j ${CPU_CORE} clean
fi
make -j ${CPU_CORE} "${ARGS[@]:1}"
popd
exit 0
fi

source ./utils/Get_OS_Version.sh

function version_compare() {
if [[ "$1" == "$2" ]]; then
return 0
fi

if [[ "$(printf '%s\n' "$1" "$2" | sort -rV | head -n1)" == "$1" ]]; then
#local version less min version
echo -e "local ${C_GREEN} $3 ${C_END} version ${C_GREEN} $2 ${C_END} less min version ${C_GREEN} $1 ${C_END}"
exit 1
fi
}

function check_program() {
if ! type $1 >/dev/null 2>&1; then
# not find
echo -e "not find ${C_GREEN} $1 ${C_END} on localhost"
return 1
fi
return 0
}

function install_package() {
if [ $PM == "unknow" ]; then
echo -e "${C_RED} unknow package manager, please install $1 ${C_END}"
exit 1
fi
if [ ${PM} == "apt" ]; then
sudo ${PM} -y install $1
elif [ ${PM} == "brew" ]; then
${PM} install -d $1
else
sudo ${PM} install -y $1
fi
if [ $? -ne 0 ]; then
echo -e "${C_RED} install $1 fail, install autoconf before compiling ${C_END}"
exit 1;
fi
}

if ! check_program autoconf; then
# not find autoconf,do install
echo -e "not find ${C_GREEN} autoconf ${C_END} on localhost, now do install"
install_package autoconf
fi

if ! check_program tar; then
echo -e "not find ${C_GREEN} tar ${C_END} on localhost, please install and min version ${C_GREEN} ${TAR_MIN_VERSION} ${C_END}"
exit 1;
fi

if ! check_program cmake; then
if ! check_program cmake3; then
echo -e "not find ${C_GREEN} cmake ${C_END}, please install cmake and min version ${C_GREEN} ${CMAKE_MIN_VERSION} ${C_END}"
exit 1
else
CMAKE=cmake3
fi
else
CMAKE=cmake
fi

# get local cmake version
LOCAL_CMAKE_VERSION=`${CMAKE} --version |grep version |grep -o '[0-9.]\+'`
#compare cmake version
version_compare ${CMAKE_MIN_VERSION} ${LOCAL_CMAKE_VERSION} 'cmake'

# get local tar version
LOCAL_TAR_VERSION=`tar --version |head -n 1 |grep -o '[0-9.]\+'`
#compare tar version
version_compare ${TAR_MIN_VERSION} ${LOCAL_TAR_VERSION} 'tar'

if [ ! -d ${BUILD_DIR} ]; then
mkdir ${BUILD_DIR}
fi

cd ${BUILD_DIR}

use_pika_tools=""
if [[ "${ARGS[0]}" = "tools" ]]; then
use_pika_tools="-DUSE_PIKA_TOOLS=ON"
fi

with_command_docs=""
if [ "${WITH_COMMAND_DOCS}" = "ON" ]; then
with_command_docs="-DWITH_COMMAND_DOCS=ON"
fi

${CMAKE} ${use_pika_tools} ${with_command_docs} .. .

if [ $? -ne 0 ]; then
echo -e "${C_RED} cmake execution error ${C_END}"
exit 1
fi

make -j ${CPU_CORE}

if [ $? -eq 0 ]; then
echo -e "pika compile complete, output file ${C_GREEN} ${BUILD_DIR}/pika-migrate ${C_END}"
else
echo -e "${C_RED} pika compile fail ${C_END}"
exit 1
fi
Loading
Loading