User Tools

Site Tools


rpm_tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rpm_tools [2015/05/07 20:25]
stephdl
rpm_tools [2019/06/05 21:48] (current)
Line 91: Line 91:
 The result of build can be find in the 'exchange' folder of the user's home of that script The result of build can be find in the 'exchange' folder of the user's home of that script
  
-  * usage<br />+  * usage
  
 in the git directory of your rpm (you need to install git & mock installed) in the git directory of your rpm (you need to install git & mock installed)
Line 105: Line 105:
   # parameters are optional   # parameters are optional
   ME=$(whoami)   ME=$(whoami)
-  +   
   # What is the package name   # What is the package name
   # The package name is given by the name of the main folder   # The package name is given by the name of the main folder
Line 117: Line 117:
   # Which git branch we are talking   # Which git branch we are talking
   BRANCH=$(git branch | grep '*' | cut -d' ' -f2)   BRANCH=$(git branch | grep '*' | cut -d' ' -f2)
- +  
   # Find the centos version   # Find the centos version
   DIST=$2   DIST=$2
Line 191: Line 191:
     fi;     fi;
   fi   fi
-  +   
- +  
   if ! [ -z "$1" ]; then   if ! [ -z "$1" ]; then
     if [ $1 = "sme8-386" ]; then     if [ $1 = "sme8-386" ]; then
Line 217: Line 217:
   echo ""   echo ""
   mock -r $MOCKCONF --rebuild ~/rpmbuild/SRPMS/$PACKAGE-$VERSION-*.src.rpm --resultdir=/home/$ME/exchange/$PACKAGE-$VERSION   mock -r $MOCKCONF --rebuild ~/rpmbuild/SRPMS/$PACKAGE-$VERSION-*.src.rpm --resultdir=/home/$ME/exchange/$PACKAGE-$VERSION
- +  
   # a bit of clean   # a bit of clean
- +  
   rm -f  ~/rpmbuild/SPECS/$PACKAGE.spec ~/rpmbuild/SOURCES/$PACKAGE-$VERSION.tar.gz ~/rpmbuild/SRPMS/$PACKAGE-$VERSION*.src.rpm   rm -f  ~/rpmbuild/SPECS/$PACKAGE.spec ~/rpmbuild/SOURCES/$PACKAGE-$VERSION.tar.gz ~/rpmbuild/SRPMS/$PACKAGE-$VERSION*.src.rpm
   rm -rf $TMPDIR  ~/$PACKAGE-$VERSION    rm -rf $TMPDIR  ~/$PACKAGE-$VERSION 
- +  
   # we give the path where are files   # we give the path where are files
   echo ""   echo ""
Line 229: Line 229:
   echo ""   echo ""
   ls -1 ~/exchange/$PACKAGE-$VERSION/*.rpm   ls -1 ~/exchange/$PACKAGE-$VERSION/*.rpm
- echo "=================================================================================================================="+  echo "=================================================================================================================="
      
   # and we sign rpm if needed, if not simply do 'enter' with keyboard   # and we sign rpm if needed, if not simply do 'enter' with keyboard
Line 277: Line 277:
     curl -u 'stephdl:xxxxxxxxxxxxxx' https://api.github.com/user/repos -d '{"name": "'"$NameGitHub"'" ,  "description": "A contrib for SME9",  "homepage": "http://wiki.contribs.org",  "private": false,  "has_issues": true,  "has_wiki": true,  "has_downloads": true}'     curl -u 'stephdl:xxxxxxxxxxxxxx' https://api.github.com/user/repos -d '{"name": "'"$NameGitHub"'" ,  "description": "A contrib for SME9",  "homepage": "http://wiki.contribs.org",  "private": false,  "has_issues": true,  "has_wiki": true,  "has_downloads": true}'
     mkdir -p ~/git_work/$1     mkdir -p ~/git_work/$1
- +  
     cp -R smeserver-*/* ~/git_work/$1     cp -R smeserver-*/* ~/git_work/$1
     cp $1*.spec ~/git_work/$1     cp $1*.spec ~/git_work/$1
     cd ~/git_work/$1     cd ~/git_work/$1
- +  
       if [ -e root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/ ]; then        if [ -e root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/ ]; then 
           mkdir -p root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/           mkdir -p root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/
Line 292: Line 292:
     mv -f $1.ter.spec $1.spec     mv -f $1.ter.spec $1.spec
     rm -f $1.bis.spec     rm -f $1.bis.spec
-  +   
- +  
   ###git work    ###git work 
- +  
         if [ ! -e README.md ]; then         if [ ! -e README.md ]; then
         touch README.md         touch README.md
         echo "$1 is a contrib for SME Server, a Linux distro oriented server. see http://wiki.contribs.org" > README.md         echo "$1 is a contrib for SME Server, a Linux distro oriented server. see http://wiki.contribs.org" > README.md
         fi         fi
- +  
        ##fill empty directories        ##fill empty directories
        find * -type d -empty -exec touch {}/.gitignore \;        find * -type d -empty -exec touch {}/.gitignore \;
- +  
     git init     git init
     git add .     git add .
Line 310: Line 310:
     git remote add origin git@github.com:stephdl/$1     git remote add origin git@github.com:stephdl/$1
     git push -u -f origin sme9     git push -u -f origin sme9
- +  
   ##find the apache authentication   ##find the apache authentication
     echo ""     echo ""
Line 323: Line 323:
             echo "no apache authentication"             echo "no apache authentication"
         fi         fi
- +  
   ## help to write the changelog   ## help to write the changelog
   myDate=$(LC_ALL=C date +"%a %b %d %Y")   myDate=$(LC_ALL=C date +"%a %b %d %Y")
Line 329: Line 329:
     echo "* $myDate stephane de Labrusse <stephdl@de-labrusse.fr>"     echo "* $myDate stephane de Labrusse <stephdl@de-labrusse.fr>"
     echo "- Initial release to sme9"     echo "- Initial release to sme9"
- +  
   else   else
     echo""     echo""
Line 357: Line 357:
         exit         exit
     fi     fi
- +  
     if [[ -d ~/git_work/$1 && -d ~/git_work/$1-sdl ]]; then     if [[ -d ~/git_work/$1 && -d ~/git_work/$1-sdl ]]; then
         echo""         echo""
Line 368: Line 368:
     fi     fi
   # Create needed dirs on the build box   # Create needed dirs on the build box
- +  
     mkdir -p ~/rpmbuild/{RPMS,SRPMS,SPECS,SOURCES,BUILD}     mkdir -p ~/rpmbuild/{RPMS,SRPMS,SPECS,SOURCES,BUILD}
     mkdir -p ~/exchange     mkdir -p ~/exchange
- +  
     rpm -ivh $1*.src.rpm     rpm -ivh $1*.src.rpm
     cd ~/rpmbuild/SPECS     cd ~/rpmbuild/SPECS
     rpmbuild -bp --nodeps $1*.spec     rpmbuild -bp --nodeps $1*.spec
- +  
   ##we remove all patch from the spec file   ##we remove all patch from the spec file
     sed '/Patch/d' $1*.spec > $1.bis.spec     sed '/Patch/d' $1*.spec > $1.bis.spec
Line 381: Line 381:
     mv -f $1.ter.spec $1.spec     mv -f $1.ter.spec $1.spec
     rm -f $1.bis.spec     rm -f $1.bis.spec
-  +   
- +  
   ###test to see if the directory already exists in ~/git_work, if yes we use ~/git_work/package_name-sdl   ###test to see if the directory already exists in ~/git_work, if yes we use ~/git_work/package_name-sdl
     if [[ ! -d ~/git_work/$1 ]]; then     if [[ ! -d ~/git_work/$1 ]]; then
- +  
         gitexist=0         gitexist=0
         mkdir -p ~/git_work/$1         mkdir -p ~/git_work/$1
         NameGitHub=$1         NameGitHub=$1
         curl -u 'stephdl:xxxxxxxxxx' https://api.github.com/user/repos -d '{"name": "'"$NameGitHub"'" , "description": "A RPM for SME Server", "homepage": "http://wiki.contribs.org", "private": false, "has_issues": true, "has_wiki": true, "has_downloads": true}'         curl -u 'stephdl:xxxxxxxxxx' https://api.github.com/user/repos -d '{"name": "'"$NameGitHub"'" , "description": "A RPM for SME Server", "homepage": "http://wiki.contribs.org", "private": false, "has_issues": true, "has_wiki": true, "has_downloads": true}'
- +  
         cp -R ~/rpmbuild/BUILD/$1*/* ~/git_work/$1         cp -R ~/rpmbuild/BUILD/$1*/* ~/git_work/$1
         cp ~/rpmbuild/SPECS/$1.spec ~/git_work/$1         cp ~/rpmbuild/SPECS/$1.spec ~/git_work/$1
         cd ~/git_work/$1         cd ~/git_work/$1
-  +   
- +  
     elif [[ -d ~/git_work/$1 ]]; then     elif [[ -d ~/git_work/$1 ]]; then
- +  
         gitexist=1         gitexist=1
         mkdir -p ~/git_work/$1-sdl         mkdir -p ~/git_work/$1-sdl
         NameGitHub=$1-sdl         NameGitHub=$1-sdl
         curl -u 'stephdl:xxxxxxxxx' https://api.github.com/user/repos -d '{"name": "'"$NameGitHub"'" , "description": "A RPM for SME Server", "homepage": "http://wiki.contribs.org", "private": false, "has_issues": true, "has_wiki": true, "has_downloads": true}'         curl -u 'stephdl:xxxxxxxxx' https://api.github.com/user/repos -d '{"name": "'"$NameGitHub"'" , "description": "A RPM for SME Server", "homepage": "http://wiki.contribs.org", "private": false, "has_issues": true, "has_wiki": true, "has_downloads": true}'
- +  
         cp -R ~/rpmbuild/BUILD/$1*/* ~/git_work/$1-sdl         cp -R ~/rpmbuild/BUILD/$1*/* ~/git_work/$1-sdl
         cp ~/rpmbuild/SPECS/$1.spec ~/git_work/$1-sdl         cp ~/rpmbuild/SPECS/$1.spec ~/git_work/$1-sdl
         cd ~/git_work/$1-sdl         cd ~/git_work/$1-sdl
- +  
     fi     fi
      
      
   ###git work   ###git work
- +  
         if [ ! -e README.md ]; then         if [ ! -e README.md ]; then
         touch README.md         touch README.md
         echo "$1 is a RPM for SME Server, a Linux distro oriented server. see http://wiki.contribs.org" > README.md         echo "$1 is a RPM for SME Server, a Linux distro oriented server. see http://wiki.contribs.org" > README.md
         fi         fi
- +  
        ##fill empty directories        ##fill empty directories
        find * -type d -empty -exec touch {}/.gitignore \;        find * -type d -empty -exec touch {}/.gitignore \;
- +  
     git init     git init
     git add .     git add .
     git commit -m "first commit to SME Server"     git commit -m "first commit to SME Server"
- +  
     if [[ $2 != 'master' ]]; then     if [[ $2 != 'master' ]]; then
         git co -b $2         git co -b $2
Line 431: Line 431:
         git remote add origin git@github.com:stephdl/$1         git remote add origin git@github.com:stephdl/$1
         git push -u -f origin $2         git push -u -f origin $2
- +  
     elif [[ $gitexist = "1" ]]; then     elif [[ $gitexist = "1" ]]; then
         git remote add origin git@github.com:stephdl/$1-sdl         git remote add origin git@github.com:stephdl/$1-sdl
         git push -u -f origin $2         git push -u -f origin $2
- +  
     fi     fi
-  +   
- +  
   ##find the apache authentication   ##find the apache authentication
     echo ""     echo ""
Line 451: Line 451:
             echo "no apache authentication"             echo "no apache authentication"
         fi         fi
- +  
   ## help to write the changelog   ## help to write the changelog
   myDate=$(LC_ALL=C date +"%a %b %d %Y")   myDate=$(LC_ALL=C date +"%a %b %d %Y")
Line 459: Line 459:
      
   # a bit of clean   # a bit of clean
- +  
     rm -rf ~/rpmbuild/SPECS/* ~/rpmbuild/SOURCES/* ~/rpmbuild/SRPMS/* ~/rpmbuild/BUILD/     rm -rf ~/rpmbuild/SPECS/* ~/rpmbuild/SOURCES/* ~/rpmbuild/SRPMS/* ~/rpmbuild/BUILD/
      
rpm_tools.1431023104.txt.gz · Last modified: 2019/06/05 21:48 (external edit)