Custom Search
Showing posts with label Contribution to OpenStack. Show all posts
Showing posts with label Contribution to OpenStack. Show all posts

Friday, July 4, 2014

How to OpenStack Puppet Submit Blueprint Patch Set

http://docs.openstack.org/training-guides/content/operator-getting-started-lab.html

https://wiki.openstack.org/wiki/Gerrit_Workflow

1)
* Install git and pip

#sudo apt-get install git
#sudo apt-get install python-pip


2)
* Install git-review

#sudo pip install git-review

3)
* Configure github


#git config -l

#git config --global user.name "Saju Madhavan"
#git config --global user.email "sajuptpm@gmail.com"
#git config --global core.editor "vim"

#git config -l


4)
Clone the "puppet-heat" project
#git clone https://github.com/stackforge/puppet-heat.git

5)
#cd puppet-heat

6)
* Test the ssh key setup
* If this not working, complete the step-7 and try this step again.

#git review -s
Enter your gerrit username: sajuptpm

7)
* Optional, if you are trying to submit the code from different machine

* I you already registered your SSH keys to github and Launchpad, copy your "id_rsa" and "id_rsa.pub" to ~/ssh folder of new machine.
#cd ~/.ssh
#scp id_rsa saju@192.168.56.102:~/.ssh
#scp id_rsa.pb saju@192.168.56.102:~/.ssh


8)
My blueprint

https://blueprints.launchpad.net/puppet-heat/+spec/option-to-configure-falvor-in-heat.conf

9)
Create a new branch for our blueprint changes

#cd puppet-heat
#git checkout -b blueprint/option-to-configure-falvor-in-heat.conf


10)
Check the branch

#git branch

11)
make your changes


12)
Commit your changes
#git add file1 file2
#git commit -a


commit messageee
Implements: blueprint option-to-configure-falvor-in-heat.conf


13)

Push changes to https://review.openstack.org
#git review

14)
https://review.openstack.org/104795
https://review.openstack.org/#/c/104795/

15)
Resubmit same patch after some modification

#git commit -a --amend

Friday, March 21, 2014

How to use quilt to manage patches in Debian packages

http://raphaelhertzog.com/2012/08/08/how-to-use-quilt-to-manage-patches-in-debian-packages/

0)
#sudo apt-get install quilt
or
Install the packaging-dev package to get a decent set of packages to do Debian packaging. It includes the quilt package.
#sudo apt-get install packaging-dev

1)
Quilt manages a series of patches by keeping track of the changes each of them makes. They are logically organized as a stack, and you can apply, un-apply, update them easily by traveling into the stack (push/pop).

The “stack of patches” is maintained in a dedicated directory (“patches” by default, but in Debian packages we override this value to “debian/patches”). This directory contains the patch files and a “series” file that gives an ordered list of patches to apply.

When quilt is used, it also maintains some internal files in a directory of its own (it’s named “.pc”). This directory is used to know what patches are currently applied (.pc/applied-patches) and to keep backup copies of files modified by the various patches.

2)
Configuring quilt
--------------------
export QUILT_PATCHES=debian/patches

3)
Applying and unapplying patches, navigating in the stack of patches

a)
Apply next patch
#quilt push

b)
Apply all patch
#quilt push -a

c)
To see the name of applied patches
#quilt applied

d)
To see the name of next patch to be applied
#quilt next

e)
To see the name of unapplied pathes
#quilt unapplied

f)
Unapplies the last applied patch
#quilt pop

g)
Unapplies all applied patch
#quilt pop -a

h)
To see the name of last appled patch
#quilt top

i)
To apply up to particular patch
#quilt push name_ofpatch_file.diff

3)
How to Create a new patch
-----------------------------------------
If there’s no quilt series yet, you want to create the “debian/patches” directory first.
If you already have one, you need to decide where to insert the new patch. Quilt will always add the new patch just after the patch which is currently on top. So if you want to add the patch at the end of the series, you need to run “quilt push -a” first.
Then you can use quilt new name-of-my-patch.diff to tell quilt to insert a new empty patch after the current topmost patch. In this operation quilt does almost nothing except updating the series file and recording the fact that the new patch is applied (even if still empty at this point!).
Now to add changes in this patch, you’re supposed to modify files but only after having informed quilt of your intent to modify those files. You do this with quilt add file-to-modify. At this point quilt will make a backup copy of that file so that it can generate the final patch when you’re done with your changes. It’s quite common to forget this step and to be unable to generate the patch afterward. That’s why I recommend you to use quilt edit file-to-modify which is a shorthand for doing quilt add and then opening the file in your favorite text editor.
If you want, you can review your work in progress with quilt diff.
When you’re done with the changes, you should call quilt refresh to generate the patch (or to update it if it was already existing).

a)
if you want to add the patch at the end of the series, you need to run “quilt push -a” first
#quilt push -a

b)
add new patch file
#quilt new name-of-my-new-patch.diff

c)
Specify the files for which you want to create path
#quilt edit file-1-to-modify
#quilt edit file-2-to-modify
#quilt edit file-3-to-modify

d)
Open the files specified above in a text editor and make your changes

e)
How to review the patch before creating it
#quilt diff

f)
Generate the patch
#quilt refresh

4)
Importing an external patch
----------------------------
If someone else already prepared a patch, you can just import it right away with quilt import /tmp/the-patch. If you want to import it under a better name you can use the option “-P better-patch-name”. Like quilt new, it inserts the patch after the topmost patch.

a)
Import a new patch
#quilt import /tmp/the-name-of-patch-file.diff

b)
How to give new name for patch during import
#quilt import /tmp/the-name-of-patch-file.diff -P new-name-for-imported-patch-file.diff


5)
Updating patches for a new upstream version
--------------------------------------------
a)
Apply patches
#quilt push
or
#quilt push -a

b)
manually apply the parts of the patch that were rejected, and then refresh/generate the patch

c)
Generate the patch
#quilt refresh

6)
Other quilt commands
---------------------
a)
To rename the topmost patch
#quilt rename new-name-for-topmost-patch.diff

b)
To rename a particular patch
#quilt rename -P patch-to-rename.diff new-name-for-patch.diff

7)
Editing an existing patch
--------------------------
1)
cd horizon/debian

2)
export QUILT_PATCHES=debian/patches

3)
##Apply app patches
quilt push -a

4)
##Edit files / Make changes
vim ../openstack_dashboard/local/local_settings.py.example

5)
##Create patch
quilt refresh jcloud-settings.patch

6)
##Remove all applied patches
quilt pop -af

7)
Check
git diff

8)
git commit patches/jcloud-settings.patch

9)
quilt push -a
quilt pop -a




Saturday, January 18, 2014

How To Checkout From review.openstack.org and rebase and Push Changes back


1)
#git clone https://github.com/openstack/python-keystoneclient.git

2)
#cd python-keystoneclient

3)
Checkout Patch
Click on "Checkout" button and copy the url and append "-b bug_branch"
#git fetch ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient refs/changes/81/65381/9 && git checkout FETCH_HEAD -b bug_branch

4)
#git branch
* confirm that you are in branch 'bug_branch'

5)
#git rebase -i master



6)
#Make or Appy your changes

7)
#git commit -a --amend

8)
#git review -s

9)
#git review

Thursday, January 9, 2014

How To Checkout From review.openstack.org And Push Changes Back Again For Review

1)
#git fetch ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient refs/changes/81/65381/2 && git checkout FETCH_HEAD -b test_branch
From ssh://review.openstack.org:29418/openstack/python-keystoneclient
 * branch            refs/changes/81/65381/2 -> FETCH_HEAD
Switched to a new branch 'test_branch'


2)
#git branch
  master
* test_branch

3)
#git remote -v
origin    https://github.com/openstack/python-keystoneclient.git (fetch)
origin    https://github.com/openstack/python-keystoneclient.git (push)

4)
#git review -s
Could not connect to gerrit.
Enter your gerrit username: sajuptpm
Trying again with ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient.git
Creating a git remote called "gerrit" that maps to:
    ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient.git

This repository is now set up for use with git-review.
You can set the default username for future repositories with:
  git config --global --add gitreview.username "sajuptpm"

5)
#git remote -v
gerrit    ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient.git (fetch)
gerrit    ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient.git (push)
origin    https://github.com/openstack/python-keystoneclient.git (fetch)
origin    https://github.com/openstack/python-keystoneclient.git (push)

6)
#git remote update
Fetching origin
Fetching gerrit

7)
#git branch
  master
* test_branch

8)
#git checkout master
Switched to branch 'master'

9)
#git branch
* master
  test_branch

10)
#git pull --ff-only origin master
From https://github.com/openstack/python-keystoneclient
 * branch            master     -> FETCH_HEAD
Already up-to-date.

11)
#git branch
* master
  test_branch

12)
#git remote -v
gerrit    ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient.git (fetch)
gerrit    ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient.git (push)
origin    https://github.com/openstack/python-keystoneclient.git (fetch)
origin    https://github.com/openstack/python-keystoneclient.git (push)

13)
#git checkout test_branch
Switched to branch 'test_branch'

14)
#git branch
  master
* test_branch

15)
#git diff

16)
*See comment and diff of last commit
#git show

17)
Make your changes

18)
a)
*If you want to save your changes as new commit
#git commit -a

b)
*If you want to append your changes to last commit
#git commit --amend

19)
*Push your Changes to https://review.openstack.org
#git review

20)
Goto https://review.openstack.org

Friday, January 3, 2014

OpenStack Projects How to resubmit patch set

OpenStack Projects How to submit new changes after review from review.openstack.org

1)
#git remote -v
gerrit    ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient.git (fetch)
gerrit    ssh://sajuptpm@review.openstack.org:29418/openstack/python-keystoneclient.git (push)
origin    https://github.com/openstack/python-keystoneclient.git (fetch)
origin    https://github.com/openstack/python-keystoneclient.git (push)

2)
#git branch
* bug/1047867
  master

3)
Make your new changes for the bug "bug/1047867".
Then, Commit your changes
#git commit -a --amend
or
#git commit file1 file2 --amend


* We are using --amend, because this fix is part of our lat commit.
* So we can append this changes to last commit and use the message lat commit.

4)
Goto master branch

#git checkout master

5)
#git branch
  bug/1047867
* master

6)
Update master branch of remote 'origin'

#git pull origin master

7)
Goto "bug/1047867" branch

#git checkout bug/1047867

8)
#git rebase -i master
This command does following operations
*Take backup of last commit from the branch "bug/1047867"
*Apply all changes from "master" branch to "bug/1047867"
*Apply backup-ed commit back to the branch "bug/1047867"

9)
Run 'git log', You can see your commit in the first place.

#git log

10)
Now your branch "bug/104786" is updated


11)
Make your new changes (related to bug:104786) in "bug/104786" branch


12)
Run following testings

*Unit test
#./run_tests.sh
*PEP8 cleaning
#./run_tests.sh --pep8

or
./run_tests.sh -d
./run_tests.sh -p

13)
Make your changes (In any) for the bug "bug/1047867".
Then, Commit your changes
#git commit -a --amend
or
#git commit file1 file2 --amend


* We are using --amend, because this fix is part of our lat commit.
* So we can append this changes to last commit and use the message lat commit.

14)
Upload your changes to Gerrit for review

#git review

15)
Goto https://review.openstack.org and login

There you can see your changes and status of review.