Внесение изменений в код

You are viewing an old version of this article. View the current version here.

Эта страница содержит главные принципы и процедуры для внесения изменений в код. Если у вас есть любые вопросы мы ждем их в MariaDB разработчики рассылке или на #maria IRC канале Freenode. А еще несколько e-mail адресов и других мест вы можете найти тут

Главная информация о внесении изменений в код MariaDB (для разработчиков и не только) может быть найдена на странице Внесение изменений в проект MariaDB.

Как найти наш проект и начать уже разрабатывать что-нибудь

У нас есть множество открытых для разработки проектов для MariaDB в которых вы можете поучаствовать(в дополнение к тем что вы сами придумаете)

  • Мы используем JIRA для управления проектом MariaDB. Перейдите по ссылке http://mariadb.org/jira и кликните "Projects" чтобы получить наш проект MariaDB. еще можете поискать там неисправленные и незанятые уязвимости, если это то что вам интересно. Некоторые уязвимости имеют спонсоров, и вы можете получить плату за исправление!
  • Вступайте в MariaDB разработчики и пишите на maria-developers \at\ lists.launchpad.net рассылку и предлагайте те задачи которые нужны именно вам. Пожалуйста включите ваш опыт и ваши знания исходников MariaDB и то что вы знаете о использовании MySQL/MariaDB в рассылку, так мы узнаем какие задачи можно предложить вам.
  • Если вы первый раз в нашем проекте ознакомьтесь с Suggested Development. Эти проекты могут стать хорошим стартом.
  • Вступайте в irc:irc.freenode.net/maria на Freenode IRC и вносите свои предложения.

Если у вас есть какие то идеи отправляйте их сюда JIRA чтобы другие MariaDB-разработчики могли их прокомментировать и предложить как применить их к делу. Вы так же можете так же использовать maria-developers список для этого.

MariaDB исходники теперь есть и на Github: https://github.com/MariaDB/server. Смотри Использование Git. Информация ниже устарела и будет переписана когда дойдут руки.

Предварительные требования

Вам нужно иметь Bazaar для контроля версий.

Установка логина для Bazaar

  • Получите launchpad аккаунт на https://launchpad.net/+login
  • Когда вы войдете, установите SSH keys
    • Кликните на ваше имя (верхний правый угол)
    • Нажмите Change Details ссылку (сверху справа)
    • Нажмите SSH Keys кнопку (центр страницы)
    • Загрузите ваш публичный SSH ключ (Как получить публичный ключ?)
  • Регистрация при помощи launchpad с вашей командной строки: bzr launchpad-login [Ваш-логин-id]

Получение кода MariaDB

  1. Первым делом, получаем чистую копию MariaDB-кода (для некоторых, быстрей будет использовать инструкции из секции "Source Tree Tarball").
  1. Однажды сделав чистую копию, создайте рабочую копию для ваших изменений:
cd $maria-repo # ex: ~/repos/maria
bzr branch trunk maria-fix-bugNNNNNN
cd maria-fix-bugNNNNNN

Совет: Используйте понятные имена вроде maria-fix-bugNNNNNN (где NNNNNN это баг # конечно).

  1. Теперь вы должны быть готовы к Компиляции MariaDB. Это хорошая идея скомпилировать на этом этапе чтобы подтвердить что ваше дерево исходников готово к активным действиям во время работы . . . перед тем как делать что либо.

Следующие страницы могут помочь тебе получить и запустить MariaDB из исходников:

Проведение тестов

MariaDB обвес тестировщика содержится в ./mysql-test/ подпапки нашего дерева исходников. В ней находятся две подпапки которым ты должен уделить внимание, ловец багов: t/ подпапка и r/ папка(для "тестов" и "результатов" соответственно) Будьте внимательны, проверяйте и смотрите результаты если ваш баг уже был протестирован или все еще тестируется.

Все тесты вы можете найти в t/ папке. Откройте файл который описывает ваш функционал(или добавьте новый файл) и добавьте команды которые воспроизведут баг или проверят новую фичу.

Например, тест ниже создает новую тестовую таблицу "t1"; показывает результат выражения "CREATE TABLE" выражения; и наконец мы очищаем результаты теста удаляя эту тестовую таблицу:

#
# Bug #XXXXXX: INET_ATON() returns signed, not unsigned
#
create table t1 select INET_ATON('255.255.0.1') as `a`;
show create table t1;
drop table t1;

-Пока все, вернусь доделаю. Переводчик-

By adding your test first, it will remind you to re-record the test output file later (and inform future efforts about your expected output, of course). Now it's time to make your changes.

Examine existing tests to get a better idea of how you should write your test.

We are always on the lookout for better tests, so if you create new test or improve an existing test, please upload it to the "private" folder on our FTP server and then ping us on IRC or send a note to the Maria-Developers mailing list to let us know about it.

Editing and adding to your contribution

With a working version, you can commence making changes in your new branch, committing code regularly to your local working copy; feel free to commit early and often as you will formalize your contribution later with a push and proposal.

cd $maria-repo/maria-fix-bugNNNNNN
# Make Changes
bzr commit -m "Merge comment"

Prior to publishing your completed work, you need to confirm that your branch works as expected and update the test runs.

To allow others to see your commits, you should configure bzr to send its commit emails to commits 'at' mariadb 'dot' org email list.

Testing your branch

Make sure you have at least libtool 1.5.22 (found here).

First, check to see that all the tests pass (remember the test you set up earlier? It should fail. That's ok, you will re-record it momentarily):

cd $maria-repo/mysql-test
./mysql-test-run

Any that fail will need to be re-recorded.

cd $maria-repo/mysql-test
./mysql-test-run --record $test # where $test is the name of the test that failed 

You are now ready to merge into trunk.

Merging recent changes

It is important to merge any changes from trunk into your branch before pushing or publishing.

Update your local trunk.

cd $maria-repo 
cd trunk
bzr pull   

Updating your local branch.

cd $maria-repo
cd maria-fix-bugNNNNNN
bzr merge ../trunk
bzr commit -m "Merged from trunk"

Conflicts can be resolved in bazaar via:

bzr resolve $filename

To revert to your last commit on your branch use:

bzr revert $filename

(Note you will need to remerge with trunk before pushing)

Verify differences carefully

bzr diff

Publish your branch

When all changes are merged and your changes are all consistent you can push your branch to LaunchPad

cd $maria-repos/$your-branch # where $your-branch is the branch you want to push (ex: maria-bugNNNN)
bzr push lp:~[yourloginid]/maria/$your-branch

If you find that this takes a very long time (eg. >30 minutes), you may want to try using 'bzr init-repo --format=1.9' to initialize a new repo and merge your work into it, then push again.

How to propose branch for merging

On your Launchpad Code page https://code.launchpad.net/~{yourloginid}/maria/{branch-name} click the Propose for merging into another branch link to propose branch to the maintainers to be merged into the main trunk.

Getting your code into the main MariaDB tree.

All code in MariaDB comes from one of the following sources:

  • MySQL
  • Code developed by people employed by the MariaDB Foundation.
  • Code developed by people employed by MariaDB Corporation.
  • Code shared with the MariaDB Foundation under the MCA.
  • Code with a known origin that is under a permissive license (BSD or public domain).

If you want the code to be part of the main MariaDB tree, you also have to give the MariaDB Foundation a shared copyright to your code. This is needed so that the foundation can offer the code to other projects (like MySQL).

You do this by either:

  1. Signing the MariaDB Contributor Agreement (MCA) and then scanning and sending it to the foundation.
  2. Sending an email to maria-developers where you say that your patch and all fixes to it are provided to the MariaDB Foundation under the MCA.
  3. Licensing your code using the BSD license.

We need shared copyright for the following reasons:

  1. to defend the copyright or GPL if someone breaks it (this is the same reason why the Free Software Foundation also requires copyright assignment for its code)
  2. to be able to donate code to MySQL (for example to fix security bugs or new features)
  3. to allow people who have a non-free license to the MySQL code to also use MariaDB (the MCA/BSD allows us to give those companies the rights to all changes between MySQL and MariaDB so they can use MariaDB instead of MySQL)

More information about the MCA can be found on the MCA FAQ page.

Fix Branch (if needed)

If fixes are needed on your branch you will need to: make the changes, re-merge any new changes to trunk, commit and re-push; you do not need to re-propose. After the push, LaunchPad will pick up the changes automagically.

Please be aware that changes can take a few minutes for LaunchPad to merge your new changes into your proposal.

How to re-submit a Proposal

At the moment, this is a tricky process, and none of the "Request another review" links on Launchpad work.

To resubmit a merge proposal, follow these steps:

  1. On the main page of the merge proposal, the top line will be something like "Status: Needs Review". Just to the right of this is a small button; click on this to change the status.
  2. Select "Resubmit" from the drop down menu and click "Change Status".
  3. The next page should prompt you to resubmit the merge proposal and inform you that the new proposal will supersede the old one
  4. Click "Resubmit" to finish.

A couple of easy ways to get attention to your proposed merge are:

  • Join the #maria IRC channel on freenode ask people to review/discuss your merge.
  • Subscribe to and send an email to the maria-developers group on Launchpad.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.