Difference between revisions of "CVS usage"
Line 40: | Line 40: | ||
===Development stages/actions=== | ===Development stages/actions=== | ||
====Check out==== | ====Check out==== | ||
− | To get a local copy of a package we need to retrieve the source from the repository, this is called a check out. To check out a package from the SME Contribs repository take a look at [[: | + | To get a local copy of a package we need to retrieve the source from the repository, this is called a check out. To check out a package from the SME Contribs repository take a look at [[Package_Modification]]. |
+ | 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] | ||
+ | |||
====Retrieving the latest version==== | ====Retrieving the latest version==== | ||
If you already once checked out the source of a certain package you can update your local copy with the following command: | If you already once checked out the source of a certain package you can update your local copy with the following command: |
Revision as of 22:06, 9 April 2014
SME Server core and contribs code is stored in CVS, this is a system to maintain version history and change management for program code.
On top of that a build system (plague) is layered to build packages in the RPM format used by yum.
The following is a cheat sheet that was started by User:Cactus here User:Cactus:CVS:Cheat_Sheet but was locked so I copied the contents here to allow it to be updated where needed.
Repositories
There are two repositories hosting code for SME Server:
- SME Server - holding the source code for the SME Server core
- SME Contribs - holdint the source code for contribs (add-ons) for SME Server
Both repositories are organized by the package name under which they appear in the software installer in the server-manager (or yum).
SME Server repository
The SME Server repository holds the SME Server core source code. Everybody can have a look at the content of the repository, but not every one is to allowed to make changes to the code. More on helping development can be found [].
Browsing the source code
There is a nice web based interface through which you can browse the development of SME Server core packages and you can find it here.
SME Contribs repository
The SME Contribs repository holds the SME Server contribs source code. Everybody can have a look at the content of the repository, but not every one is to allowed to make changes to the code. The code in this repository is not linked to SME Server as such, most of it is written by experienced SME Server users, some of it by the core development team. If you want to develop a package that can be an addition to SME Server you can apply for an account for this repository and develop your contrib.
Browsing the source code
There is a nice web based interface through which you can browse the development of SME Server contribs and you can find it here.
Workflow
The basic workflow is to first setup your development environment this is described in Package Modification. After that you need to get a copy of the source of a package by checking out the source. Than you can make your modifications by making a copy with a suffix (patchname) and make your modification to the original. You can refer to this page Rpm_build_example_using_cvs/mock to see many examples of mock/cvs usage After that we first need to test what we did, therefore we need to make a local build
make local
and install and test the created package:
sudo -u root yum localinstall /path/to/packagename
If everything is successfully tested we need to create a tag in the CVS system:
make tag
And instruct the build system to build the package:
make build
Development stages/actions
Check out
To get a local copy of a package we need to retrieve the source from the repository, this is called a check out. To check out a package from the SME Contribs repository take a look at Package_Modification. 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]
Retrieving the latest version
If you already once checked out the source of a certain package you can update your local copy with the following command:
cvs update -dPA
Check in or committing
To upload your source code into the repository (check in) you need to have a user account on the SourceForge system that is hosting the SME Server core and SME Server contribs repositories. Check in is quite simple
cvs commit -m 'message'
Adding/removing files
Since files under source control are not aware of the local file system we need to add and remove them with special commands:
To remove a file from source control:
cvs remove <file>
To add a file to source control:
cvs add <file>
Prepare a working copy
To prepare a working copy you can use
make prep
This command will download the latest source archive, extract it and apply all patches listed in the spec file.
Erasing your changes
To erase changes not committed to the repository you can issue
make clean
This command will remove all SRPMS and clear out the source directory in which you made modifications. It will give you a clear start as if you just checked out the latest version of the package from the repository.
Tagging
A tag is a mark in the source tree to document a certain stage of the development, usually a release version. To check the current tag number we can issue the following command:
cvs status -v *.spec
The output could look something like this:
File: e-smith-apache.spec Status: Up-to-date Working revision: 1.3 Repository revision: 1.3 /cvsroot/smeserver/rpms/e-smith-apache/sme7/e-smith-apache.spec,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: -ko Existing Tags: e-smith-apache-1_2_0-15_el4_sme (revision: 1.2) e-smith-apache-1_2_0-13_el4_sme (revision: 1.1)
From this output you can see that the working revision of the (e-smith-apache) code is at version 1.3 and that the latest tag in the repository is 1.2, so we need to make a new tag for this release, we can use this command to do so:
make tag
Building
To instruct the build system to build the package we tagged you issue
make build