Changeset 900 for trunk/tools


Ignore:
Timestamp:
Oct 24, 2006, 8:49:18 AM (13 years ago)
Author:
bruno
Message:

Huge patch to introduce low level functions that will bw used everywhere (mr_free, mr_asprintf, ...)
Nearly linking now due to that.

Location:
trunk/tools
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/build2pkg

    r839 r900  
    6363            ar=$ARCH
    6464        fi
    65         pkg1="${TOPBUILDDIR}/RPMS/${ar}/$pv-${TAG}${suf}.${ar}.rpm"
    66         #rm -f $pkg1
    6765
    68         pkg="$pkg $pkg1"
    69 
    70         log=$TMP/$p-rpm.log
     66        log=$MONDOTMP/$p-rpm.log
    7167
    7268        if [ "$dfam" = "mandriva" ] || [ "$dfam" = "suse" ]; then
     
    8783            status=-1
    8884        else
     85            export pkg1="`egrep '^Wrote:' $log | grep -v debug | cut -d: -f2`"
    8986            if [ -f /usr/bin/rpmlint ]; then
    90                 /usr/bin/rpmlint `egrep '^Wrote:' $log | cut -d: -f2`
     87                /usr/bin/rpmlint $pkg1
    9188            else
    9289                echo "No rpmlint found, please install it"
    9390            fi
     91            export pkg="$pkg `ls $pkg1 | grep -v src.rpm`"
    9492        fi
    9593        rm -rf ${TOPBUILDDIR}/BUILD/*
     
    116114        fi
    117115    elif [  _"$dtype" = _"deb" ]; then
    118         export TMPDIR=/tmp
    119116        cd $TOPBUILDDIR
    120117        tar xfz $src
     
    130127echo "Packages handled : $pkg"
    131128
    132 rm -rf $TMP
     129rm -rf $MONDOTMP
    133130
    134131if [ $status = 0 ]; then
  • trunk/tools/build2qemu

    r764 r900  
    4545fi
    4646
    47 mkdir -p $TMP
    48 cat > $TMP/mkmondo << EOF
     47cat > $MONDOTMP/mkmondo << EOF
    4948#!/bin/bash
    5049
     
    5756$TOOLHOME/pkg2ftp $LAST
    5857EOF
    59 chmod 755 $TMP/mkmondo
     58chmod 755 $MONDOTMP/mkmondo
    6059
    6160if [ $single -eq 0 ]; then
    6261    $TOOLHOME/file2ftp
    6362fi
    64 cd $TOOLHOME/..
    65 tar cfz $TMP/mkmondo.tar.gz $TOOLHOME $TMP/mkmondo $TOPDIR/${VER}-$TAG
     63
     64# TOPDIR contains ../.. which causes problems to tar
     65# so we need to recompute it
     66cd $TOPDIR
     67dir=`pwd`
     68tar cfz $MONDOTMP/mkmondo.tar.gz $TOOLHOME $MONDOTMP/mkmondo $dir/${VER}-$TAG
    6669
    6770for m in $VMS; do
     
    6972    if [ ! -f /users/qemu/$m.qemu ]; then
    7073            echo "VM unaccessible. Verify NFS mount"
    71             rm -rf $TMP
     74            rm -rf $MONDOTMP
    7275            exit -1
    7376    fi
     
    8285        sleep 300
    8386    fi
    84     scp -P $sp $TMP/mkmondo.tar.gz ~/.rpmmacros ~/.rpmrc bruno@localhost:
     87    scp -P $sp $MONDOTMP/mkmondo.tar.gz ~/.rpmmacros ~/.rpmrc bruno@localhost:
    8588    rdate=`date "+%m%d%H%M"`
    8689    ssh -p $sp root@localhost "date $rdate"
    87     ssh -p $sp bruno@localhost "cd / ; rm -rf ~bruno/mondo ~bruno/RPMS/BUILD/* ~bruno/RPMS/tmp/* /tmp/* ; tar xfz ~bruno/mkmondo.tar.gz ; $TMP/mkmondo " | tee $TMP/mkvm.log
    88     #ssh -p $sp bruno@localhost "cd / ; tar xfz ~bruno/mkmondo.tar.gz ; $TMP/mkmondo ; rm -f $TMP" | tee $TMP/mkvm.log
     90    ssh -p $sp bruno@localhost "cd / ; rm -rf ~bruno/mondo ~bruno/RPMS/BUILD/* ~bruno/RPMS/tmp/* /tmp/* ; tar xfz ~bruno/mkmondo.tar.gz ; $MONDOTMP/mkmondo " | tee $MONDOTMP/mkvm.log
     91    #ssh -p $sp bruno@localhost "cd / ; tar xfz ~bruno/mkmondo.tar.gz ; $MONDOTMP/mkmondo ; rm -f $MONDOTMP" | tee $MONDOTMP/mkvm.log
    8992    if [ $vmp -eq 1 ]; then
    9093        ssh -p $sp root@localhost "halt -p"
     
    99102
    100103# Should be removed at the end
    101 rm -rf $TMP
     104rm -rf $MONDOTMP
    102105) 2>&1 | tee /tmp/build2qemu.log
  • trunk/tools/common-env

    r764 r900  
    77
    88# Adapt to your needs
    9 export BASE=${HOME}/mondo
    10 export TOPDIR=${BASE}/build
     9d=`dirname ${TOOLHOME}`
     10if [ _"`basename ${d}/..`" = _"trunk" ]; then
     11    BASE=${TOOLHOME}/../..
     12else
     13    BASE=${TOOLHOME}/../../..
     14fi
     15export TOPDIR=${BASE}/delivery
    1116mkdir -p ${TOPDIR}
     17
    1218export TMPDIR=/tmp
    13 export TMP=`mktemp -d /tmp/mondobuild.XXXXXXXXXX`
     19export MONDOTMP=`mktemp -d $TMPDIR/mondobuild.XXXXXXXXXX`
     20mkdir -p $MONDOTMP
    1421
    1522umask 022
  • trunk/tools/distro-env

    r764 r900  
    77# Input parameters : $ddir (distro name) and $dver (distro version)
    88# If they do not exist then deduce from current distro
    9 # Exports : $dfam (distro family) $suf (pkg suffix) $dtype (distro type) BUILDDIR (dir to build packages)
     9# Exports : $dfam (distro family) $suf (pkg suffix) $dtype (distro type) TOPBUILDDIR (dir to build packages)
    1010
    1111#
     
    6868    dtype="deb"
    6969    suf=".${dfam}${dver}"
    70     BUILDDIR=${TOPDIR}/debian
    7170elif [ $ddir = "gentoo" ]; then
    7271    dfam="gentoo"
     
    7473    dver1=`echo ${dver} | sed "s/\.//"`
    7574    suf=".${ddir}${dver1}"
    76     BUILDDIR=${TOPDIR}/ebuild
    7775elif [ $ddir = "slackware" ]; then
    7876    dfam="slack"
    7977    dtype="tgz"
    8078    suf=".${dfam}${dver}"
    81     BUILDDIR=${TOPDIR}/slack
    8279elif [ $ddir = "sles" -o $ddir = "suse" ]; then
    8380    dfam="suse"
    8481    dtype="rpm"
    8582    suf=".${ddir}${dver}"
    86     BUILDDIR=${TOPDIR}/SPECS
    8783elif [ $ddir = "fedora" -o $ddir = "redhat" -o $ddir = "rhel" ]; then
    8884    dfam="redhat"
     
    9692        suf=".rhel${dver1}"
    9793    fi
    98     BUILDDIR=${TOPDIR}/SPECS
    99 elif [ $ddir = "mandrake" -o $ddir = "mandriva" ]; then
     94elif [ $ddir = "mandrake" ]; then
    10095    dfam="mandriva"
    10196    dtype="rpm"
    10297    suf=".`echo $dver | sed 's/\.//'`mdk"
    103     BUILDDIR=${TOPDIR}/SPECS
     98elif [ $ddir = "mandriva" ]; then
     99    dfam="mandriva"
     100    dtype="rpm"
     101    suf=".`echo $dver | sed 's/\.//'`mdv"
    104102else
    105103    dfam="unknown"
    106104    dtype="unknown"
    107     BUILDDIR=${TOPDIR}/SPECS
    108105    suf="unknown"
    109106fi
     
    111108export dfam
    112109export dtype
    113 export BUILDDIR
    114110export suf
    115111
     
    117113# Additional exports and preparation for some distros
    118114#
     115
     116# Default
     117export TOPBUILDDIR=${TOPDIR}/../build
     118
    119119if [ _"$dtype" = _"rpm" ]; then
    120120    export ARCH=`rpm --showrc | egrep "^build arch" | awk '{print $4}'`
    121121    if [ -f ${HOME}/.rpmmacros ]; then
    122122        export TOPBUILDDIR=`egrep '^%_topdir' ${HOME}/.rpmmacros | awk '{print $2}'`
    123     else
    124         export TOPBUILDDIR=${BASE}/build
    125123    fi
    126124    mkdir -p ${TOPBUILDDIR}/{RPMS,SRPMS,SPECS,SOURCES,BUILD}
    127125elif [ _"$dtype" = _"deb" ]; then
    128     export TOPBUILDDIR=${BASE}/build
    129126    mkdir -p ${TOPBUILDDIR}
    130127elif [ _"$dtype" = _"ebuild" ]; then
    131     export TOPBUILDDIR=${BASE}/build
    132128    mkdir -p ${TOPBUILDDIR}/portage
    133129fi
  • trunk/tools/ftp-env

    r592 r900  
    77
    88# BerliOS FTP/SSH setup
    9 export ACCOUNT=bruno@ftp.mondorescue.org
     9/sbin/ifconfig | egrep -q '10\.3' 2>&1 > /dev/null
     10if [ $? = 0 ]; then
     11    export DESTMACH=mondo.hpintelco.org
     12else
     13    export DESTMACH=www.mondorescue.org
     14fi
     15
     16export ACCOUNT=bruno@$DESTMACH
    1017export DSTDIR=/mondo/ftp
    1118export FTPSERV="ftp.berlios.de"
  • trunk/tools/livwww

    r672 r900  
    3131fi
    3232
    33 /sbin/ifconfig | egrep -q '10\.3' 2>&1 > /dev/null
    34 if [ $? = 0 ]; then
    35     DESTMACH=mondo.hpintelco.org
    36 else
    37     DESTMACH=www.mondorescue.org
    38 fi
    39 
    4033dname=`dirname $0`
    4134prem=`echo $dname |cut -c1`
     
    4841. $TOOLHOME/common-env
    4942. $TOOLHOME/svn-env
     43. $TOOLHOME/ftp-env
    5044
    51 cd ${BASE}/svn
     45# To be safe for SVN commands
     46cd ${TOOLHOME}/..
    5247
    5348if [ $force -eq 1 ]; then
     
    5651fi
    5752
    58 svn export $optsvn ${SVNBRANCH}/website $LOCALDIR
     53svn export $optsvn ${TOOLHOME}/../website $LOCALDIR
    5954
    6055if [ $force -eq 1 ]; then
     
    6358fi
    6459
    65 svn export $optsvn ${SVNBRANCH}/mondo-doc $LOCALDOC
     60svn export $optsvn ${TOOLHOME}/../mondo-doc $LOCALDOC
    6661
    6762#
  • trunk/tools/mkannounce

    r764 r900  
    3232SEARCH=`echo $VER | cut -c2-`
    3333
    34 rm -f $TMP/announce.tmp
    35 cat > $TMP/announce.tmp << EOF
     34rm -f $MONDOTMP/announce.tmp
     35cat > $MONDOTMP/announce.tmp << EOF
    3636MondoRescue $VER is now available</p>
    3737
     
    4343<p>
    4444EOF
    45 ssh ${ACCOUNT} "cd $DSTDIR ; find . -name 'm[oi]nd[io]-[0-9]$SEARCH*'" | grep -v 'src.rpm' >> $TMP/announce.tmp
    46 cat >> $TMP/announce.tmp << EOF
     45ssh ${ACCOUNT} "cd $DSTDIR ; find . -name 'm[oi]nd[io]-[0-9]$SEARCH*'" | grep -v 'src.rpm' >> $MONDOTMP/announce.tmp
     46cat >> $MONDOTMP/announce.tmp << EOF
    4747</p>
    4848
     
    5555
    5656# Generating log files
    57 $TOOLHOME/mkchangelog.pl announce mindi $TMP/mindi.ann
    58 $TOOLHOME/mkchangelog.pl announce mondo $TMP/mondo.ann
    59 echo "<p>" >> $TMP/announce.tmp
    60 sed 's/$/<br>/' $TMP/mindi.ann >> $TMP/announce.tmp
    61 echo "</p><p>" >> $TMP/announce.tmp
    62 sed 's/$/<br>/' $TMP/mondo.ann >> $TMP/announce.tmp
    63 echo "</p>" >> $TMP/announce.tmp
    64 rm -f $TMP/mindi.ann $TMP/mondo.ann
     57$TOOLHOME/mkchangelog.pl announce mindi $MONDOTMP/mindi.ann
     58$TOOLHOME/mkchangelog.pl announce mondo $MONDOTMP/mondo.ann
     59echo "<p>" >> $MONDOTMP/announce.tmp
     60sed 's/$/<br>/' $MONDOTMP/mindi.ann >> $MONDOTMP/announce.tmp
     61echo "</p><p>" >> $MONDOTMP/announce.tmp
     62sed 's/$/<br>/' $MONDOTMP/mondo.ann >> $MONDOTMP/announce.tmp
     63echo "</p>" >> $MONDOTMP/announce.tmp
     64rm -f $MONDOTMP/mindi.ann $MONDOTMP/mondo.ann
    6565
    66 vi $TMP/announce.tmp
     66vi $MONDOTMP/announce.tmp
    6767# Store it in DB for Web pages generation
    68 $TOOLHOME/mkannounce.pl $TMP/announce.tmp
     68$TOOLHOME/mkannounce.pl $MONDOTMP/announce.tmp
    6969# Then deliver it on the Web
    7070$TOOLHOME/livwww www
    71 cat > $TMP/announce.hdr << EOF
     71cat > $MONDOTMP/announce.hdr << EOF
    7272<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/x html1/DTD/xhtml1-strict.dtd">
    7373
     
    7878  <p>
    7979EOF
    80 cat > $TMP/announce.ftr << EOF
     80cat > $MONDOTMP/announce.ftr << EOF
    8181</body>
    8282</html>
    8383EOF
    8484# Mail it to mr ML
    85 cat $TMP/announce.hdr $TMP/announce.tmp $TMP/announce.ftr | w3m -dump -T text/html > $TMP/mondo.ann.txt
     85cat $MONDOTMP/announce.hdr $MONDOTMP/announce.tmp $MONDOTMP/announce.ftr | w3m -dump -T text/html > $MONDOTMP/mondo.ann.txt
    8686export EMAIL="bruno@mondorescue.org"
    87 export TMPDIR=$TMP
    88 cat $TMP/mondo.ann.txt | mutt -s "`head -1 $TMP/mondo.ann.txt`" mondo-devel@lists.sourceforge.net -c mondorescue-announce@lists.berlios.de
    89 rm -rf $TMP
     87cat $MONDOTMP/mondo.ann.txt | mutt -s "`head -1 $MONDOTMP/mondo.ann.txt`" mondo-devel@lists.sourceforge.net -c mondorescue-announce@lists.berlios.de
     88rm -rf $MONDOTMP
  • trunk/tools/qemu-vm.txt

    r764 r900  
    44
    55# RPM based : urpmi, yum install, yast2
    6 urpmi neon newt-devel slang-devel autoconf automake libtool gcc rpm-build wget gvim/vim-X11 gcc-c++ docbook-utils-pdf ImageMagick man patch mindi mondo
     6urpmi neon newt-devel slang-devel glibc-static-devel autoconf automake libtool gcc rpm-build wget gvim/vim-X11 gcc-c++ docbook-utils-pdf ImageMagick man patch mindi mondo
    77
    88# gentoo
  • trunk/tools/quality

    r688 r900  
    2828
    2929# How many sprintf/strcat/strcpy vs asprintf are they
    30 for s in asprintf sprintf strcat strcpy strncpy fgets malloc malloc_string MAX_STR_LEN getcwd goto; do
     30for s in asprintf mr_asprintf sprintf strcat strcpy strncpy fgets malloc mr_malloc malloc_string getline mr_getline MAX_STR_LEN getcwd goto free mr_free; do
    3131    echo "monodrescue $s usage : "
    3232    tot=0
  • trunk/tools/svn-env

    r782 r900  
    66#
    77
    8 export SVNBRANCH="`cat ${TOOLHOME}/../mondo/VERSION`"
    9 export VER=`cat ${BASE}/svn/${SVNBRANCH}/mondo/VERSION`
     8export VER=`cat ${TOOLHOME}/../mondo/VERSION`
    109
    1110# To be safe for SVN commands
  • trunk/tools/svn2build

    r839 r900  
    3333
    3434# Make it safe for SVN commands
    35 cd ${BASE}/svn
     35cd ${TOOLHOME}/..
    3636
    3737for p in $c; do
    38     v=`cat ${SVNBRANCH}/$p/VERSION`
     38    v=`cat ${TOOLHOME}/../$p/VERSION`
    3939    echo "Management of $p $v-$TAG (rev $REVISION)"
    40     dest="$p-$v"
     40    dest="$DEST/$p-$v"
    4141    rm -fr $dest
    42     svn export ${SVNBRANCH}/$p $dest
     42    svn export ${TOOLHOME}/../$p $dest
    4343    echo "$REVISION" > $dest/REVISION
    4444    echo "Generating SVN log file ..."
    45     svn log -v ${SVNBRANCH}/$p > $dest/svn.log
     45    svn log -v ${TOOLHOME}/../$p > $dest/svn.log
    4646
    4747    for d in `cat ${TOOLHOME}/DISTROS`; do
     
    5151        . $TOOLHOME/distro-env
    5252
    53         # Create conf file dir
    54         mkdir -p ${BUILDDIR}
    55 
    5653        ddd=`LANG=C ; date '+%Y-%m-%d'`
    57         cat > $TMP/mondorescue.mc << EOF
     54        cat > $MONDOTMP/mondorescue.mc << EOF
    5855define(\`TTT', ${TAG})dnl
    5956define(\`RRR', ${TAG}${suf})dnl
     
    7471            echo "Using $inc customization to build SPEC file"
    7572
    76             $TOOLHOME/mkchangelog.pl $dtype $p $TMP/$p.spec
     73            $TOOLHOME/mkchangelog.pl $dtype $p $MONDOTMP/$p.spec
    7774            if [ $? -ne 0 ]; then
    7875                echo "Unable to create changelog for ${ddir}-$dver/$p.spec"
    7976                exit -1
    8077            fi
    81             m4 $TMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $TMP/$p.spec > $dest/distributions/${ddir}-$dver/$p.spec
     78            m4 $MONDOTMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $MONDOTMP/$p.spec > $dest/distributions/${ddir}-$dver/$p.spec
    8279
    83             rm -f $TMP/$p.spec
     80            rm -f $MONDOTMP/$p.spec
    8481        elif [ "$dtype" = "ebuild" ]; then
    85             m4 $TMP/mondorescue.mc $dest/distributions/$dfam/$p.ebuild > $dest/distributions/${ddir}-$dver/$p-$v.ebuild
     82            m4 $MONDOTMP/mondorescue.mc $dest/distributions/$dfam/$p.ebuild > $dest/distributions/${ddir}-$dver/$p-$v.ebuild
    8683        elif [ "$dtype" = "deb" ]; then
    87             # To be developped
    88             #m4 $TMP/mondorescue.mc $dest/distributions/$dfam/$p > /dev/null
    8984            cp -a $dest/distributions/$ddir/* $dest/distributions/${ddir}-$dver
    90             m4 $TMP/mondorescue.mc $dest/distributions/$ddir/rules > $dest/distributions/${ddir}-$dver/rules
     85            m4 $MONDOTMP/mondorescue.mc $dest/distributions/$ddir/rules > $dest/distributions/${ddir}-$dver/rules
    9186            $TOOLHOME/mkchangelog.pl $dtype $p $dest/distributions/${ddir}-$dver/changelog
    9287            if [ $? -ne 0 ]; then
     
    9994    done
    10095
     96    # The rest is done there
     97    cd $DEST
    10198    if [ _"`echo $p | grep mondo-doc`" != _"" ]; then
    10299        cd $dest
    103100        for f in mondorescue-howto.sgml *8; do
    104             m4 $TMP/mondorescue.mc $f > ${f}.new
     101            m4 $MONDOTMP/mondorescue.mc $f > ${f}.new
    105102            mv ${f}.new $f
    106103        done
     
    117114
    118115    if [ _"`echo $p | grep -vE 'kernel|busybox' | grep mindi`" != _"" ]; then
    119         v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
     116        v1=`cat ${TOOLHOME}/../mondo-doc/VERSION`
    120117        if [ ! -d mondo-doc-$v1 ]; then
    121118            echo "mondo-doc should be created before $p"
    122119            exit -1
    123120        fi
    124         (cd mondo-doc-$v1 ; make -f Makefile.man install-$p INSTALLDIR=../$dest)
     121        (cd mondo-doc-$v1 ; make -f Makefile.man install-$p INSTALLDIR=../$p-$v)
    125122        rm -f $dest/rootfs/sbin/parted2fdisk-ia64
    126123    fi
    127124    if [ "`echo $p | grep -v doc | grep  mondo`" != "" ]; then
    128         v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
     125        v1=`cat ${TOOLHOME}/../mondo-doc/VERSION`
    129126        if [ ! -d mondo-doc-$v1 ]; then
    130127            echo "mondo-doc should be created before $p"
    131128            exit -1
    132129        fi
    133         (cd mondo-doc-$v1 ; make -f Makefile.howto install INSTALLDIR=../$dest/docs/en ; make -f Makefile.man install-$p INSTALLDIR=../$dest/docs/man)
     130        (cd mondo-doc-$v1 ; make -f Makefile.howto install INSTALLDIR=../$p-$v/docs/en ; make -f Makefile.man install-$p INSTALLDIR=../$p-$v/docs/man)
    134131        (cd $dest ; echo "Bootstraping mondo ... " ; ./bootstrap)
    135132    fi
     
    137134    # Finally creates the tar files
    138135    echo -n "Creating $p tar files (gzip... "
    139     tar cfphz ${DEST}/$p-$v.tar.gz $dest
     136    tar cfphz ${DEST}/$p-$v.tar.gz $p-$v
    140137    echo -n " bzip2..."
    141     tar cfphj ${DEST}/$p-$v.tar.bz2 $dest
     138    tar cfphj ${DEST}/$p-$v.tar.bz2 $p-$v
    142139    echo " )"
    143140done
    144141
    145 rm -rf $TMP
     142rm -rf $MONDOTMP
    146143
    147144echo "Version delivered :"
Note: See TracChangeset for help on using the changeset viewer.