Difference between revisions of "Package Import"

From SME Server
Jump to navigationJump to search
 
(3 intermediate revisions by the same user not shown)
Line 128: Line 128:
 
  ~/smecontribs/rpms/smeserver-mycontrib/contribs9/
 
  ~/smecontribs/rpms/smeserver-mycontrib/contribs9/
  
Also you should find your contrib listed in module file ~/smecontribs/CVSROOT/modules
+
Remember to add your module so buildsys knows about it:
 +
 
 +
~/smecontribs/CVSROOT/modules
 +
 
 +
Add a line like this:
 +
 
 +
smeserver-mycontrib rpms/smeserver-mycontrib &common
 +
 
 +
Then commit it
 +
 
 +
cvs commit -m "add smeserver-mycontrib to modules"
  
 
As listed after the script you should send your srpm to the buildserver, one way is  (replace ~/MYSRPM and YOURUSER)
 
As listed after the script you should send your srpm to the buildserver, one way is  (replace ~/MYSRPM and YOURUSER)
Line 172: Line 182:
  
 
  rm -f clog
 
  rm -f clog
 +
cvs commit -m "$(make clog)"
 +
 +
I found if I did this I got an error:
 +
 +
cvs commit: file 'import.log' had a conflict and has not been modified
 +
cvs [commit aborted]: correct above errors first!
 +
 +
I did this to clear it IN THE DIRECTORY:
 +
 +
rm -rf *
 +
cd ..
 +
cvs update -dPA
 +
cd contribs10
 
  cvs commit -m "$(make clog)"
 
  cvs commit -m "$(make clog)"
  
Line 190: Line 213:
 
Create a srpm file
 
Create a srpm file
  
The import as above
+
Then import as above.
 
 
  
  
<noinclude>[[Category:SME9-Development]
+
[[Category:SME9-Development]]

Latest revision as of 01:52, 8 December 2021


PythonIcon.png Skill level: Developer
Risk of inconsistencies with Koozali SME Server methodology, upgrades & functionality is high. One must be knowledgeable about how changes impact their Koozali SME Server. Significant risk of irreversible harm.


Importing Packages to buildsys

This document describes how to import new packages to buildsys.

You will need Developer access to buildsys for this.

Shell login with ssh

It may benefit you to add an entry in your .ssh/config file like this:

host koozalishell
   Hostname  shell.koozali.org
   User  youruser
   Port xxx
   IdentityFile ~/.ssh/id_rsa_buildsys
   ForwardAgent yes

You can then shell in easily with

ssh koozalishell

You can also modify the relevant sections in the script below.

SRPMS

How to import a SRPM

Importing new srpm or tgz + spec file to buildsys.

On your LOCAL build machine

It is assumed you have CVS in two directories in you home directory

~/smecontribs
~/smeserver

First copy this into a file called ~/bin/importNewContrib

Note this is for Contrib packages. You can modify the script for Server packages by changing references from 'contribs' to 'server' and 'contribs$ver' to 'sme$ver'

#!/bin/bash

if [ $# -eq 0 ]
  then
    echo "No arguments supplied"
fi
if [ $# -lt 2 ]
  then
    echo "Usage:
    importNewContrib version pkgname [rpmpath]
    # e.g. importNewContrib 9 smeserver-newcontrib
    # e.g. importNewContrib 10 smeserver-mycontrib ~/smeserver-mycontribs-1.0-1.src.rpm"
    exit
fi

ver=$1
pkgname=$2
rpmpath=$3

cd ~/smecontribs/rpms
cvs -Q update -dPA 1>/dev/null
cd ~/smecontribs
cvs -Q -z3 -d:ext:YOURUSER@buildsrv.koozali.org:/cvsroot/smecontribs co -P rpms 1>/dev/null
# Alternatively if you have a .ssh/config entry as above
# cvs -Q -z3 -d:ext:koozalishell:/cvsroot/smecontribs co -P rpms 1>/dev/null


newmodule=true;
# better test would be to actually grep module file!
if [ -d ~/smecontribs/rpms/$pkgname ]
then
echo "Os package exists already"
newmodule=false;
fi

cd ~/smecontribs/rpms

mkdir -p $pkgname/contribs$ver
touch $pkgname/contribs$ver/.cvsignore
touch $pkgname/contribs$ver/import.log
cvs add $pkgname
cvs add $pkgname/contribs$ver
cvs add $pkgname/contribs$ver/.cvsignore
cvs add $pkgname/contribs$ver/import.log

cvs commit -m "Prep for $pkgname import"

if ( $newmodule )
then
        cd ~/smecontribs/CVSROOT
        cvs -Q update -dPA 1>/dev/null
        echo "$pkgname     rpms/$pkgname &common" >> modules
        linenumb=`cat modules |grep -n "#Start Auto-Maintenance" | grep -Eo '^[^:]+'`
        # "#Start Auto-Maintenance"
        #(head -n $linenumb; sort -nk$linenumb) < sample.txt 1<> sample.txt
        (head -n $linenumb; sort) < modules 1<> modules
        #echo "cvs commit -m \"adding $pkgname to modules\""
        cvs commit -m "adding $pkgname to modules"
fi

echo "##########################"
echo "do:"
echo "scp $rpmpath YOURUSER@buildsrv.koozali.org:/home/KOOZALI/YOURUSER/"
echo "now just do from buildsrv"
echo "cd ~/smecontribs"
echo "./common/cvs-import.sh -b contribs$ver -m 'Initial import' ../$rpmpath"

Set the file executable

chmod +x ~/bin/importNewContrib

From there do

importNewContrib 9 smeserver-mycontrib

Or

importNewContrib 9 smeserver-mycontrib ~/smeserver-mycontribs-1.0-1.src.rpm"

After it is done you should find a new folder for

~/smecontribs/rpms/smeserver-mycontrib/contribs9/

Remember to add your module so buildsys knows about it:

~/smecontribs/CVSROOT/modules

Add a line like this:

smeserver-mycontrib		rpms/smeserver-mycontrib &common

Then commit it

cvs commit -m "add smeserver-mycontrib to modules"

As listed after the script you should send your srpm to the buildserver, one way is (replace ~/MYSRPM and YOURUSER)

scp ~/MYSRPM  YOURUSER@buildsrv.koozali.org:/home/KOOZALI/YOURUSER/

Alternatively if set up

scp ~/MYSRPM  koozalishell:/home/KOOZALI/YOURUSER/

On THE KOOZALI BUILD SERVER

Shell in to buildsys

ssh YOURUSER@buildsrv.koozali.org

Or

ssh koozalishell

Now

cd ~/smecontribs
./common/cvs-import.sh -b contribs$ver -m 'Initial import' ~/MYSRPM

And you are done importing !

On your local build machine

Go to directory and update the content from cvs and buildserver source

cd ~/smecontribs/rpms/smeserver-mycontrib/contribs9/
cvs update -dPA
make clean
make prep
make mockbuild

Edit your spec file in case you need it...

vim smeserver-mycontrib.spec

And commit

rm -f clog
cvs commit -m "$(make clog)"

I found if I did this I got an error:

cvs commit: file 'import.log' had a conflict and has not been modified
cvs [commit aborted]: correct above errors first!

I did this to clear it IN THE DIRECTORY:

rm -rf *
cd ..
cvs update -dPA
cd contribs10
cvs commit -m "$(make clog)"

Tag

make tag

Build

make build

And done

tar.gz

How to import from a tar.gz

Create a srpm file

Then import as above.