Changes

From SME Server
Jump to navigationJump to search
Line 189: Line 189:  
You need top create an account on sourceforge, then get Shad to includ you in sme group + give access to Buildsys. Can be done later...Of course it is not an issue if you have not a cvs access like we will see below, you can retrieve package in mode anonymous.
 
You need top create an account on sourceforge, then get Shad to includ you in sme group + give access to Buildsys. Can be done later...Of course it is not an issue if you have not a cvs access like we will see below, you can retrieve package in mode anonymous.
    +
====USING CVS - GETTING SOURCE CODES====
 +
We need to create directory in /home/chris for example this how you can do
    +
exchange  - used to move files around with wget
 +
work - used for CVS jobs
 +
rpmbuild - used to build with Mock
 +
rpms - used for CVS tree download
    +
'''CVS is used for maintaining code and packages.'''
 +
We first need to download (with CVS this is called retrieving) the code for the package to be modified from the SME Server CVS repository at SourceForge (we can also retrieve the CVS for the smecontribs tree).
 +
Two cases with CVS:
    +
To be able to work on your code in the SME Server CVS repository you need an account on SourceForge.  If you do not have an account at CVS, retrieving is performed as an anonymous user and changes cannot be saved.
    +
===== CASE 1 - REGISTERED USERS =====
 +
- To retrieve a package or a full tree as a registered user, cd into a work directory and issue following commands:
 +
* for smeserver
 +
cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P packagename [individual package]
 +
cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P rpms [full tree]
 +
* for smecontribs
 +
cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smecontribs co -P packagename [individual package]
 +
cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smecontribs co -P rpms [full tree]
 +
 +
===== CASE 2 - ANONYMOUS USERS =====
 +
- To retrieve a package or a full tree as an anonymous user, cd into a work directory and issue following commands:
 +
* for smeserver
 +
cvs -z3 -d:pserver:anonymous@smeserver.cvs.sourceforge.net:/cvsroot/smeserver checkout -P packagename [individual package]
 +
cvs -z3 -d:pserver:anonymous@smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P rpms [full tree]
 +
 +
* for smecontribs
 +
cvs -z3 -d:pserver:anonymous@smeserver.cvs.sourceforge.net:/cvsroot/smecontribs checkout -P packagename [individual package]
 +
cvs -z3 -d:pserver:anonymous@smeserver.cvs.sourceforge.net:/cvsroot/smecontribs co -P rpms [full tree]
 +
 +
Note: If at a later stage you obtain a valid account with CVS, you will need to edit ALL packages /CVS/Root in order to save your work in CVS. As an example, for package "packagename", CVS/Root will need to be edited to be exactly as shown below:
 +
[chris@buildcos9 work]$ cat packagename/CVS/Root
 +
:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver
 +
 +
ok - CVS/Root uses 'ext' which should be SSH access
 +
 +
==== PACKAGE MODIFICATION ====
 +
* Prepare work areas, make some directories:
 +
[chris@buildcos9 ~]$ pwd
 +
/home/chris
 +
 +
* [chris@buildcos9 ~]$ ls
 +
exchange  rpmbuild  rpms  test  work
 +
 +
* Import cvs in your workspace
 +
[chris@buildcos9 ~]$ cd work/
 +
[chris@buildcos9 ~]$ mkdir smeserver
 +
[chris@buildcos9 ~]$ cd smeserver
 +
[chris@buildcos9 work]$ cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P packagename
 +
 +
or for smecontribs
 +
[chris@buildcos9 ~]$ cd work/
 +
[chris@buildcos9 ~]$ mkdir smecontribs
 +
[chris@buildcos9 ~]$ cd smecontribs
 +
[chris@buildcos9 work]$ cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smecontribs co -P packagename
 +
 +
* To refresh run the following from the rpms directory, or any lower directory with a CVS dir.
 +
[chris@buildcos9 ~] cd packagename/
 +
[chris@buildcos9 packagename]$ cvs update -dPA
 +
 +
* Change to work directory, in this example, we are working on sme9:
 +
[chris@buildcos9 packagename] cd sme9
 +
 +
* To prepare a tree
 +
[chris@buildcos9 sme9]$  cvs update -dPA [if not done previously]
 +
[chris@buildcos9 sme9]$  make clean  [ignore errors about tar.xz:file missing]   
 +
[chris@buildcos9 sme9]$  make prep
 +
 +
* Make a patch
 +
Our patch will be a done with the 'diff' tool which compares the edited files against the original files.
 +
 +
* We need to to save a copy of the original files:
 +
cp -R packagename-1.2.3 packagename-1.2.3.old
 +
 +
* Switch to the tree and make required changes/modifications.
 +
 +
* Create a patch using a sensible name, eg "packagename-1.2.3-migrate_to_UNC_syntax.patch":
 +
[chris@buildcos9 sme9]$ diff -urN packagename-1.2.3.old packagename-1.2.3 > packagename-1.2.3-your_changes-description.patch
 +
 +
* Update the spec file
 +
[chris@buildcos9 sme9]$ nano packagename.spec
 +
 +
* Increase the release version at the beginning of the spec file by 1:
 +
%define release 4
 +
 +
* Add the patch to the existing patchlist section not forgetting to increase the patch number by 1:
 +
Patch3: packagename-1.2.3-my_changes_description
 +
 +
* Add patch version to the %setup section bot forgetting to increase number by 1:
 +
%patch3 -p1
 +
 +
* Update the changelog section, including the release version and bug number:
 +
%changelog
 +
* Mon Apr 01 2013 name <email> 1.2.3-4.sme
 +
- Summary of changes [SME: xxxx]
 +
 +
NOTE: The formatting of date information is critical, any errors will prevent successful commit to CVS.
 +
In doubts, check previous entries in the changelog.
 +
 +
* Check changes against CVS
 +
[chris@buildcos9 sme9]$ cvs diff -u packagename.spec
 +
 +
* Build the test RPM
 +
[chris@buildcos9 sme9]$ pwd
 +
/home/chris/work/packagename/sme9
 +
 +
{{Note box|msg=Mock will determine which configuration to use, but you can specify it if wanting to build for a different architecture for instance.
 +
* Default
 +
make mockbuild
 +
* IF 32 BITS SYSTEM:
 +
BUILDARCH=i386 make mockbuild
 +
* IF 64 BITS SYSTEM:
 +
BUILDARCH=x86_64 make mockbuild}}
 +
 +
======Notes on mock/cvs======
 
Normally you make builds from the working directory of the module you are working on, eg ~/rpms/e-smith-runit/sme9:
 
Normally you make builds from the working directory of the module you are working on, eg ~/rpms/e-smith-runit/sme9:
 
  # Build the given module within the chroot environment
 
  # Build the given module within the chroot environment
Line 203: Line 317:  
  $ cd devel
 
  $ cd devel
 
  $ make mockbuild
 
  $ make mockbuild
  −
  −
{{Note box|msg=Mock will determine which configuration to use, but you can specify it if wanting to build for a different architecture for instance.
  −
* IF 32 BITS SYSTEM:
  −
BUILDARCH=i386 make mockbuild
  −
* IF 64 BITS SYSTEM:
  −
BUILDARCH=x86_64 make mockbuild}}
      
It will determine if this is for SME Server 9 or 8, and the package to build, based on which directory that you are in. The results are put under that directory.
 
It will determine if this is for SME Server 9 or 8, and the package to build, based on which directory that you are in. The results are put under that directory.
Line 223: Line 330:     
  $ rpm -qpl package_name.noarch.rpm |grep perl
 
  $ rpm -qpl package_name.noarch.rpm |grep perl
 +
 +
===== BASIC TESTING OF PACKAGE: =====
 +
Check for built packages:
 +
[chris@buildcos9 sme9]$ ls -la packagename-1_2_3-4_el6_sme
 +
 +
- Send new package (and patch if required) to workstation for testing/processing, as an example:
 +
[chris@buildcos9 packagename-1_2_3-4_el6_sme]$ scp -P 22 packagename-1_2_3-4_el6_sme.noarch.rpm chris\@192.168.0.1:/home/chris/WIP
 +
 +
- Move package to an ibay on test server
 +
 +
- Install package (yum localinstall or rpm -Uvh)
 +
 +
- Ensure nothing is broken.
 +
 +
===== FINALISING IN CVS AND BUILSYS =====
 +
* Add the patch file to cvs:
 +
[chris@buildcos9 sme9]$ cvs add packagename-1.2.3-your_changes-description
 +
cvs add: scheduling file `packagename-1.2.3-your_changes-description' for addition
 +
cvs add: use 'cvs commit' to add this file permanently
 +
 +
NOTE: ignore this suggestion! Just proceed to next stage or you will end up in all kinds of problems....
 +
 +
* Build package on Shad's system:
 +
[chris@buildcos9 sme9]$ make commit tag build
 +
 +
Note: this can also be done in stages:
 +
make commit
 +
make tag
 +
make build
 +
 +
* Check for Build:
 +
http://buildsys.contribs.org/plague/
 +
 +
* Check for emails received from buildsys@contribs.org, you should get one from CVS and two from the Buildsystem.
 +
 +
* If (and only if) build has been successful, open relevant ticket in Bugzilla and notify of build:
 +
 +
Fixed in packagename:
 +
%changelog
 +
* Mon Apr 01 2013 name <email> 1.2.3-4.sme
 +
- Summary of changes [SME: xxxx]
 +
 +
You may also wish to provide some tips about verification.
    
== Patching an upstream package ==
 
== Patching an upstream package ==

Navigation menu