Day: September 29, 2009

Counting 447 patches

LTIB uses this patch definition on the spec file:

Patch1 : patch_name-bla-bla-bla.patch

%patch1 -p1

But if you has 447 patches, like in our previous examples? Easy, use this bash command to create the right setup to apply these patches.

$ i=0; while [ $i -lt 447 ]; do i=$(($i + 1)); echo "%patch$i -p1" >> patch_spec; done

Salved by bash again

I was willing to create a incremental Patch numeration:

Patch :0001-ENGR00090813-1-merge-imx-2.6.24-2.3.0-to-2.6.26.patch
Patch :0002-ENGR00090813-2-Porting-changes-for-2.6.26.patch
Patch :0003-ENGR00090813-3-mx51-Add-core-mach-support.patch
Patch :0004-ENGR00086937-mxc_i2c-remove-unneeded-spinlock-and-p.patch
Patch :0005-ENGR00070687-1-ipuv3-add-serial-interface-support.patch
Patch :0006-ENGR00070687-2-mx51-add-ipu-and-lcd-support.patch
Patch :0007-ENGR00086541-mc13892-remove-debug-info-of-pmic-adc.patch

Patch1 :0001-ENGR00090813-1-merge-imx-2.6.24-2.3.0-to-2.6.26.patch
Patch2 :0002-ENGR00090813-2-Porting-changes-for-2.6.26.patch
Patch3 :0003-ENGR00090813-3-mx51-Add-core-mach-support.patch
Patch4 :0004-ENGR00086937-mxc_i2c-remove-unneeded-spinlock-and-p.patch
Patch5 :0005-ENGR00070687-1-ipuv3-add-serial-interface-support.patch
Patch6 :0006-ENGR00070687-2-mx51-add-ipu-and-lcd-support.patch
Patch7 :0007-ENGR00086541-mc13892-remove-debug-info-of-pmic-adc.patch

$ i=0; while read line; do i=$(($i + 1)); echo $line | sed “s/Patch0/Patch$i/” >> result_file; done < original_file

Thanks Rogerio for suggestion using "while read".

Creating remote git branch

I started using an internal git repository here at work, then today I want to create a remote branch, then I find out this tips:

Creating a Remote Branch

1. Create the remote branch

git push origin origin:refs/heads/branch_name

2. Make sure everything is up-to-date

git fetch origin

3. Then you can see that the branch is created.

git branch -r

This should show ‘origin/new_feature_name’

4. Start tracking the new branch

git checkout --track -b new_feature_name origin/new_feature_name

This means that when you do pulls that it will get the latest from that branch as well.

5. Make sure everything is up-to-date

git pull

6. If you want to remove a remote branch then run:

git push origin :branch_name