few changes in the buildall.sh script.

View: New views
3 Messages — Rating Filter:   Alert me  

few changes in the buildall.sh script.

by shadowx :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
I was looking at the buildall.sh script and I made some changes... here's the patch:

--- buildall.sh.old     2009-07-24 14:49:18.750540296 +0300
+++ buildall.sh 2009-07-24 20:22:57.035665274 +0300
@@ -83,15 +83,6 @@
 #      exit 1
 #fi

-function get_pkg_name()
-{
-       PKG_NAME=`head -n1 $BUILD_LIST`
-       echo $PKG_NAME
-       if [ "$PKG_NAME" == "" ]; then
-               exit 1
-       fi
-
-}

 function check_installed_pkg()
 {
@@ -103,14 +94,6 @@
                local installedpkg=`echo $installedpkg | cut -d " " -f1`
        fi

-       if [ "$PKG_NAME" == "$installedpkg" ]; then
-               update_bld_list
-               get_pkg_name
-#      else
-#              echo "There is no package named $installedpkg in /var/log/packages !"
-#              return 0
-#              exit 1
-       fi
        cd $DLG_ROOT
 }

@@ -122,7 +105,7 @@
        echo "|                                                       |"
        echo "---------------------------------------------------------"

-       ($BUILD_CMD $PKG_NAME) || exit 1
+       ($BUILD_CMD $PKG_NAME) || exit 1

 }

@@ -134,19 +117,11 @@
        echo "|                                                       |"
        echo "---------------------------------------------------------"

-       $UPGRADEPKG ${PKGS_DIR}/${PKG_NAME}-*-*-[0-9]dl.tgz 2>/dev/null
+       $UPGRADEPKG ${DLG_PACKAGEROOT}/${PKG_NAME}-*-*-[0-9]${DLG_PKGER}.tgz 2>/dev/null || exit 1
        #$UPGRADEPKG ${PKGS_DIR}/${PKG_NAME}-${PKG_VERSION}-${DLG_ARCH}-[0-9]dl.tgz 2>/dev/null

 }

-function update_bld_list()
-{
-       local tmp_build_list="$DLG_ROOT/tmp_list.txt"
-       sed -e '1d' $BUILD_LIST > $tmp_build_list
-       rm $BUILD_LIST
-       cp $tmp_build_list $BUILD_LIST
-}
-
 function log_built_pkg()
 {
        local time=`date "+%Y-%m-%d %H:%M:%S"`
@@ -178,20 +153,20 @@

 # We need to backup the build order to not loose it.
 BUILD_LIST="$DLG_ROOT/compile-order-tmp"
-cp $BUILD_ORDER $BUILD_LIST
 # After that we clean the build order from the commented lines
 grep -v '^#' $BUILD_ORDER > $BUILD_LIST

-while [ "$PKG_NAME" != "" ]; do
-       get_pkg_name
+while read PKG_NAME; do
+
+       if [ $PKG_NAME == "" ] || [ $PKG_NAME == 'EOF' ]; then
+           exit 0
+       fi
+
        check_installed_pkg
 #      if [ -z check_installed_pkg ]; then
                build_pkg
                log_built_pkg
                pkg_install
                log_installed_pkg
-               update_bld_list
 #      fi
-done
-
-
+done < $BUILD_LIST





The changes I made:
Removed the get_pkg_name function. By doing:
   while read PKG_NAME ; do
         ....
    done < $BUILD_LIST
there's no need to get the 1st line of the file every time. This fixes an problem with skiping the 1st pkg in the list /sometimes u call update_bld_list twise and the buildall.sh script skips a package./
By doing this the functions 'get_pkg_name()' and 'update_bld_list()' become redundant.
The other change is replacing:
 $UPGRADEPKG ${PKGS_DIR}/${PKG_NAME}-*-*-[0-9]dl.tgz 2>/dev/null
with : $UPGRADEPKG ${DLG_PACKAGEROOT}/${PKG_NAME}-*-*-[0-9]${DLG_PKGER}.txz 2>/dev/null || exit 1
That way , if the user has made changes to the $DLG_PKGER , the script will stell be able to upgrade the package. I've added || exit 1 , 'cose if there's an error while upgradeing/installing the package, the script must exit.
Oh and the last change I made , was removing the: cp $BUILD_ORDER $BUILD_LIST   line ...
Sins there's grep -v "^#" after that ..i think there's no need of it.

The patch file and the updated buildall.sh can be found at:
http://gh0st.darknet.co.nz/dropline


Re: few changes in the buildall.sh script.

by Sasa Ostrouska :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi shadowx,

On Sat, Jul 25, 2009 at 9:38 AM, shadowx<shadowx@...> wrote:

>
> Hello,
> I was looking at the buildall.sh script and I made some changes... here's
> the patch:
>
> --- buildall.sh.old     2009-07-24 14:49:18.750540296 +0300
> +++ buildall.sh 2009-07-24 20:22:57.035665274 +0300
> @@ -83,15 +83,6 @@
>  #      exit 1
>  #fi
>
> -function get_pkg_name()
> -{
> -       PKG_NAME=`head -n1 $BUILD_LIST`
> -       echo $PKG_NAME
> -       if [ "$PKG_NAME" == "" ]; then
> -               exit 1
> -       fi
> -
> -}
>
>  function check_installed_pkg()
>  {
> @@ -103,14 +94,6 @@
>                local installedpkg=`echo $installedpkg | cut -d " " -f1`
>        fi
>
> -       if [ "$PKG_NAME" == "$installedpkg" ]; then
> -               update_bld_list
> -               get_pkg_name
> -#      else
> -#              echo "There is no package named $installedpkg in
> /var/log/packages !"
> -#              return 0
> -#              exit 1
> -       fi
>        cd $DLG_ROOT
>  }
>
> @@ -122,7 +105,7 @@
>        echo "|                                                       |"
>        echo "---------------------------------------------------------"
>
> -       ($BUILD_CMD $PKG_NAME) || exit 1
> +       ($BUILD_CMD $PKG_NAME) || exit 1
>
>  }
>
> @@ -134,19 +117,11 @@
>        echo "|                                                       |"
>        echo "---------------------------------------------------------"
>
> -       $UPGRADEPKG ${PKGS_DIR}/${PKG_NAME}-*-*-[0-9]dl.tgz 2>/dev/null
> +       $UPGRADEPKG ${DLG_PACKAGEROOT}/${PKG_NAME}-*-*-[0-9]${DLG_PKGER}.tgz
> 2>/dev/null || exit 1
>        #$UPGRADEPKG
> ${PKGS_DIR}/${PKG_NAME}-${PKG_VERSION}-${DLG_ARCH}-[0-9]dl.tgz 2>/dev/null
>
>  }
>
> -function update_bld_list()
> -{
> -       local tmp_build_list="$DLG_ROOT/tmp_list.txt"
> -       sed -e '1d' $BUILD_LIST > $tmp_build_list
> -       rm $BUILD_LIST
> -       cp $tmp_build_list $BUILD_LIST
> -}
> -
>  function log_built_pkg()
>  {
>        local time=`date "+%Y-%m-%d %H:%M:%S"`
> @@ -178,20 +153,20 @@
>
>  # We need to backup the build order to not loose it.
>  BUILD_LIST="$DLG_ROOT/compile-order-tmp"
> -cp $BUILD_ORDER $BUILD_LIST
>  # After that we clean the build order from the commented lines
>  grep -v '^#' $BUILD_ORDER > $BUILD_LIST
>
> -while [ "$PKG_NAME" != "" ]; do
> -       get_pkg_name
> +while read PKG_NAME; do
> +
> +       if [ $PKG_NAME == "" ] || [ $PKG_NAME == 'EOF' ]; then
> +           exit 0
> +       fi
> +
>        check_installed_pkg
>  #      if [ -z check_installed_pkg ]; then
>                build_pkg
>                log_built_pkg
>                pkg_install
>                log_installed_pkg
> -               update_bld_list
>  #      fi
> -done
> -
> -
> +done < $BUILD_LIST
>
>
>
>
>
> The changes I made:
> Removed the get_pkg_name function. By doing:
>   while read PKG_NAME ; do
>         ....
>    done < $BUILD_LIST
> there's no need to get the 1st line of the file every time. This fixes an
> problem with skiping the 1st pkg in the list /sometimes u call
> update_bld_list twise and the buildall.sh script skips a package./
> By doing this the functions 'get_pkg_name()' and 'update_bld_list()' become
> redundant.

Great fixes !

> The other change is replacing:
>  $UPGRADEPKG ${PKGS_DIR}/${PKG_NAME}-*-*-[0-9]dl.tgz 2>/dev/null
> with : $UPGRADEPKG ${DLG_PACKAGEROOT}/${PKG_NAME}-*-*-[0-9]${DLG_PKGER}.txz
> 2>/dev/null || exit 1
> That way , if the user has made changes to the $DLG_PKGER , the script will
> stell be able to upgrade the package. I've added || exit 1 , 'cose if
> there's an error while upgradeing/installing the package, the script must
> exit.

Ok perfect, the one thing is maybe we can make it to look for tgz and
txz extensions ?
But what will happen if the DLG_PKGER package is not in the repos ?

> Oh and the last change I made , was removing the: cp $BUILD_ORDER
> $BUILD_LIST   line ...
> Sins there's grep -v "^#" after that ..i think there's no need of it.
>
I was copying th elist since sometimes it removed my build order
completely so I had to
restore it from the repo. Was just like a safety feature.

> The patch file and the updated buildall.sh can be found at:
> http://gh0st.darknet.co.nz/dropline
>
>
Great, will commit it into trunk so we can begin testing it with 2.28 builds.

Rgds
Saxa

------------------------------------------------------------------------------
_______________________________________________
Dropline-gnome-devel mailing list
Dropline-gnome-devel@...
https://lists.sourceforge.net/lists/listinfo/dropline-gnome-devel

Re: few changes in the buildall.sh script.

by shadowx :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am..... i didnt think if there's no DLG_PKGER set ... so i guess something like
if [ $DLG_PKGER = "" ]; then DLG_PKGER = "dl" ; fi
or there can be a line : DLG_PKGER="dl" , before the . ${DLG_ROOT}/config
that way if there's no DLG_PKGER set in the config , it will use DLG_PKGER="dl"

And about the package extension .... one way is to use :
$UPGRADEPKG ${DLG_PACKAGEROOT}/${PKG_NAME}-*-*-[0-9]${DLG_PKGER}.t*z
or there can be a variable in the config , just like the $DLG_PKGER

I'll be happy if more people take a look at the changes i made ...there's big chance i've made more mistakes :]

Sasa Ostrouska wrote:
Hi shadowx,

On Sat, Jul 25, 2009 at 9:38 AM, shadowx<shadowx@escom.bg> wrote:
>
> Hello,
> I was looking at the buildall.sh script and I made some changes... here's
> the patch:
>
> --- buildall.sh.old     2009-07-24 14:49:18.750540296 +0300
> +++ buildall.sh 2009-07-24 20:22:57.035665274 +0300
> @@ -83,15 +83,6 @@
>  #      exit 1
>  #fi
>
> -function get_pkg_name()
> -{
> -       PKG_NAME=`head -n1 $BUILD_LIST`
> -       echo $PKG_NAME
> -       if [ "$PKG_NAME" == "" ]; then
> -               exit 1
> -       fi
> -
> -}
>
>  function check_installed_pkg()
>  {
> @@ -103,14 +94,6 @@
>                local installedpkg=`echo $installedpkg | cut -d " " -f1`
>        fi
>
> -       if [ "$PKG_NAME" == "$installedpkg" ]; then
> -               update_bld_list
> -               get_pkg_name
> -#      else
> -#              echo "There is no package named $installedpkg in
> /var/log/packages !"
> -#              return 0
> -#              exit 1
> -       fi
>        cd $DLG_ROOT
>  }
>
> @@ -122,7 +105,7 @@
>        echo "|                                                       |"
>        echo "---------------------------------------------------------"
>
> -       ($BUILD_CMD $PKG_NAME) || exit 1
> +       ($BUILD_CMD $PKG_NAME) || exit 1
>
>  }
>
> @@ -134,19 +117,11 @@
>        echo "|                                                       |"
>        echo "---------------------------------------------------------"
>
> -       $UPGRADEPKG ${PKGS_DIR}/${PKG_NAME}-*-*-[0-9]dl.tgz 2>/dev/null
> +       $UPGRADEPKG ${DLG_PACKAGEROOT}/${PKG_NAME}-*-*-[0-9]${DLG_PKGER}.tgz
> 2>/dev/null || exit 1
>        #$UPGRADEPKG
> ${PKGS_DIR}/${PKG_NAME}-${PKG_VERSION}-${DLG_ARCH}-[0-9]dl.tgz 2>/dev/null
>
>  }
>
> -function update_bld_list()
> -{
> -       local tmp_build_list="$DLG_ROOT/tmp_list.txt"
> -       sed -e '1d' $BUILD_LIST > $tmp_build_list
> -       rm $BUILD_LIST
> -       cp $tmp_build_list $BUILD_LIST
> -}
> -
>  function log_built_pkg()
>  {
>        local time=`date "+%Y-%m-%d %H:%M:%S"`
> @@ -178,20 +153,20 @@
>
>  # We need to backup the build order to not loose it.
>  BUILD_LIST="$DLG_ROOT/compile-order-tmp"
> -cp $BUILD_ORDER $BUILD_LIST
>  # After that we clean the build order from the commented lines
>  grep -v '^#' $BUILD_ORDER > $BUILD_LIST
>
> -while [ "$PKG_NAME" != "" ]; do
> -       get_pkg_name
> +while read PKG_NAME; do
> +
> +       if [ $PKG_NAME == "" ] || [ $PKG_NAME == 'EOF' ]; then
> +           exit 0
> +       fi
> +
>        check_installed_pkg
>  #      if [ -z check_installed_pkg ]; then
>                build_pkg
>                log_built_pkg
>                pkg_install
>                log_installed_pkg
> -               update_bld_list
>  #      fi
> -done
> -
> -
> +done < $BUILD_LIST
>
>
>
>
>
> The changes I made:
> Removed the get_pkg_name function. By doing:
>   while read PKG_NAME ; do
>         ....
>    done < $BUILD_LIST
> there's no need to get the 1st line of the file every time. This fixes an
> problem with skiping the 1st pkg in the list /sometimes u call
> update_bld_list twise and the buildall.sh script skips a package./
> By doing this the functions 'get_pkg_name()' and 'update_bld_list()' become
> redundant.

Great fixes !

> The other change is replacing:
>  $UPGRADEPKG ${PKGS_DIR}/${PKG_NAME}-*-*-[0-9]dl.tgz 2>/dev/null
> with : $UPGRADEPKG ${DLG_PACKAGEROOT}/${PKG_NAME}-*-*-[0-9]${DLG_PKGER}.txz
> 2>/dev/null || exit 1
> That way , if the user has made changes to the $DLG_PKGER , the script will
> stell be able to upgrade the package. I've added || exit 1 , 'cose if
> there's an error while upgradeing/installing the package, the script must
> exit.

Ok perfect, the one thing is maybe we can make it to look for tgz and
txz extensions ?
But what will happen if the DLG_PKGER package is not in the repos ?


> Oh and the last change I made , was removing the: cp $BUILD_ORDER
> $BUILD_LIST   line ...
> Sins there's grep -v "^#" after that ..i think there's no need of it.
>
I was copying th elist since sometimes it removed my build order
completely so I had to
restore it from the repo. Was just like a safety feature.

> The patch file and the updated buildall.sh can be found at:
> http://gh0st.darknet.co.nz/dropline
>
>
Great, will commit it into trunk so we can begin testing it with 2.28 builds.

Rgds
Saxa

------------------------------------------------------------------------------
_______________________________________________
Dropline-gnome-devel mailing list
Dropline-gnome-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dropline-gnome-devel