Author Topic: Code::Blocks package building script  (Read 5894 times)

Offline kurapix

  • Multiple posting newcomer
  • *
  • Posts: 68
Code::Blocks package building script
« on: July 13, 2007, 12:54:36 pm »
Hi people!!!
I've seen a lot of time some people who have problem building packages from SVN on Ubuntu or Fedora.
I've started to do a little script for myself so I'll share it since I think it'll help those people.
For now it is a very simple script that update, compare made package revision to svn revision, ... it is only for building .deb packages so if you want .rpm package script then it would be greatly appreciate if someone does it (I don't have Fedora and have a very slow connection).

* EDIT - WARNING * :
- Don't use this script between version 0.1 and 0.3 anymore beyond revision 4267 since CB is now broken in several .deb.
I'm gonna work on this.
The things that doesn't work well after 4267 : showing latest build package, showing all packages, installing (so you should still be able to checkout, update, or build the packages).


* EDIT - WORK IN PROGRESS * :
- It's been 2 weeks sinces 0.4beta work except the checkout thing. It's been 2 weeks I haven't work on the script.
It will certainly be released next week since I have other things to do for now. (it was quick to fix the 0.3 script to make it work beyond 4267 revision ... just some added lines, modified sed, ... so it should be fast to fix the checkout thing but not now ...)


Quote from: CHANGELOG
Changelog :

Version 0.1 (12/07/07
- Feature : Go to C::B sources folder
- Feature : Update Sources
- Feature : Put latest revision number in debian/changelog (1.0svn -> 1.0svn-revXXX)
- Feature : Build package

Version 0.1a (12/07/07)
- Fix : 3 lines instead of 1 for changing revision in changelog

Version 0.1b (12/07/07)
- Fix : Everything in English now
- Fix : Renamed some variable to be more "logic"

Version 0.2 (13/07/07)
- Change : Code::Blocks sources path is now defined by user
- Change : C::B sources clean-up is now quiet
- Feature : Show CURRENT and SVN revision
- Feature : Check if a compiled version of the lastest revision is available
- Feature : Choose to update or not
- Feature : Ask if path entered is correct, if not the script is terminated
- Feature : Build package only if this package doesn't exist

Version 0.3
- Change : Check path existence
- Feature : Choose to checkout if sources doesn't exist in given paths
- Feature : Choose to compile or not
- Feature : Choose which revision to install (I've used gdebi instead of dpkg finally lol)
- Other various changes and fixes

download (dead link)

I'm new to scripting (I've started 1-2 days ago) so please excuse-me if it doesn't look good for now.
Some stuffs need to be test like the lastest built package revision, ...

Thank you

Kurapix
« Last Edit: December 16, 2007, 02:56:49 pm by kurapix »
Code::Blocks package building script

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Code::Blocks package building script
« Reply #1 on: July 13, 2007, 02:05:48 pm »
Is this the right place for a feature request?

I would really enjoy this script if you could add some 'gdebi' with the correct version to automatically install the freshly built version

Offline kurapix

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: Code::Blocks package building script
« Reply #2 on: July 13, 2007, 10:05:20 pm »
Yes it is the right place for asking features ;) .
Feature to choose if user want to install or not is in the TO DO.
I'll use dpkg instead of gdebi because dpkg seems to be more popular.

As soon as I finish all the stuff in my TO DO list, I'll release the 0.3 version (I dunno when it will be).

Kurapix
Code::Blocks package building script

Offline kurapix

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: Code::Blocks package building script
« Reply #3 on: July 14, 2007, 08:30:10 pm »
I've found an corrected 3 small bugs in version 0.2 :
- Fix : Path correctly evaluate (it evaluate like it should in terminal), ~/ work
- Fix : Revision number is now correct in debian/changelog when update
- Fix : Bad output when there are many packages
Patch : Version 0.2 -> Version 0.2.1
Code
--- debuild_CB.sh	2007-07-13 00:11:08.000000000 -1000
+++ debuild_CB-0.2.1.sh 2007-07-14 08:35:27.000000000 -1000
@@ -1,5 +1,5 @@
 #    Code::Blocks Build deb package script from SVN
-#                Version 0.2
+#                Version 0.2.1
 
 ################################################################################
 #                                                                              #
@@ -26,12 +26,11 @@
 echo "What is your Code::Blocks sources path?"
 # Ask Code::Blocks sources path
 read -e CB_SOURCES_PATH
+# Evaluate CB_SOURCES_PATH like it should in terminal
+CB_SOURCES_PATH=`eval "echo $CB_SOURCES_PATH"`
+# Verification of the path made by user
 echo -n 'Your Code::Blocks sources path is correct? [y/n] '
-################################## TO FIX ######################################
-# Bug : doesn't accept ~/ instead of /home/user directory syntax
-# So we have to type the entire path >.<
 read CORRECT_CB_SOURCES_PATH
-################################ END TO FIX ####################################
 
 if [ "$CORRECT_CB_SOURCES_PATH" = "y" ]; then
 {
@@ -60,6 +59,7 @@
         sudo svn-clean --quiet
         # Update the Code:Blocks sources from SVN
         svn update
+        CB_CURRENT_REV=`svn --xml info | tr -d '\r\n' | sed -e 's:.*<commit.*revision="\([0-9]*\)".*<\/commit>.*:\1:'`
     }
     fi
 
@@ -67,7 +67,7 @@
     cd ..
     LINE_COMPILED=`ls | grep --extended-regexp [-rev]*[0-9]+.deb | wc -l`
     # Check if a compiled version of the lastest revision is available # DEV
-    CB_COMPILED_REV=`ls | grep --extended-regexp [-rev]*[0-9]+.deb | sed -e "$LINE_COMPILED s:.*rev\([0-9]*\).*:\1:"`
+    CB_COMPILED_REV=`ls | grep --extended-regexp [-rev]*[0-9]+.deb | grep -n --extended-regexp [.]* | grep "$LINE_COMPILED": | sed -e "s:.*rev\([0-9]*\).*:\1:"`
     echo "Your latest revision package is : $CB_COMPILED_REV"
 
     # Go back in Code::Blocks sources directory
Now there shouldn't be anymore bugs in 0.2.

For the installation feature please wait, it'll be in the next release (it will be better than planned : now we will also also be able to choose which package already made to install).

Kurapix
« Last Edit: July 14, 2007, 08:37:44 pm by kurapix »
Code::Blocks package building script

Offline kurapix

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: Code::Blocks package building script
« Reply #4 on: July 15, 2007, 12:58:10 pm »
Sorry for being late.
I've finished 0.3 script some time ago lol.

Quote
Version 0.3
- Change : Check path existence
- Feature : Choose to checkout if sources doesn't exist in given paths
- Feature : Choose to compile or not
- Feature : Choose which revision to install (I've used gdebi instead of dpkg finally lol)
- Other various changes and fixes

Here it is : download (dead link)

I don't plan to make new versions (add features) for now since this script does what it was meant for : help the beginners for packaging C::B from sources.
A good stuff would be to add packages making for RPM based distrib but since I don't have any other distribution than Ubuntu ... I can't do it.

Config file feature will be abandonned I think to limit automation of the script (and thus avoiding some errors).

Please test it and if you find a bug then PM me ;) .
Any help would be appreciate ;) .

* EDIT * :
- Don't use this script anymore beyond revision 4267 since it will be differents packages.
I'm gonna work on this if some people are still interested.
The things that doesn't work well after 4267 : showing latest build package, showing all packages, installing (so you should still be able to checkout, update, or build the packages).

Kurapix
« Last Edit: December 16, 2007, 02:55:53 pm by kurapix »
Code::Blocks package building script