diff -Nur smeserver-mock-1.0.old/root/usr/bin/change-log smeserver-mock-1.0/root/usr/bin/change-log --- smeserver-mock-1.0.old/root/usr/bin/change-log 2018-03-10 23:38:48.000000000 -0500 +++ smeserver-mock-1.0/root/usr/bin/change-log 2020-05-19 00:09:55.749000000 -0400 @@ -22,7 +22,7 @@ rele=0; release=`cat $specfile|egrep '^%define (main_)?release'|cut -d " " -f3|cut -d% -f1`; if [[ ! $release ]]; then - release=`cat $specfile|egrep '^Release:'|cut -d " " -f2|cut -d% -f1`; + release=`cat $specfile|egrep '^Release:'|cut -d ":" -f2| tr -d "[:space:]"|cut -d% -f1`; rele=1; fi @@ -31,7 +31,7 @@ #Version: 23 version=`cat $specfile|grep -i '%define version'|cut -d " " -f3|cut -d% -f1`; if [[ ! $version ]]; then - version=`cat $specfile|egrep '^Version:'|cut -d " " -f2|cut -d% -f1`; + version=`cat $specfile|egrep '^Version:'|cut -d ":" -f2| tr -d "[:space:]"`; fi diff -Nur smeserver-mock-1.0.old/root/usr/bin/cleantree smeserver-mock-1.0/root/usr/bin/cleantree --- smeserver-mock-1.0.old/root/usr/bin/cleantree 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-mock-1.0/root/usr/bin/cleantree 2020-05-19 00:08:22.509000000 -0400 @@ -0,0 +1,13 @@ +#!/bin/sh + +#find . -regex .*patch|cut -f2 -d/>~filetoremove + +for f in `find . -regex .*patch |cut -f2 -d/` +do + echo "Processing $f" + # do something on $f + rm -f $f + cvs remove $f +done + +cvs commit -m "cleaning tree from patchs" diff -Nur smeserver-mock-1.0.old/root/usr/bin/importNew smeserver-mock-1.0/root/usr/bin/importNew --- smeserver-mock-1.0.old/root/usr/bin/importNew 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-mock-1.0/root/usr/bin/importNew 2020-05-19 00:08:22.516000000 -0400 @@ -0,0 +1,211 @@ +#!/bin/bash + +if [ $# -eq 0 ] + then + echo "No arguments supplied" +fi +if [ $# -lt 3 ] + then + echo "Usage: +importNew type version pkgname [rpmpath] +examples: +# importNew contribs 10 smeserver-mycontrib [~/smeserver-mycontribs-1.0-1.src.rpm] +# importNew sme 10 smeserver-package [~/smeserver-package-1.0-1.src.rpm] +This script is intended to create a new tree, if needed,and a new branch to import a provided srpm. +It will then run cvs-import.sh script for you if you provided a srpm location. If not provided you can populate the branch +with what you want. If you only intend to copy the content of a branch to another, you might search for newbranch script. + +" + exit +fi + +sme=$1 +if [[ "$sme" != "sme" && "$sme" != "contribs" ]] +then + echo "wrong first parameter should be either 'sme' or 'contribs'" + exit +fi +re='^[0-9]+$' +if ! [[ $2 =~ $re ]] ; then + echo "Error: Second argument should be a version number (e.g.: 10) for the branch ((e.g.: contribs10) where you want to put the SRPM content if provided." >&2; exit 1 +fi +ver=$2 +pkgname=$3 +rpmpath=$4 +curpwd=`pwd` +packageroot='smecontribs' +CVSROOT=":ext:shell.koozali.org:/cvs/smecontribs" +if [[ "$sme" == "sme" ]] +then + packageroot='smeserver' + CVSROOT=":ext:shell.koozali.org:/cvs/smeserver" +fi + + +#this one is directly from commons/Makefile.common +CreateBranchMakefile() { + cat >Makefile <&2 +endef + +MAKEFILE_COMMON := \$(shell \$(checkout-makefile-common)) +endif + +include \$(MAKEFILE_COMMON) +EOF +} + + + +# update modules files +cd ~/$packageroot/CVSROOT +cvs -Q update -dPA 1>/dev/null +if [ -d ~/$packageroot/rpms ] + then + # update current tree + cd ~/$packageroot/rpms + cvs -Q update -dPA 1>/dev/null +else + # checkout rpms + cd ~/$packageroot + cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P rpms 1>/dev/null +fi + + +newmodule=true; +# better test would be to actually grep module file! +#if [ -d ~/$packageroot/rpms/$pkgname ] +cd ~/$packageroot/CVSROOT +cvs -Q update -dPA 1>/dev/null +grep -Eq "^$pkgname\s+rpms/$pkgnames.*" ~/$packageroot/CVSROOT/modules +if (( $? == 0 )) +then + echo "package exists already" + newmodule=false; +fi +change=0 +cd ~/$packageroot/rpms +#if [ -d ~/$packageroot/rpms/$pkgname ] +if ( cvs status -l $pkgname 2>/dev/null|grep -q 'Unknown' ) +then + echo "creating $pkgname tree ..." + mkdir -p $pkgname + cvs add $pkgname + change=1 +fi +#if [ -d ~/$packageroot/rpms/$pkgname/$sme$ver ] +if ( cvs status -l $pkgname/$sme$ver 2>/dev/null|grep -q 'Unknown' ) +then + echo "creating $pkgname/$sme$ver branch with content..." + mkdir -p $pkgname/$sme$ver + cvs add $pkgname/$sme$ver + change=1 +fi +#if [ -f ~/$packageroot/rpms/$pkgname/$sme$ver/.cvsignore ] +if ( cvs status $pkgname/$sme$ver/.cvsignore 2>/dev/null|grep -q 'Unknown' ) +then + touch $pkgname/$sme$ver/.cvsignore + cvs add $pkgname/$sme$ver/.cvsignore + change=1 +fi +#if [ -f ~/$packageroot/rpms/$pkgname/$sme$ver/import.log ] +if ( cvs status $pkgname/$sme$ver/import.log 2>/dev/null|grep -q 'Unknown' ) +then + touch $pkgname/$sme$ver/import.log + cvs add $pkgname/$sme$ver/import.log + change=1 +fi +#create Makefile here +pushd $pkgname/$sme$ver >/dev/null +#if [ ! -f Makefile ] +if ( cvs status Makefile 2>/dev/null|grep -q 'Unknown' ) +then + NAME=$pkgname + CreateBranchMakefile + cvs -Q add Makefile + change=1 +fi +popd >/dev/null + +if [ "$change" == "1" ] +then +echo "commit..." +cvs -Q commit -m "Prep for $pkgname import" $pkgname +fi + +if ( $newmodule ) +then + cd ~/$packageroot/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 + +if [[ "$HOSTNAME" == "shell.koozali.org" ]] +then + if [ $# -eq 3 ] + then + echo "importing the srpm for you" + cd ~/$packageroot; + cd CVSROOT/; + cvs -Q update -dPA 1>/dev/null; + cd ../rpms/; + cvs -Q update -dPA 1>/dev/null ; + cd ~/$packageroot; + ./common/cvs-import.sh -b $sme$ver -m 'Initial import' /tmp/$(basename $rpmpath) + else + echo "no srpm provided" + fi + +else + echo "##########################" + echo "sending $rpmpath to shell.koozali.org ..." + if [[ $rpmpath != "" ]] + then + echo "scp $rpmpath shell.koozali.org:/tmp/" + cd $curpwd + scp $rpmpath shell.koozali.org:/tmp/ + echo "now trying to push this on shell.koozali.org and run ./common/cvs-import.sh" + echo "this could fails if your srpm was not initially on ~/smecontrib/ and if you have not ForwardAgent yes and user set in your .ss/config file for shell.koozali.org" + ssh shell.koozali.org "cd ~/$packageroot;cd CVSROOT/; cvs -Q update -dPA 1>/dev/null; cd ../rpms/; cvs -Q update -dPA $pkgname 1>/dev/null ;cd ~/$packageroot; ./common/cvs-import.sh -b $sme$ver -m 'Initial import' /tmp/$(basename $rpmpath)" + fi + cd ~/$packageroot/rpms/$pkgname/$sme$ver + cvs update -dPA; make prep + echo "in case of failure do:" + echo "scp $rpmpath shell.koozali.org:/tmp/" + echo "ssh shell.koozali.org" + echo "cd ~/$packageroot" + if [ $# -eq 3 ] + then + echo "./common/cvs-import.sh -b $sme$ver -m 'Initial import' /tmp/$(basename $rpmpath)" + else + echo "./common/cvs-import.sh -b $sme$ver -m 'Initial import' YOURSRPM " + fi + echo "exit" + echo "cd ~/$packageroot/rpms/$pkgname/$sme$ver ; cvs update -dPA; make prep" +fi + +echo "##########################" +echo "now you can:" +echo "cd ~/$packageroot/rpms/$pkgname/$sme$ver" + +unset CVSROOT diff -Nur smeserver-mock-1.0.old/root/usr/bin/newbranch smeserver-mock-1.0/root/usr/bin/newbranch --- smeserver-mock-1.0.old/root/usr/bin/newbranch 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-mock-1.0/root/usr/bin/newbranch 2020-05-19 00:08:22.498000000 -0400 @@ -0,0 +1,105 @@ +#!/bin/bash + +if [ $# -eq 0 ] + then + echo "No arguments supplied" +fi +if [ $# -lt 4 ] + then + echo "Usage: +newbranch type versionOri versionDest pkgname +examples: +# newbranch contribs 9 10 smeserver-mycontrib +# newbranch sme 9 10 smeserver-package +This script is intended to create a new branch of an existing tree by copying the content of another branch in it. You can then alter the new branch content as you want. +If you need to create the tree for the package then you should use importNew script. It will also allow you to import a srpm content. + +" + exit +fi + +sme=$1 +if [[ "$sme" != "sme" && "$sme" != "contribs" ]] +then + echo "wrong first parameter should be either 'sme' or 'contribs'" + exit +fi +re='^[0-9]+$' +if ! [[ $2 =~ $re ]] ; then + echo "Error: Second argument should be a version number (e.g.: 9) with an existing branch (e.g.: sme9)." >&2; exit 1 +fi +if ! [[ $3 =~ $re ]] ; then + echo "Error: Third argument should be a version number (e.g.: 10) needing a new branch (e.g.: sme10)." >&2; exit 1 +fi +#verd=$(($2 + 1));# rem we might want to go down too +vero=$2 +verd=$3 +pkgname=$4 +curpwd=`pwd` +packageroot='smecontribs' +if [[ "$sme" == "sme" ]] +then + packageroot='smeserver' +fi + +cd ~/$packageroot/CVSROOT +cvs -Q update -dPA 1>/dev/null +grep -Eq "^$pkgname\s+rpms/$pkgnames.*" ~/$packageroot/CVSROOT/modules +if (( $? != 0 )) +then + echo "Package $pkgname does not exists in modules, please create the proper tree in cvs and add it to modules. You might consider using importNew script." + exit +fi + + +# if does not exist we test if it is in cvs +# if not we fail +if [ ! -d ~/$packageroot/rpms/$pkgname ] +then + cd ~/$packageroot/rpms + # rem to test + cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P $pkgname #1>/dev/null + + if [ ! -d ~/$packageroot/rpms/$pkgname ] + then + echo "no such module $pkgname" + exho "use instead importNew script" + exit; + fi +fi + +cd ~/$packageroot/rpms; +cvs update -dPA $pkgname >/dev/null + +if [ ! -d ~/$packageroot/rpms/$pkgname/$sme$vero ] + then + echo "Branch $sme$vero does not exist. Nothing to do."; + exit; + fi + +if [ -d ~/$packageroot/rpms/$pkgname/$sme$verd ] + then + echo "Branch $sme$verd exists. Nothing to do."; + else + cd ~/$packageroot/rpms + rm -rf ~/$packageroot/rpms/$pkgname + cd ~/$packageroot/rpms + cvs -Q co $pkgname + cd $pkgname + # then you can copy + cp -a $sme$vero $sme$verd + rm -rf $sme$verd/CVS + cvs add $sme$verd + cd $sme$verd + find ./ -name CVS -prune -o -print | xargs cvs add + cvs commit -m 'Initial import' + echo "# then you have to do:" + echo "cd ~/$packageroot/rpms/$pkgname/$sme$verd/" + echo "make local" + echo "make tag ;make build" + echo "# Alternatively you can do:" + echo "# make mockbuild" + echo "# make tag ;make build" + fi + + diff -Nur smeserver-mock-1.0.old/root/usr/bin/prepa smeserver-mock-1.0/root/usr/bin/prepa --- smeserver-mock-1.0.old/root/usr/bin/prepa 2018-03-10 23:36:52.000000000 -0500 +++ smeserver-mock-1.0/root/usr/bin/prepa 2020-05-19 00:10:50.214000000 -0400 @@ -1,3 +1,16 @@ +#!/bin/bash cvs update -dPA make clean make prep +if [ -f 'sources' ] ; then +folder=`sed -rn 's/^[a-z0-9]{32}\s+(.+)\.(tar|t)\.?(gz|xz|bz)*$/\1/p' sources` +oldy="$folder.old" +if [ -d $folder ] ; then + echo "$folder exist" + if [ -d $oldy ] ; then + rm -rf $oldy && echo "removing $oldy" + fi + cp -a $folder $oldy && echo "creating $oldy as fresh copy of $folder" +fi +fi + diff -Nur smeserver-mock-1.0.old/root/usr/bin/refresh smeserver-mock-1.0/root/usr/bin/refresh --- smeserver-mock-1.0.old/root/usr/bin/refresh 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-mock-1.0/root/usr/bin/refresh 2020-05-19 00:08:22.526000000 -0400 @@ -0,0 +1,57 @@ +#!/bin/bash + +if [ $# -eq 0 ] + then + echo "No arguments supplied" + echo "Usage: +refresh [sme|contribs] +examples: +# refresh sme +This script will refresh or create the tree for smeserver (sme) or smecontribs (contribs). + +" + exit +fi +sme=$1 +if [[ "$sme" != "sme" && "$sme" != "contribs" ]] +then + echo "Wrong first parameter should be either 'sme' or 'contribs'" + exit +fi + +packageroot='smecontribs' +if [[ "$sme" == "sme" ]] +then + packageroot='smeserver' +fi + +#create if missing +if [ ! -d ~/$packageroot ] + then + "creating ~/$packageroot and populating..." + mkdir -p ~/$packageroot + cd ~/$packageroot + cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P CVSROOT rpms common 1>/dev/null + exit +fi + +if [[ "$2" == "force" ]] + then + "Forcing checkout for ~/$packageroot and populating with CVSROOT rpms common..." + mkdir -p ~/$packageroot + cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P CVSROOT rpms common 1>/dev/null + exit +fi + +# check if module rpms exist and populate it if necessary or update it +if [ -d ~/$packageroot/rpms ] + then + # update current tree + cd ~/$packageroot/rpms + cvs -Q update -dPA 1>/dev/null +else + # checkout rpms + cd ~/$packageroot + cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P rpms 1>/dev/null +fi +