Changes

From SME Server
Jump to navigationJump to search
897 bytes added ,  15:08, 17 June 2015
Line 593: Line 593:  
code:
 
code:
    +
#!/bin/bash
 +
 +
# Author : stephane de labrusse <stephdl@de-labrusse.fr> @2015
 +
# the purpose is to import a srpm from a remote url in the CVS of buildsrv
 +
 +
 
  #test if all arguments are here
 
  #test if all arguments are here
 
     <nowiki>if [[ -z $3 ]]; then</nowiki>
 
     <nowiki>if [[ -z $3 ]]; then</nowiki>
 
     echo "########################################################################################################"
 
     echo "########################################################################################################"
     echo "   you must give arguments : srpm-import Folder_Name Branch_Name(smeX|contribsX) Url_2_Remote_Srpm"
+
     echo "Import srpm to CVS on buildsrv : srpm-import Folder_Name Branch_Name(smeX|contribsX) Url_2_Remote_Srpm"
 
     echo "########################################################################################################"
 
     echo "########################################################################################################"
 
     exit
 
     exit
Line 602: Line 608:  
   
 
   
 
  #we test the branchname
 
  #we test the branchname
     <nowiki>if [[ $2 != "sme"* && $2 != "contribs"* ]];then</nowiki>
+
     <nowiki>if [[ $2 != "sme"[8-9] && $2 != "contribs"[8-9] ]];then</nowiki>
 
     echo ""
 
     echo ""
     echo "the branchname name is not good, must be smeX or contribsX"  
+
     echo "the branchname name is not good, must be sme[8-9] or contribs[8-9]"  
 
     exit 1
 
     exit 1
 
     fi
 
     fi
 
   
 
   
 
  #we test the remote url
 
  #we test the remote url
     if wget $3 >/dev/null 2>&1 ; then
+
     <nowiki>if wget $3 >/dev/null 2>&1 ; then</nowiki>
 
     echo "Url : $3 exists..."
 
     echo "Url : $3 exists..."
 
     else
 
     else
Line 630: Line 636:  
     <nowiki>if [[ -d $2 ]];then</nowiki>
 
     <nowiki>if [[ -d $2 ]];then</nowiki>
 
     echo ""
 
     echo ""
     echo "the branch name already exists : we stop the script"
+
     echo "the branch name $1/$2 already exists : we stop the script."
 +
    echo ""
 +
    echo "You must import a new tarball manually if needed :"
 +
    echo "    cd $1/$2"
 +
    echo "    wget http://your.src.rpm"
 +
    echo "    rpm2cpio  *.src.rpm | cpio -idmv --no-absolute-filenames"
 +
    echo "    make new-sources FILES=*.?z"
 +
    echo "    rm -rf *.src.rpm *.?z *.spec"
 +
    echo "    cvs commit -m 'new source commited for the branch $2 of $1'"
 
     exit 1
 
     exit 1
 
     fi
 
     fi
Line 638: Line 652:  
  cvs add $2
 
  cvs add $2
 
  cd $2
 
  cd $2
   
  #import correct date of first import
 
  #import correct date of first import
 
  echo $(date +%s) > import.log
 
  echo $(date +%s) > import.log
+
  #copy makefile FIXME
  #copy makefile from my home '''FIXME'''
   
  cp -f ~/Makefile .
 
  cp -f ~/Makefile .
 
  sed -i -e "s/smeserver-durep/$1/g" Makefile
 
  sed -i -e "s/smeserver-durep/$1/g" Makefile
   
  #wget the srpm by remote url  
 
  #wget the srpm by remote url  
 
  wget $3
 
  wget $3
   
  #untar the srpm
 
  #untar the srpm
 
  rpm2cpio  *.src.rpm | cpio -idmv --no-absolute-filenames
 
  rpm2cpio  *.src.rpm | cpio -idmv --no-absolute-filenames
   
  #import the new source
 
  #import the new source
 
  make new-sources FILES=*.?z
 
  make new-sources FILES=*.?z
   
  #a bit of clean
 
  #a bit of clean
 
  rm -rf *.src.rpm *.?z  
 
  rm -rf *.src.rpm *.?z  
   
  #import all to cvs
 
  #import all to cvs
 
  cvs add *
 
  cvs add *
   
  #sed work
 
  #sed work
 
  version=$(grep -sri 'define version' *.spec | sed 's/%define version //gI')
 
  version=$(grep -sri 'define version' *.spec | sed 's/%define version //gI')
 
  release=$(grep -sri 'define release' *.spec | sed 's/%define release //gI')
 
  release=$(grep -sri 'define release' *.spec | sed 's/%define release //gI')
   
  #bump the release
 
  #bump the release
 
  release=$((release + 1))
 
  release=$((release + 1))
   
  #write to the spec file
 
  #write to the spec file
 
  sed -i "/%define release/c %define release $release" *.spec
 
  sed -i "/%define release/c %define release $release" *.spec
  sed -i "/changelog/a * $(LC_ALL=C date +"%a %b %d %Y") stephane de Labrusse <stephdl@de-labrusse.fr> $version-$release.sme\n- Initial release to sme9contribs\n" *.spec
+
  sed -i "/changelog/a * $(LC_ALL=C date +"%a %b %d %Y") stephane de Labrusse <stephdl@de-labrusse.fr> $version-$release.sme\n- Initial release to $2\n" *.spec
   
+
  echo ""
  #cvs commit -m "* $(LC_ALL=C date +"%a %b %d %Y") stephane de Labrusse <stephdl@de-labrusse.fr> $version-$release.sme - Initial release to sme9contribs"
+
echo "Verify in $1/$2 if all is well, then commit the changes"
 +
  echo "    cvs commit -m '$(LC_ALL=C date +"%a %b %d %Y") stephane de Labrusse <stephdl@de-labrusse.fr> $version-$release.sme - Initial release to $2'"
 +
echo ""
 +
echo " If it is the first importation of a srpm, you must enable it in the CVSROOT, first you have to refresh the CVS source"
 +
echo "    cvs co CVSROOT"
 +
echo " Then you must edit /CVSROOT/modules and add the name of the new CVS module (alphabetically sorted), after that commit the changes"

Navigation menu