Difference between revisions of "Package Import"

From SME Server
Jump to navigationJump to search
(Created page with "{{Languages|:Package_Modification}} {{Level|Developer}} ==Importing Packages to buildsys== This document describes how to import new packages to buildsys. You will need Dev...")
(No difference)

Revision as of 22:12, 18 November 2018


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

After it is done you should find a new folder for

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

Also you should find your contrib listed in module file ~/smecontribs/CVSROOT/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 (ssh YOURUSER@buildsrv.koozali.org)

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)"

Tag

make tag

Build

make build

And done

tar.gz

How to import from a tar.gz

Create a srpm file

The import as above


[[Category:SME9-Development]