Rpm build example using cvs/mock
BUILD SERVER USAGE
Reference:
http://wiki.contribs.org/Setting_up_RPM_Building_for_SME_Server
http://wiki.contribs.org/Package_Modification#Make_a_patch
http://wiki.contribs.org/Simple_Package_Modification
http://fedoraproject.org/wiki/Using_Mock_to_test_package_builds
http://www.openfusion.net/linux/mocking_rpms
http://fedoraproject.org/wiki/Projects/Mock
https://sourceforge.net/apps/trac/sourceforge/wiki/Register%20a%20user%20account
https://sourceforge.net/apps/trac/sourceforge/wiki/CVS
https://sourceforge.net/apps/trac/sourceforge/wiki/SSH%20keys
- Import into CVS:
http://wiki.contribs.org/index.php?title=Setting_up_RPM_Building_for_SME_Server#These_following_steps_need_developer_access
- Build for others:
http://wiki.contribs.org/SME_Server_Development_Framework#Builder
SETUP OF BUILD SERVER
- Users and password
Root = xxxxxx xyz = xxxxxxxx IP = 192.168.xx.12 Source Forge xxxxxxx
- Buildsys:
ssh -l xxxxxxxx shell.contribs.org Pass: xxxxxxxxxxx
- Logon as root
- Log to server over ssh from ubuntu workstation:
xyz@canoxxx:~$ slogin -p 22 root\@192.168.xx.12 root@192.168.xx.12's password: xxxx Last login: Tue Feb 5 17:22:42 2013 from pc-00001.burnat.xxx
- Login as user xyz
xyz@canoxxx:~$ slogin -p 22 xyz\@192.168.xx.12 xyz@192.168.xxx.12's password: xxxx Last login: Tue Mar 5 11:31:47 2013
- Sudo
[xyz@buildxxxx ~]$ sudo yum update [sudo] password for xyz: xxxx No Packages marked for Update
- Changeroot Environments (cd /etc/mock/)
-rw-r--r-- 1 root root 1751 Nov 2 07:59 logging.ini -rw-r--r-- 1 root mock 6730 Jan 25 06:57 site-defaults.cfgHost shell.contribs.org User cburnat -rw-r--r-- 1 root mock 1626 Jul 26 2012 smeserver-7-i386-base.cfg -rw-r--r-- 1 root mock 2169 Jul 27 2012 smeserver-7-i386-iso.cfg -rw-r--r-- 1 root mock 1650 Jul 26 2012 smeserver-7-x86_64-base.cfg -rw-r--r-- 1 root mock 2191 Jul 27 2012 smeserver-7-x86_64-iso.cfg -rw-r--r-- 1 root mock 1484 Jul 26 2012 smeserver-8-i386-base.cfg -rw-r--r-- 1 root mock 2210 Jul 27 2012 smeserver-8-i386-iso.cfg -rw-r--r-- 1 root mock 1612 Jul 26 2012 smeserver-8-x86_64-base.cfg -rw-r--r-- 1 root mock 2338 Jul 27 2012 smeserver-8-x86_64-iso.cfg -rw-r--r-- 1 root mock 1455 Jan 26 06:29 smeserver-9-i386-base.cfg -rw-r--r-- 1 root mock 2017 Jan 25 04:58 smeserver-9-i386-iso.cfg -rw-r--r-- 1 root mock 1479 Jan 26 06:29 smeserver-9-x86_64-base.cfg -rw-r--r-- 1 root mock 2039 Jan 25 04:58 smeserver-9-x86_64-iso.cfg
- Create work directories
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
USING CVS - GETTING SOURCE CODES
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.
slogin -p 22 xyz\@192.168.xx.12 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 "e-smith-backup", CVS/Root will need to be edited to be exactly as shown below:
[xyz@buildxxxx testsf]$ cat e-smith-backup/CVS/Root :ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver [ok - CVS/Root uses 'ext' which should be SSH access]
- To retrieve a package or a full tree as an anonymous user, cd into a work directory and issue following commands:
cvs -z3 -d:pserver:anonymous@smeserver.cvs.sourceforge.net:/cvsroot/smeserver checkout -P e-smith-backup cvs -z3 -d:pserver:anonymous@smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P rpms
- To retrieve a package or a full tree as a registered user, cd into a work directory and issue following commands:
cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P e-smith-backup cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P rpms
PACKAGE MODIFICATION
- Import cvs in your workspace
You can use /home/xyz/testsf or whatever suits.
[xyz@buildxxxx ~]$ mkdir work [xyz@buildxxxx ~]$ cd work/ [xyz@buildxxxx testsf]$ cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P e-smith-backup
- To refresh run the following from the rpms directory, or any lower directory with a CVS dir
[xyz@buildxxxx ~] cd e-smith-backup/ [xyz@buildxxxx e-smith-backup]$ cvs update -dPA
- Change to work directory
[xyz@buildxxxx e-smith-backup] cd sme9
- To prepare a tree
[xyz@buildxxxx sme9]$ cvs update -dPA [xyz@buildxxxx sme9]$ make clean [ignore errors about tar.xz:file missing] [xyz@buildxxxx sme9]$ make prep
- Make a patch
Our patch will be 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 e-smith-backup-2.4.0 e-smith-backup-2.4.0.old
[xyz@buildxxxx sme9]$ ls -la drwxrwxr-x 2 xyz xyz 4096 Apr 2 14:07 CVS -rw-rw-r-- 1 xyz xyz 28 Feb 14 02:42 .cvsignore drwxr-xr-x 3 xyz xyz 4096 Feb 14 02:24 e-smith-backup-2.4.0 drwxrwxr-x 2 xyz xyz 4096 Apr 1 17:12 e-smith-backup-2_4_0-4_el6_sme -rw-rw-r-- 1 xyz xyz 93816 Apr 1 17:23 e-smith-backup-2.4.0-4.el6.sme.src.rpm -rw-rw-r-- 1 xyz xyz 902 Mar 21 15:30 e-smith-backup-2.4.0-CIFS_UNC_Path.patch -rw-rw-r-- 1 xyz xyz 730 Mar 1 17:21 e-smith-backup-2.4.0-df_ext4.patch -rw-rw-r-- 1 xyz xyz 663 Apr 1 16:38 e-smith-backup-2.4.0-migrate_to_UNC_syntax.patch -rw-rw-r-- 1 xyz xyz 38424 Feb 14 02:35 e-smith-backup-2.4.0.tar.xz -rw-r--r-- 1 xyz xyz 44999 Apr 2 14:07 e-smith-backup.spec -rw-rw-r-- 1 xyz xyz 90 Feb 14 02:42 import.log -rw-rw-r-- 1 xyz xyz 836 Feb 14 02:42 Makefile -rw-rw-r-- 1 xyz xyz 62 Feb 14 02:42 sources
- Switch to the tree and make required modification:
Create a patch using a sensible name, eg "e-smith-backup-2.4.0-migrate_to_UNC_syntax.patch":
[xyz@buildxxxx sme9]$ diff -urN e-smith-backup-2.4.0.old e-smith-backup-2.4.0 > e-smith-backup-2.4.0-migrate_to_UNC_syntax.patch
- Update the spec file
[xyz@buildxxxx sme9]$ nano e-smith-backup.spec
- increase the release version at the beginning of the spec file
%define release 4
- add the patch to the existing patchlist section:
Patch3: e-smith-backup-2.4.0-migrate_to_UNC_syntax.patch
- update the changelog section, including the release version and bug number
%changelog * Mon Apr 1 2013 xyz burnat <devlist@burnat.com> 2.4.0-4.sme - NFS syntax is deprecated for CIFS mount [SME: 7525]
- add patch version to the %setup section
%patch3 -p1
- Check changes against CVS
[xyz@buildxxxx sme9]$ cvs diff -u e-smith-backup.spec
- Build the test RPM
[xyz@buildxxxx sme9]$ pwd /home/xyz/work/e-smith-backup/sme9 [xyz@buildxxxx sme9]$ make mockbuild
- Check built packages:
[xyz@buildxxxx sme9]$ ls -la e-smith-backup-2_4_0-4_el6_sme
- Send new package and patch to workstation for testing/processing:
[xyz@buildxxxx sme9]$ scp -P 22 e-smith-backup-2.4.0-migrate_to_UNC_syntax.patch xyz\@192.168.xx.1:/home/xyz/WIP [xyz@buildxxxx e-smith-qmail-2_4_0-3_el6_sme]$ scp -P 22 e-smith-qmail-2.4.0-3.el6.sme.noarch.rpm xyz\@192.168.xx.1:/home/xyz/WIP
- Add the patch file to cvs:
[xyz@buildxxxx sme9]$ cvs add e-smith-backup-2.4.0-migrate_to_UNC_syntax.patch cvs add: scheduling file `e-smith-backup-2.4.0-migrate_to_UNC_syntax.patch' for addition cvs add: use 'cvs commit' to add this file permanently
[ignore this suggestion!]
- Finalise:
[xyz@buildxxxx 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
USE PREP TO CHECK PATCH
[15:51:38] Ian Wells: Hopefully the patch applies cleanly to SME9 [15:51:57] Ian Wells: I find that it is good to do a 'make prep' and see if the patch is OK [15:51:58] xyz burnat: Am doing local build now, let see [15:52:04] Ian Wells: Then do a make mockbuild [15:52:45] xyz burnat: ahhhh Too late, I started the local build, can I do make prep after to check? [15:53:13] Ian Wells: If the local build works then no worry [15:53:32] xyz burnat: OK, so either do a make prep or do a local build, yes? [15:53:40] Ian Wells: Yes [15:54:11] Ian Wells: Often when using a SME8 patch on SME9 it fails due to a minor issue, eg linenumbers [15:54:46] Ian Wells: make prep tells you that quicker than make mockbuild and also it shows the problem in the shell rather than having to find the log file [15:54:55] Ian Wells: However both work.
BUILDING A PACKAGE FROM CVS ON REQUEST
General instructions
The purpose is to build a package that you do not commit the patch in CVS
cd <package> cvs update -dPA cd sme9 make tag build
Example, Charlie has asked for the build of a package in CVS already:
http://bugs.contribs.org/show_bug.cgi?id=7548 http://bugs.contribs.org/show_bug.cgi?id=7546
e-smith-radiusd updated:
%changelog * Sat Apr 13 2013 Charlie Brady <charlie_brady@mitel.com> 2.4.0-7.sme - Fix permissions of /etc/radiusclient-ng/servers. [SME: 7548]
and:
* Sun Apr 14 2013 Charlie Brady <charlie_brady@mitel.com> 2.4.0-8.sme - Add directive to options.pptpd so that radius plugin can find the radiusclient configuration file. [SME: 7546]
Example
[xyz@buildxxxx ~]$ cd work/ [xyz@buildxxxx work]$ cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P e-smith-radiusd cvs checkout: Updating e-smith-radiusd cvs checkout: Updating e-smith-radiusd/sme7 U e-smith-radiusd/sme7/.cvsignore U e-smith-radiusd/sme7/Makefile U e-smith-radiusd/sme7/e-smith-radiusd.spec U e-smith-radiusd/sme7/import.log U e-smith-radiusd/sme7/sources cvs checkout: Updating e-smith-radiusd/sme8 U e-smith-radiusd/sme8/.cvsignore U e-smith-radiusd/sme8/Makefile U e-smith-radiusd/sme8/e-smith-radiusd-2.2.0-add_ldap_auth.patch U e-smith-radiusd/sme8/e-smith-radiusd-2.2.0-ldap-auth.patch U e-smith-radiusd/sme8/e-smith-radiusd-2.2.0-perms.patch U e-smith-radiusd/sme8/e-smith-radiusd.spec U e-smith-radiusd/sme8/import.log U e-smith-radiusd/sme8/sources cvs checkout: Updating e-smith-radiusd/sme9 U e-smith-radiusd/sme9/.cvsignore U e-smith-radiusd/sme9/Makefile U e-smith-radiusd/sme9/e-smith-radiusd-2.4.0-listen.patch U e-smith-radiusd/sme9/e-smith-radiusd-2.4.0-log_stdout.patch U e-smith-radiusd/sme9/e-smith-radiusd-2.4.0-ng.patch U e-smith-radiusd/sme9/e-smith-radiusd-2.4.0-ng.patch2 U e-smith-radiusd/sme9/e-smith-radiusd-2.4.0-ng.patch3 U e-smith-radiusd/sme9/e-smith-radiusd.spec U e-smith-radiusd/sme9/import.log U e-smith-radiusd/sme9/sources cvs checkout: Updating common U common/Makefile U common/Makefile.common U common/branches U common/cvs-import.sh U common/tobuild
[xyz@buildxxxx sme9]$ cvs update -dPA cvs update: Updating .
[xyz@buildxxxx sme9]$ cat e-smith-radiusd.spec # $Id: e-smith-radiusd.spec,v 1.10 2013/04/14 16:31:14 charliebrady Exp $ Summary: e-smith server and gateway - configure PPTP inbound VPN %define name e-smith-radiusd Name: %{name} %define version 2.4.0 %define release 8 Version: %{version} Release: %{release}%{?dist} License: GPL Group: Networking/Daemons Source: %{name}-%{version}.tar.xz Patch1: e-smith-radiusd-2.4.0-ng.patch Patch2: e-smith-radiusd-2.4.0-log_stdout.patch Patch3: e-smith-radiusd-2.4.0-listen.patch Patch4: e-smith-radiusd-2.4.0-ng.patch2 Patch5: e-smith-radiusd-2.4.0-ng.patch3 BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot Requires: e-smith-base >= 4.13.16-27 Requires: e-smith-lib >= 1.15.1-16 Requires: freeradius >= 2.1.12 Requires: freeradius-ldap >= 2.1.12 Requires: radiusclient-ng >= 0.5.6 Obsoletes: radiusclient <= 0.3.2 BuildRequires: e-smith-devtools >= 1.13.1-03 BuildArchitectures: noarch %define stunnelid 451 %description e-smith server and gateway - configure radius server %changelog * Sun Apr 14 2013 Charlie Brady <charlie_brady@mitel.com> 2.4.0-8.sme - Add directive to options.pptpd so that radius plugin can find the radiusclient configuration file. [SME: 7546] * Sat Apr 13 2013 Charlie Brady <charlie_brady@mitel.com> 2.4.0-7.sme - Fix permissions of /etc/radiusclient-ng/servers. [SME: 7548]
[xyz@buildxxxx sme9]$ make tag cvs tag -c e-smith-radiusd-2_4_0-8_el6_sme cvs tag: Tagging . T .cvsignore T Makefile T e-smith-radiusd-2.4.0-listen.patch T e-smith-radiusd-2.4.0-log_stdout.patch T e-smith-radiusd-2.4.0-ng.patch T e-smith-radiusd-2.4.0-ng.patch2 T e-smith-radiusd-2.4.0-ng.patch3 T e-smith-radiusd.spec T import.log T sources Tagged with: e-smith-radiusd-2_4_0-8_el6_sme
[xyz@buildxxxx sme9]$ make build /usr/bin/plague-client build e-smith-radiusd e-smith-radiusd-2_4_0-8_el6_sme sme9 Package e-smith-radiusd enqueued. Job ID: 3026.
3026 e-smith-radiusd e-smith-radiusd-2_4_0-8_el6_sme building smeserver-9-core devlist burnat com
-------- Original Message -------- Subject: [updatesteam] Build Result: 3026 - e-smith-radiusd on smeserver-9-core Date: Sat, 20 Apr 2013 23:22:52 -0600 (MDT) From: buildsys@contribs.org To: updatesteam@lists.contribs.org 3026 (e-smith-radiusd): Build on target smeserver-9-core succeeded. Build logs may be found at http://buildsys.contribs.org/logs/smeserver-9-core/3026-e-smith-radiusd-2.4.0-8.el6.sme/
- Check package on BUILDSYS
xyz@canxxx:~$ ssh -l xxxxxx shell.contribs.org Last login: Wed Apr 10 16:10:50 2013 from mail.burnat.xxx
ll /teams/smeserver/9/test
ADDING SUPPLIED PATCH TO PACKAGE OR PORTING FROM ONE VERSION TO ANOTHER
General instructions
One bug, two packages are affected, so two patches. Put same Bug number reference into the changelog of each package, and all is OK. As that is a SME 8 bug then I expect it does need to be cloned to SME 9 and also fixed there
apply the patches to the two packages, build locally, and test. If looking good then commit to CVS and push to main buildserver
Ian Wells: If only a patch is provided then the spec file needs to be updated, the patch added to CVS, [I find that it is good to do a 'make prep' and see if the patch is OK]then make the package locally, does it build and does it appear to work, then 'make commit tag build'.
You don't need to create a patch as the ones in the bug are correct unified patches, they just need to be save to some relevant name. Then modify the spec file: update the release number, add a PatchXX line, add a changelog entry, add a %patch line Nothing needs to be committed to CVS - all this happens locally to you at this point Then make mockbuild
Q:then I can build locally and test, correct? No need to make the changes in direstories ect, the patch provided by Dani will do the deed? Yes if your 'test RPM' from make mockbuild looks OK, then you do cvs add XYZ.patch and then make commit tag build Ian Wells: Just as usual
Bug 7541
Bug 7541 - spamassassin qpsmtpd's plugin size limit is hardcoded [sme8]
Patch for qpsmtpd supplied qpsmtpd allows the spamassassin plugin to read the size limit from its arguments
Patch for smeserver-qpsmtpd supplied smeserver-qpsmtpd reads MaxMessageSize prop of spamassassin and adds it to the arguments of the plugin if defined.
[xyz@buildxxxx work]$ pwd /home/xyz/work [xyz@buildxxxx work]$ ls -la total 16 drwxrwxr-x 4 xyz xyz 4096 Apr 23 13:15 . drwx------ 8 xyz xyz 4096 Apr 3 17:01 .. drwxrwxr-x 7 xyz xyz 4096 Apr 23 13:15 qpsmtpd drwxrwxr-x 7 xyz xyz 4096 Apr 23 13:15 smeserver-qpsmtpd
- Get package from CVS
[xyz@buildxxxx work]$ cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P qpsmtpd [xyz@buildxxxx work]$ cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P smeserver-qpsmtpd
[xyz@buildxxxx work]$ ls qpsmtpd smeserver-qpsmtpd
- SAVE PATCHES ON WORKSTATION AND COPY TO LOCAL BUILD SERVER
xyz@caxxxx:~/exchange$ ls -la -rw-rw-r-- 1 xyz xyz 610 2013-04-23 13:29 qpsmtpd-0.84-spamassassin_size_limit.patch -rw-rw-r-- 1 xyz xyz 811 2013-04-23 13:30 smeserver-qpsmtpd-2.2.0-spamassassin_size_limit.patch
xyz@canoxxxx:~/exchange$ scp -P 22 qpsmtpd-0.84-spamassassin_size_limit.patch xyz\@192.168.0.12:/home/xyz/exchange xyz@canxxxx:~/exchange$ scp -P 22 smeserver-qpsmtpd-2.2.0-spamassassin_size_limit.patch xyz\@192.168.0.12:/home/xyz/exchange
- OR COPY PATCH FROM SOURCE (sme8)
cp e-smith-proxy-5.2.0-squid_additionnal_SSLports.patch /home/xyz/work/e-smith-proxy/sme9/e-smith-proxy-5.4.0-squid_additionnal_SSLports.patch
- Process qpsmtpd on local BUILD
[xyz@buildxxxx work]$ cd qpsmtpd/ [xyz@buildxxxx qpsmtpd]$ ls common CVS sme7 sme8 sme9 [xyz@buildxxxx qpsmtpd]$ cvs update -dPA
last patch:
0038-Patch-FATAL-PLUGIN-ERROR-check_basicheaders.patch
[xyz@buildxxxx sme8]$ pwd /home/xyz/work/qpsmtpd/sme8
[xyz@buildxxxx sme8]$ pushd ~/exchange/ ~/exchange ~/work/qpsmtpd/sme8 [xyz@buildxxxx exchange]$ ls qpsmtpd-0.84-spamassassin_size_limit.patch smeserver-qpsmtpd-2.2.0-spamassassin_size_limit.patch
[xyz@buildxxxx exchange]$ cp qpsmtpd-0.84-spamassassin_size_limit.patch /home/xyz/work/qpsmtpd/sme8/0039-qpsmtpd-0.84-spamassassin_size_limit.patch [xyz@buildxxxx exchange]$ popd ~/work/qpsmtpd/sme8
- Check patch:
Ian Wells: Yes, if you do that it is good to try a 'make prep' that will tell you if the patch from sme8 applied cleanly to sme9. It's quicker than a full build
- Modify the spec file: update the release number, add a PatchXX line, add a changelog entry, add a %patch line
[xyz@buildxxxx sme8]$ nano qpsmtpd.spec Version: 0.84 [same] Release: 4%{?dist} Patch39: 0039-qpsmtpd-0.84-spamassassin_size_limit.patch %patch39 -p1
[Fixed in qpsmtpd]
%changelog * Tue Apr 23 2013 xyz burnat <devlist@burnat.com> 0.84-4.sme - qpsmtpd allows the spamassassin plugin to read the size limit from its arguments, patch by Daniel [SME: 7541] * Fri May 04 2012 Charlie Brady <charlie_brady@mitel.com> 0.84-3.sme - Set SO_KEEPALIVE option on client socket - to detect dead connections. [SME: 6924]
- Check changes against CVS
[xyz@buildxxxx sme8]$ cvs diff -u qpsmtpd.spec Index: qpsmtpd.spec RCS file: /cvsroot/smeserver/rpms/qpsmtpd/sme8/qpsmtpd.spec,v retrieving revision 1.31 diff -r1.31 qpsmtpd.spec 5c5 < Release: 3%{?dist} --- > Release: 4%{?dist} 62a63 > Patch39: 0039-qpsmtpd-0.84-spamassassin_size_limit.patch 135a137 > %patch39 -p1 234a237,240 > * Tue Apr 23 2013 xyz burnat <devlist@burnat.com> 0.84-4.sme > - qpsmtpd allows the spamassassin plugin to read the size limit > from its arguments, patch by Daniel [SME: 7541
- Build locally:
[xyz@buildxxxx sme8]$ BUILDARCH=i386 make mockbuild INFO: Done(/home/xyz/work/qpsmtpd/sme8/qpsmtpd-0.84-4.el5.sme.src.rpm) Config(smeserver-8-i386-base) 2 minutes 52 seconds INFO: Results and/or logs in: /home/xyz/work/qpsmtpd/sme8/qpsmtpd-0_84-4_el5_sme INFO: Cleaning up build root ('clean_on_success=True') Start: lock buildroot Start: clean chroot INFO: chroot (/var/lib/mock/smeserver-8-i386) unlocked and deleted Finish: clean chroot Finish: lock buildroot Finish: run
- Check packages
[xyz@buildxxxx qpsmtpd-0_84-4_el5_sme]$ ls -lah total 1.2M drwxrwxr-x 2 xyz xyz 4.0K Apr 23 14:44 . drwxrwxr-x 4 xyz xyz 4.0K Apr 23 14:41 .. -rw-rw-r-- 1 root root 616K Apr 23 14:43 available_pkgs -rw-rw-r-- 1 xyz xyz 27K Apr 23 14:44 build.log -rw-rw-r-- 1 xyz mock 11K Apr 23 14:44 installed_pkgs -rw-rw-r-- 1 xyz mock 187K Apr 23 14:44 qpsmtpd-0.84-4.el5.sme.noarch.rpm -rw-rw-r-- 1 xyz mock 236K Apr 23 14:44 qpsmtpd-0.84-4.el5.sme.src.rpm -rw-rw-r-- 1 xyz mock 16K Apr 23 14:44 qpsmtpd-apache-0.84-4.el5.sme.noarch.rpm -rw-rw-r-- 1 xyz mock 33K Apr 23 14:44 qpsmtpd-async-0.84-4.el5.sme.noarch.rpm -rw-rw-r-- 1 xyz xyz 67K Apr 23 14:44 root.log -rw-rw-r-- 1 xyz xyz 2.1K Apr 23 14:44 state.log
- Copy new packages to local folder:
cp qpsmtpd-0.84-4.el5.sme.noarch.rpm qpsmtpd-apache-0.84-4.el5.sme.noarch.rpm qpsmtpd-async-0.84-4.el5.sme.noarch.rpm ~/exchange/
- Send new package and patch to workstation for testing/processing:
[xyz@buildxxxx exchange]$ scp -P 22 qpsmtpd-0.84-4.el5.sme.noarch.rpm xyz\@192.168.0.1:/home/xyz/WIP [xyz@buildxxxx exchange]$ scp -P 22 qpsmtpd-apache-0.84-4.el5.sme.noarch.rpm xyz\@192.168.0.1:/home/xyz/WIP [xyz@buildxxxx exchange]$ scp -P 22 qpsmtpd-async-0.84-4.el5.sme.noarch.rpm xyz\@192.168.0.1:/home/xyz/WIP
- Move to workstation and copy packages to sme8 test-server (32 bits):
[root@test80 files]# ls -la -rwxrw-r-- 1 admin shared 191004 Apr 23 14:55 qpsmtpd-0.84-4.el5.sme.noarch.rpm -rwxrw-r-- 1 admin shared 16121 Apr 23 14:55 qpsmtpd-apache-0.84-4.el5.sme.noarch.rpm -rwxrw-r-- 1 admin shared 33212 Apr 23 14:56 qpsmtpd-async-0.84-4.el5.sme.noarch.rpm [root@test80 files]# rpm -qa qpsmtpd-0.84-4.el5.sme.noarch.rpm [root@test80 files]# rpm -qa | grep qpsmtpd qpsmtpd-0.84-3.el5.sme qpsmtpd-plugins-0.0.1-3.el5.sme smeserver-qpsmtpd-2.2.0-15.el5.sme
- Install package:
[root@test80 files]# yum localinstall qpsmtpd-0.84-4.el5.sme.noarch.rpm Updated: qpsmtpd.noarch 0:0.84-4.el5.sme [root@test80 files]# signal-event post-upgrade; signal-event reboot
- Test mail:
-------- Original Message -------- Subject: Re: Fwd: Updates available for test80 Date: Tue, 23 Apr 2013 15:21:57 +1000 From: xyz burnat <cbxxxx@bxxxx.com> Reply-To: cbxxxx@bxxxx.com To: root <admin@schxxxxx.com> thanks On 23/04/13 15:20, root wrote: > > > > -------- Original Message -------- > Subject: Updates available for test80 > Date: 11 Apr 2013 19:01:47 -0000 > From: root@schtrumpf.com > To: admin-yum@schtrumpf.com > > > > === > === yum reports available updates:
- OK, we can push this package.
[cvs add XYZ.patch and then make commit tag build]
NOTE: Multiple patches: Ian Wells: yes you will need to 'cvs add XYZ.patch' for all the patches, you can actually do cvs add *.patch and it will work it out
[xyz@buildxxxx sme8]$ cvs add 0039-qpsmtpd-0.84-spamassassin_size_limit.patch cvs add: scheduling file `0039-qpsmtpd-0.84-spamassassin_size_limit.patch' for addition cvs add: use 'cvs commit' to add this file permanently
[xyz@buildxxxx sme8]$ make commit tag build
[snip]
/usr/bin/plague-client build qpsmtpd qpsmtpd-0_84-4_el5_sme sme8 Package qpsmtpd enqueued. Job ID: 3033.
- Check for Build:
http://buildsys.contribs.org/plague/ 3033 qpsmtpd qpsmtpd-0_84-4_el5_sme building smeserver-8-core devlist burnat com
- Check for emails received from buildsys@contribs.org
-------- Original Message -------- Subject: rpms/qpsmtpd/sme8 0039-qpsmtpd-0.84-spamassassin_size_limit.patch, NONE, 1.1 qpsmtpd.spec, 1.31, 1.32 Date: Tue, 23 Apr 2013 05:30:08 +0000 From: xxxxxxx <xxxxx@users.sourceforge.net> To: smeserver-cvscommits@lists.sourceforge.net
[ok]
PORTING FROM SME8 TO SME9 - CAUTION
15:51:38] … Hopefully the patch applies cleanly to SME9 [15:51:57] Ian Wells: I find that it is good to do a 'make prep' and see if the patch is OK [15:52:04] Ian Wells: Then do a make mockbuild [15:52:45] xyz burnat: ahhhh Too late, I started the local build, can I do make prep after to check? [15:53:13] Ian Wells: If the local build works then no worry [15:53:32] xyz burnat: OK, so either do a make prep or do a local build, yes? [15:53:40] Ian Wells: Yes [15:54:11] Ian Wells: Often when using a SME8 patch on SME9 it fails due to a minor issue, eg linenumbers [15:54:46] Ian Wells: make prep tells you that quicker than make mockbuild and also it shows the problem in the shell rather than having to find the log file [15:54:55] Ian Wells: However both work.
FIXING ERRORS IN SPEC FILES
Last one you will have to teach me is how to fix missing bug reference or spelling errors in spec file of packages already build
[12:13:40 PM] Ian Wells: Those are in the spec files [12:13:52 PM] Ian Wells: So... [12:14:19 PM] Ian Wells: cvs update -dPA to get the latest for that package [12:14:33 PM] Ian Wells: then edit the .spec file in your favourite editor [12:15:08 PM] Ian Wells: then cvs commit -m <-- your description, eg correct spelling [12:15:23 PM] Ian Wells: You don't build anything, just commit to CVS [12:15:33 PM] Ian Wells: The next build will then publish your change [12:16:29 PM] Ian Wells: If very important you can force a build, but that needs the version updated and a changelog added to indicate why. [12:16:52 PM] xyz burnat: Great, I understand. Many thanks, We are getting somewhere on all fronts.
EXAMPLE:
* Thu Apr 25 2013 xyz burnat <devlist@burnat.com> 0.84.5.sme - Fix Net::DNS update breaks qpsmtpd, codes suggested by Ian [SME: 7557]
Should be:
* Thu Apr 25 2013 xyz burnat <devlist@burnat.com> 0.84.5.sme - Fix Net::DNS update breaks qpsmtpd, codes suggested by Ian [SME: 7194]
[xyz@buildxxxx work]$ pwd /home/xyz/work
[xyz@buildxxxx work]$ cvs -z3 -d:ext:smeserver.cvs.sourceforge.net:/cvsroot/smeserver co -P qpsmtpd
- Update
[xyz@buildxxxx work]$ cd qpsmtpd/ [xyz@buildxxxx qpsmtpd]$ ls common CVS sme7 sme8 sme9 [xyz@buildxxxx qpsmtpd]$ cvs update -dPA cvs update: Updating . cvs update: Updating common cvs update: Updating sme7 cvs update: Updating sme8 cvs update: Updating sme9
- Update spec file
[xyz@buildxxxx sme8]$ nano qpsmtpd.spec %changelog * Thu Apr 25 2013 xyz burnat <devlist@burnat.com> 0.84.5.sme - Fix Net::DNS update breaks qpsmtpd, codes suggested by Ian [SME: 7194]
- Check changes against CVS
[xyz@buildxxxx sme8]$ cvs diff -u qpsmtpd.spec Index: qpsmtpd.spec RCS file: /cvsroot/smeserver/rpms/qpsmtpd/sme8/qpsmtpd.spec,v retrieving revision 1.33 diff -r1.33 qpsmtpd.spec 240c240 < - Fix Net::DNS update breaks qpsmtpd, codes suggested by Ian [SME: 7557] --- > - Fix Net::DNS update breaks qpsmtpd, codes suggested by Ian [SME: 7194]
- Commit
[xyz@buildxxxx sme8]$ cvs commit -m 'correct Bug Reference' cvs commit: Examining . Checking in qpsmtpd.spec; /cvsroot/smeserver/rpms/qpsmtpd/sme8/qpsmtpd.spec,v <-- qpsmtpd.spec new revision: 1.34; previous revision: 1.33 done Mailing smeserver-cvscommits@lists.sourceforge.net... Generating notification message... Generating notification message... done.
- Notification
-------- Original Message -------- Subject: rpms/qpsmtpd/sme8 qpsmtpd.spec,1.33,1.34 Date: Thu, 25 Apr 2013 02:16:36 +0000 From: xxxxxxxxxxxx <xxxxxx@users.sourceforge.net> To: smeserver-cvscommits@lists.sourceforge.net Update of /cvsroot/smeserver/rpms/qpsmtpd/sme8 In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13622 Modified Files:
qpsmtpd.spec
Log Message: correct Bug Reference Index: qpsmtpd.spec =================================================================== RCS file: /cvsroot/smeserver/rpms/qpsmtpd/sme8/qpsmtpd.spec,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- qpsmtpd.spec 25 Apr 2013 01:54:19 -0000 1.33 +++ qpsmtpd.spec 25 Apr 2013 02:16:34 -0000 1.34 @@ -237,7 +237,7 @@ %changelog * Thu Apr 25 2013 xyz burnat <devlist@burnat.com> 0.84.5.sme -- Fix Net::DNS update breaks qpsmtpd, codes suggested by Ian [SME: 7557] +- Fix Net::DNS update breaks qpsmtpd, codes suggested by Ian [SME: 7194] * Tue Apr 23 2013 xyz burnat <devlist@burnat.com> 0.84-4.sme - qpsmtpd allows the spamassassin plugin to read the size limit
REVERSE CHANGES MADE PREVIOUSLY
- Edit specfile as usual, except you delete patch references as applicable.
- leave patch in place.
- Then:
cvs commit -m 'description of change'
- Then:
make commit tag build
Note: avoid commenting lines, delete instead if confident...
PATCHING AN UPSTREAM PACKAGE
initscripts is an example of a package where we have to patch the upstream package.
Here it is a 3-step process, Analysis, Integration, buildsys update. The majority of the work is in steps 1 & 2 where there needs to be an analysis of what has changed, and then an integration stage where you need to check that the patches still work, update CVS with new and modified files etc. Finally the new source needs updating into the buildsys before the official build will work.
initscripts-8.45.44-3.el5.centos.src.rpm
Steps to update initscripts
Step 1: Analysis, by anyone
- Check the contents of the SRPMs
$ rpm -qlp initscripts-8.45.44-3.el5.centos.src.rpm 0001-Fix-comments-in-sysctl.conf.ppc-862597.patch 0002-create-tmp-.X11-unix-in-rc.sysinit.patch initscripts-8.45.44.tar.bz2 initscripts-centos-branding.patch initscripts.spec
$ rpm -qlp initscripts-8.45.42-2.1.el5.sme.src.rpm 0002-create-tmp-.X11-unix-in-rc.sysinit.patch initscripts-8.45.38-smepatches.patch initscripts-8.45.42-kpartx.patch initscripts-8.45.42.tar.bz2 initscripts-centos-branding.patch initscripts.spec
- Check what is different (do a directory compare)
- Identical
initscripts-centos-branding.patch (content is identical, although files are not)
- Modified
initscripts.spec 0002-create-tmp-.X11-unix-in-rc.sysinit.patch (patch is identical but line numbers changed)
- New
initscripts-8.45.44.tar.bz2 (New source will need to be added to buildsys) 0001-Fix-comments-in-sysctl.conf.ppc-862597.patch (will be added to CVS)
- Obsolete
initscripts-8.45.42-kpartx.patch (can be removed from CVS) initscripts-8.45.42.tar.bz2
- Not in upstream SRPM as this is an SME Server patch to be applied each time
initscripts-8.45.38-smepatches.patch
So we need the new initscripts-8.45.44.tar.bz2 & 0001-Fix-comments-in-sysctl.conf.ppc-862597.patch, and the updated 0002-create-tmp-.X11-unix-in-rc.sysinit.patch
Step 2: Integration : local mock build, can be done by a developer
- Remove the obsolete files
- Update the spec file.
Version Release Patches Check the description, don't copy the 'Centos' wording to the SME package Copy the latest upstream Changelog Add/modify the changelog regarding SME patches
- Copy the new patch & source to the local directory
- Check that the patches apply cleanly (You don't want to see lines like Hunk #1 succeeded at 890 (offset 1 line).)
make prep
- Try to build it
make mockbuild
- Once it builds cleanly on local mock, commit the changes to CVS. Note that you cannot submit the build yet as it will fail due to the new source.
make commit
Step 3: Buildsys access and permissions needed
Then add new sources to buildsys ON BUILDSYS
If the above step has already been done then can update to latest in CVS, and retrieve the source tarball.
- get date for import
$ date +%s 1382918459
- fix name/version/release and date in the import.log (I don't have a good explanation for this)
vi import.log*
- import the new source/tarball
make new-sources FILES=*bz2
- Finally commit changes to CVS and build it.
make commit tag build
MOVE FILES AROUND
- SEND TO UBUNTU W/S:
[xyz@buildxxxx sme8]$ scp -P 22 smeserver-yum-2.2.0-21.el5.sme.src.rpm xyz\@192.168.xxx.1:/home/xyz/WIP The authenticity of host '192.168.xxx.1 (192.168.xxx.1)' can't be established. RSA key fingerprint is 63:41:79:2b:1f:1f:37:db:80:0d:6e:4d:9b:4a:86:96. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.xxx.1' (RSA) to the list of known hosts. xyz@192.168.xxx.1's password: smeserver-yum-2.2.0-21.el5.sme.src.rpm 100% 85KB 84.7KB/s 00:00
- GET FROM UBUNTU W/S
xyz@canxxxx:~/exchange$ scp -P 22 smeserver-yum-2.2.0-21.el5.sme.src.rpm xyz\@192.168.xxx.12:/home/xyz/exchange xyz@192.168.xxx.12's password: smeserver-yum-2.2.0-21.el5.sme.src.rpm 100% 85KB 84.7KB/s 00:00
USING MOCK
- Known problems
Every once in a while mock doesn't setup the chroot correctly. This appears to be one of those cases. There are times when the repos that it is trying to pull packages from are being updated and can cause issues.
If the build.log doesn't look like it tried to build anything and root.log doesn't say that it can't find dependencies then you should be able to try the build again a few minutes/hours later and see if it works.
The way you build for i386 on a x86_64 box using our makefile is to do the following:
BUILDARCH=i386 make mockbuild
This works for everything except for kernel modules on SME <= 8.0. I'll have to go through my notes for how to build kmods for i686 kernel using i386 config file. These happen rarely enough that I ususally just submit to the buildsys and then fix issues if there are any.
Perform a Build from an SRPM retrieved from the repos
Perform a Build for sme9 64 bits from an SRPM
- Retrieve SRPM from repos:
[xyz@buildxxxx SRPMS]$ wget http://mirror.canada.pialasse.com/releases/testing/9.0alpha3/smetest/SRPMS/perl-CGI-FormMagick-0.93-2.el6.sme.src.rpm
- Select chroot environment:
[xyz@buildxxxx SRPMS]$ CONFIG=smeserver-9-x86_64-base
- Build package:
[xyz@buildxxxx SRPMS]$ mock -r $CONFIG --rebuild ~/rpmbuild/SRPMS/perl-CGI-FormMagick-0.93-2.el6.sme.src.rpm
- Check output:
[xyz@buildxxxx SRPMS]$ ll /var/lib/mock/smeserver-9-x86_64/result total 248 -rw-rw-r-- 1 xyz mock 14924 Apr 1 08:50 build.log -rw-rw-r-- 1 xyz mock 113480 Apr 1 08:50 perl-CGI-FormMagick-0.93-2.el6.sme.noarch.rpm -rw-rw-r-- 1 xyz mock 90524 Apr 1 08:50 perl-CGI-FormMagick-0.93-2.el6.sme.src.rpm -rw-rw-r-- 1 xyz mock 23316 Apr 1 08:50 root.log -rw-rw-r-- 1 xyz mock 1224 Apr 1 08:50 state.log
Perform a Build for sme9 32 bits from an SRPM
[xyz@buildxxxx SRPMS]$ CONFIG=smeserver-9-i386-base
Perform a Build for sme8 64 bits from an SRPM
[xyz@buildxxxx SRPMS]$ wget http://mirror.canada.pialasse.com/releases/8.0/smeupdates-testing/SRPMS/perl-CGI-FormMagick-0.92-23.el5.sme.src.rpm [xyz@buildxxxx SRPMS]$ CONFIG=smeserver-8-x86_64-base
Perform a Build for sme8 32 bits from an SRPM
[xyz@buildxxxx SRPMS]$ CONFIG=smeserver-8-i386-base
If the build succeeds, it drops your packages into the /var/lib/mock/$CONFIG/result directory. If it fails, you can check mock output, the *.log files above for more info, and/or rerun mock with the -v flag for more verbose messaging. If you get "warning: Could not canonicalize hostname: " it can be ignored. This is a DNS resolution error and the easy solution is to add your hostname to /etc/hosts