Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 26 Feb 2020, 00:47
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Multiple package installation/removal with PPM
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 14 of 24 [351 Posts]   Goto page: Previous 1, 2, 3, ..., 12, 13, 14, 15, 16, ..., 22, 23, 24 Next
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 1981
Location: Japan

PostPosted: Wed 14 Jan 2015, 09:23    Post subject:  

removed






-

Last edited by MochiMoppel on Sun 18 Jan 2015, 09:13; edited 1 time in total
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 3107

PostPosted: Wed 14 Jan 2015, 10:12    Post subject:  

MochiMoppel wrote:
mavrothal wrote:
Pending Zig's confirmation, this change in pkg_choser.sh appears to work for the "install button bug"
Code:

+          <action>if [ "$(cat /tmp/pkgs_to_install)" != "" ]; then disable:VBOX_MAIN; fi</action>
 
It does Rolling Eyes ? Gtkdialog can have shell commands call gtkdialog functions? If it works, OK, if it doesn't, try something like
Code:
 <action condition="command_is_true([[ "$(cat /tmp/pkgs_to_install)" != ""  ]] && echo true )">disable:VBOX_MAIN</action>

Thank you!
Now I can implement this as I like it in my local "M4" ( Very Happy), with these changes over 12-z11-M3
Code:
--- a/usr/local/petget/pkg_chooser.sh   2015-01-14 14:49:32.639994828 +0200
+++ b/usr/local/petget/pkg_chooser.sh   2015-01-14 16:30:11.543335203 +0200
@@ -16,6 +16,7 @@
 rm -f /tmp/{remove,install}{,_pets}_quietly
 rm -f /tmp/install_classic
 rm -f /tmp/overall_*
+rm -f /tmp/force_install
 
 /usr/local/petget/service_pack.sh & #121125 offer download Service Pack.
 
@@ -52,7 +53,7 @@
    if [ "$(grep $TREE1 /root/.packages/user-installed-packages)" != "" -a \
     -f /tmp/install_pets_quietly ]; then
       . /usr/lib/gtkdialog/box_yesno "$(gettext 'Package is already installed')" "$(gettext 'This package is already installed! ')" "$(gettext 'If you want to re-install it, first remove it and then install it again. To download only or use the step-by-step classic mode, select No and then change the Auto Install to another option.')" "$(gettext 'To Abort the process now select Yes.')"
-      if [ "$EXIT" = "yes" ]; then  exit 0 ;fi
+      if [ "$EXIT" = "yes" ]; then  exit 0; else touch /tmp/force_install; fi
    fi
    if [ "$TREE1" ] && [ ! "$(grep -F $TREE1 /tmp/pkgs_to_install)" ]; then
       echo 0 > /tmp/petget/install_status_percent
@@ -81,6 +82,7 @@
       mv -f /tmp/pkgs_to_install2 /tmp/pkgs_to_install
       if [ "$(cat /tmp/pkgs_to_install)" = "" ]; then
          rm -f /tmp/overall_*
+         rm -f /tmp/force_install
          echo "" > /tmp/petget/install_status
       else
          remove_item2 &
@@ -112,6 +114,7 @@
          elif [ "$PREVPKG" != "" ]; then echo changed >> /tmp/mode_changed ;fi
          rm -f /tmp/*_pet{,s}_quietly
          rm -f /tmp/install_classic
+         rm -f /tmp/force_install
          touch /tmp/download_only_pet_quietly
       ;;
       "$(gettext 'Download all (packages and dependencies)')")
@@ -119,6 +122,7 @@
          elif [ "$PREVPKG" != "" ]; then echo changed >> /tmp/mode_changed ;fi
          rm -f /tmp/*_pet{,s}_quietly
          rm -f /tmp/install_classic
+         rm -f /tmp/force_install
          touch /tmp/download_pets_quietly
       ;;
       "$(gettext 'Step by step installation (classic mode)')")
@@ -126,12 +130,16 @@
           -a ! -f /tmp/download_pets_quietly ]; then echo ok
          elif [ "$PREVPKG" != "" ]; then echo changed >> /tmp/mode_changed ;fi
          rm -f /tmp/*_pet{,s}_quietly
+         rm -f /tmp/force_install
          touch /tmp/install_classic
       ;;   
    esac
 }
-
-export -f add_item add_item2 remove_item remove_item2 change_mode
+
+installed_warning () {
+   /usr/lib/gtkdialog/box_splash -timeout 10 -bg orange -fontsize large -text "$(gettext 'This package is already installed!  If you want to re-install it, uninstall it first it and then install it.')"
+}
+export -f add_item add_item2 remove_item remove_item2 change_mode installed_warning
 
 
 
@@ -359,9 +367,10 @@
           '"`/usr/lib/gtkdialog/xml_button-icon package_add`"'
           <label>" '$(gettext 'Install')' "</label>
           <sensitive>false</sensitive>
-          <action>if [ "$(cat /tmp/pkgs_to_install)" != "" ]; then disable:VBOX_MAIN; fi</action>
+          <action>disable:VBOX_MAIN; fi</action>
           <action>cut -d"|" -f1,4 /tmp/pkgs_to_install > /tmp/pkgs_to_install_tmp; mv -f /tmp/pkgs_to_install_tmp /tmp/pkgs_to_install</action>
-          <action>/usr/local/petget/installwindow.sh "$INSTALL_MODE" &</action>
+          <action condition="command_is_true(if [ -f /tmp/force_install -a -f /tmp/install_pets_quietly ]; then echo false; else echo true; fi )">/usr/local/petget/installwindow.sh "$INSTALL_MODE" &</action>
+          <action condition="command_is_false(if [ -f /tmp/force_install -a -f /tmp/install_pets_quietly ]; then echo false; else echo true; fi )">installed_warning &</action>
         </button>
       </hbox>
     </vbox>
--- a/usr/local/petget/installwindow.sh   2015-01-13 11:39:11.000000000 +0200
+++ b/usr/local/petget/installwindow.sh   2015-01-14 16:09:24.083423513 +0200
@@ -16,6 +16,7 @@
  rm -f /tmp/overall_pkg_size*
  rm -f /tmp/overall_dependencies
  rm -f /tmp/mode_changed
+ rm -f /tmp/force_install
  rm -rf /tmp/PPM_LOGs/
 }
 export -f clean_up

But I'll wait for a better (aesthetically or otherwise) implementation because there is one scenario that is not covered, if only one of the packages is already installed but the rest are OK... Twisted Evil

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 6629
Location: Valåmoen, Norway

PostPosted: Wed 14 Jan 2015, 11:13    Post subject:  

mavrothal wrote:
zigbert wrote:
mavrothal wrote:
Yes, I see it. Is a problem with gtkdialog where the install button is activated even if there is no package.
pkg_chooser.sh line 483:
Code:
<action>disable:HBOX_INSTALL</action>
should be
Code:
<action>disable:BUTTON_INSTALL</action>

The bug remains.
This solves the case after installation has finished. Not when user removes the last item from the install-list.

I'll get back to that...

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 6629
Location: Valåmoen, Norway

PostPosted: Wed 14 Jan 2015, 11:23    Post subject:  

I see MochiMoppel offered the solution, but I added this line 472 in pkg_chooser.sh and it only disables the install-button when list is empty
Code:
              <action signal="button-release-event" condition="command_is_true([[ ! `cat /tmp/pkgs_to_install` ]] && echo true)">disable:BUTTON_INSTALL</action>

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
mavrothal


Joined: 24 Aug 2009
Posts: 3107

PostPosted: Wed 14 Jan 2015, 14:23    Post subject:  

zigbert wrote:
I see MochiMoppel offered the solution, but I added this line 472 in pkg_chooser.sh and it only disables the install-button when list is empty
Code:
              <action signal="button-release-event" condition="command_is_true([[ ! `cat /tmp/pkgs_to_install` ]] && echo true)">disable:BUTTON_INSTALL</action>


OK Thanks.
Here is the 12-z11-M4 version of the pet.
It now refuses to Auto install if one or more packages among others in the list are already installed, Reports the offending packages and proceeds if they are removed or if the installation mode is changed.
Also now preserves the installation mode between successful installs (but not on restarts)
I'm sure my gtkdialog coding can be improved Rolling Eyes but till Sigmund or someone else comes up with an improved version please test for bugs as now the combinations and the possible settings increase seriously and something may have been overlooked Twisted Evil
ppm_multi-12-z11-M4.pet
Description 
pet

 Download 
Filename  ppm_multi-12-z11-M4.pet 
Filesize  64.19 KB 
Downloaded  146 Time(s) 

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 3107

PostPosted: Thu 15 Jan 2015, 03:02    Post subject:  

Looking at the occasional fail of PPM to start, I noticed that the PPM_GUI dialog runs the status monitor line as such
Code:
<input>while [ -s /tmp/petget/install_status ]; do cat /tmp/petget/install_status_percent; cat /tmp/petget/install_status; sleep 0.3; done</input>

After exiting PPM normally from the quit button the loop keeps running and reports write error!
Changed it in
Code:
<input>while [ -s /tmp/petget/install_status -a "$(ps|grep PPM_GUI|grep gtkdialog|wc -l)" -gt 2 ]; do cat /tmp/petget/install_status_percent; cat /tmp/petget/install_status; sleep 0.3; done</input>

and now exits properly on exit. Interestingly I did not get a fail-to-start in more than 50 consecutive starts after that!
Maybe is a lucky day but maybe there is something to it.
Another change in pkg_chooser, is to also stop a second instance of PPM when started from the terminal with the 'ppm' command. So line 8 looks like that
Code:
[ "$(ps | grep -E 'pkg_chooser|ppm' | grep -v grep | wc -l)" -gt 2 ] \

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 6629
Location: Valåmoen, Norway

PostPosted: Thu 15 Jan 2015, 04:57    Post subject:  

mavrothal wrote:
Looking at the occasional fail of PPM to start, I noticed that the PPM_GUI dialog runs the status monitor line as such
Code:
<input>while [ -s /tmp/petget/install_status ]; do cat /tmp/petget/install_status_percent; cat /tmp/petget/install_status; sleep 0.3; done</input>

After exiting PPM normally from the quit button the loop keeps running and reports write error!
Changed it in
Code:
<input>while [ -s /tmp/petget/install_status -a "$(ps|grep PPM_GUI|grep gtkdialog|wc -l)" -gt 2 ]; do cat /tmp/petget/install_status_percent; cat /tmp/petget/install_status; sleep 0.3; done</input>

and now exits properly on exit. Interestingly I did not get a fail-to-start in more than 50 consecutive starts after that!
Maybe is a lucky day but maybe there is something to it.
I don't know what happens as I can't reproduce the running loop after exit ppm. My idea is to stop loop at exit by line 498
Code:
<action signal="delete-event">rm /tmp/petget/install_status</action>
It is nothing wrong with you alternative code, but it's more cpu-hungry.

It seems that some systems doesn't notice the delete-event signal, and I wonder why and if there are other signals that works better. The wiki:
Quote:
Signals

There is no default signal for this widget.

The "file-changed" signal is emitted if file-monitor is true and the input file being monitored has changed.

The following signals are connected-up for all widgets:

button-press-event, button-release-event, configure-event, enter-notify-event, leave-notify-event, focus-in-event, focus-out-event, hide, show, realize, key-press-event, key-release-event, map-event, unmap-event

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
mavrothal


Joined: 24 Aug 2009
Posts: 3107

PostPosted: Thu 15 Jan 2015, 06:42    Post subject:  

zigbert wrote:
I don't know what happens as I can't reproduce the running loop after exit ppm. My idea is to stop loop at exit by line 498
Code:
<action signal="delete-event">rm /tmp/petget/install_status</action>
It is nothing wrong with you alternative code, but it's more cpu-hungry.

I think that the problem is that somehow gtkdialog crashes and does not exit normally. Maybe depends on the System (I run Tahr) or X (I run mostly VMs) but for now I'll go with the grep. I just increased sleep to 0.5 and should even out.

Anyway here is yet another update of the pet, 12-z11-M5 (it needs libstardust) that incorparates the above and where the "quite" signal has been reworked so will not conflict with the install mode. Now, install_pets_quietly is used for the mode and install_quietly is the banner/dialog suppression flag. So in situation where you have consecutive installation with different modes will behave as expected.

Hopefully, you'll get the change to reinstate ui_Classic so we can wrap this up. Wink
ppm_multi-12-z11-M5.pet
Description 
pet

 Download 
Filename  ppm_multi-12-z11-M5.pet 
Filesize  64.2 KB 
Downloaded  125 Time(s) 

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
666philb


Joined: 07 Feb 2010
Posts: 3532
Location: wales

PostPosted: Thu 15 Jan 2015, 07:49    Post subject:  

probably a bit late but, if the user has say 4gb + of space you could just skip the 'calculating total required space for packages' and speed things up.
_________________
Bionicpup64 built with bionic beaver packages http://murga-linux.com/puppy/viewtopic.php?t=114311
Xenialpup64, built with xenial xerus packages http://murga-linux.com/puppy/viewtopic.php?t=107331
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 3107

PostPosted: Thu 15 Jan 2015, 08:47    Post subject:  

666philb wrote:
probably a bit late but, if the user has say 4gb + of space you could just skip the 'calculating total required space for packages' and speed things up.

This is a good idea, but I think it should be configurable because some may just want to know how much space is going to take.
Should be easy configure.sh, in the miscellaneous tab, to set such a flag that the installed_size_window.sh will check for and bailout if present.
Here is a patch that will do that if the file /root/.packages/skip_space_check is present
Code:
--- a/usr/local/petget/installed_size_preview.sh   2015-01-11 22:53:18.000000000 +0200
+++ b/usr/local/petget/installed_size_preview.sh   2015-01-15 16:14:59.000000000 +0200
@@ -1,6 +1,8 @@
 #!/bin/sh
 # addapted from installpreview.sh
 
+[ -f /root/.packages/skip_space_check ] && exit 0
+
 REPO=$(echo $1 | cut -f 4 -d '|')
 [ ! "$REPO" ] && REPO=$(echo $1 | cut -f 2 -d '|')
 echo "$REPO" > /tmp/petget/current-repo-triad
--- a/usr/local/petget/installwindow.sh   2015-01-15 12:10:20.723698774 +0200
+++ b/usr/local/petget/installwindow.sh   2015-01-15 16:13:11.000000000 +0200
@@ -150,7 +150,7 @@
   rm -f /tmp/overall_package_status_log
   echo 0 > /tmp/petget/install_status_percent
   echo "$(gettext "Calculating total required space...")" > /tmp/petget/install_status
-  check_total_size
+  [ ! -f /root/.packages/skip_space_check ] && check_total_size
   cat /tmp/pkgs_to_install | tr ' ' '\n' > /tmp/pkgs_left_to_install
   status_bar_func &
   while read LINE; do
--- a/usr/local/petget/pkg_chooser.sh   2015-01-15 12:40:29.086712183 +0200
+++ b/usr/local/petget/pkg_chooser.sh   2015-01-15 16:26:36.000000000 +0200
@@ -8,7 +8,11 @@
 [ "$(ps | grep -E 'pkg_chooser|ppm' | grep -v grep | wc -l)" -gt 2 ] \
    && /usr/lib/gtkdialog/box_splash -timeout 3 -bg orange -text "$(gettext 'PPM is already running. Exiting.')" \
       && exit 0
-
+
+[ -f /root/.packages/skip_space_check ] && \
+   [ "$(cat /tmp/pup_event_sizefreem | head -n 1 )" -le 4000 ] && \
+   rm -f /root/.packages/skip_space_check
+
 /usr/lib/gtkdialog/box_splash -close never -bg orange -text "$(gettext 'Loading Puppy Package Manager...')" &
 SPID=$!
 
@@ -63,8 +67,10 @@
       fi
    fi
    if [ "$TREE1" ] && [ ! "$(grep -F $TREE1 /tmp/pkgs_to_install)" ]; then
-      echo 0 > /tmp/petget/install_status_percent
-      echo "$(gettext "Calculating...")" > /tmp/petget/install_status
+      if [ ! -f /root/.packages/skip_space_check ]; then
+         echo 0 > /tmp/petget/install_status_percent
+         echo "$(gettext "Calculating...")" > /tmp/petget/install_status
+      fi
       NEWPACKAGE="$(grep -F $TREE1 /tmp/petget/filterpkgs.results.post)"
       echo "$NEWPACKAGE" >> /tmp/pkgs_to_install
       add_item2 &
@@ -82,8 +88,10 @@
 
 remove_item (){
    if [ "$TREE_INSTALL" ]; then
-      echo 0 > /tmp/petget/install_status_percent
-      echo "$(gettext "Calculating...")" > /tmp/petget/install_status
+      if [ ! -f /root/.packages/skip_space_check ]; then
+         echo 0 > /tmp/petget/install_status_percent
+         echo "$(gettext "Calculating...")" > /tmp/petget/install_status
+      fi
       REMVPACKAGE="$(grep "$TREE_INSTALL" /tmp/pkgs_to_install)"
       grep -v "$TREE_INSTALL" /tmp/pkgs_to_install > /tmp/pkgs_to_install2
       mv -f /tmp/pkgs_to_install2 /tmp/pkgs_to_install

All it needs is a field in configure that will appear when the savefile is 4GB+ ([ $AVAILABLE -gt 4000 ])and provide the option to set or unset this flag. Better yet the configure option should just trigget pkg_chooser to check every time and if $AVAILABLE is adequate set this flag (as space can shrink with time but the flag will be forgotten on)

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 6629
Location: Valåmoen, Norway

PostPosted: Thu 15 Jan 2015, 11:47    Post subject:  

I have tried to implement ui_Classic back again as clean as possible. That means all ui_classic specific code is moved from the original pkg_chooser to the original ui_classic. The only new code in pkg_chooser is a check if /var/local/petget/ui_choice contains Classic, and if it does, run ui_Classic.

A couple of minor changes in the ui_classic gtkdialog code to get it corporate with our new flow.

This release is based on M5, and does not include the latest patch. Personally, I don't like ui_Classic or other options that exist for the only reason of giving us cluttered preferences (and a harder user experience).
- Who the **** wants to use ui_Classic?
- If you got 4Gb, you have a proper system, and have no problem of running the size calculation. Backrounded feedback to the user of the status is in general a good idea.


Best wishes
Sigmund
ppm_multi-12-z12.pet
Description 
pet

 Download 
Filename  ppm_multi-12-z12.pet 
Filesize  65.98 KB 
Downloaded  120 Time(s) 

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
anikin

Joined: 10 May 2012
Posts: 1020

PostPosted: Thu 15 Jan 2015, 12:53    Post subject:  

zigbert wrote:
- Who the **** wants to use ui_Classic?
Or, to be more exact, - Who the **** wants to have a choice of ui in PPM? As a user I don't give a hoot if it's called classic, ziggy or has no name at all. Decide among yourselves which one to keep and make it default. This isn't the place where choice is needed - why not keep it simple?
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3734
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Thu 15 Jan 2015, 13:11    Post subject:  

Bonsoir,
Quote:
The patches tarbal is mostly for Sigmund or anyone else that has a development git on this.
Others should just install the temp_patch-12-z11-M-phil.pet after you install the ppm_multi-12-z11-M.pet from above.

Thanks for answering!

I noticed 2 things:
When pkg_chooser.sh is edited with geany, for example, pkg_chooser.sh says, when launched, that it is already running...
Code:
cat: write error: Broken pipe
cat: write error: Broken pipe
cat: write error: Broken pipe
cat: write error: Broken pipe
cat: write error: Broken pipe

seems to be due to the progress bar coding (same problem encountered with Startmount).

Cordialement.

_________________

A second life for your PCs...
Back to top
View user's profile Send private message Visit poster's website 
mavrothal


Joined: 24 Aug 2009
Posts: 3107

PostPosted: Thu 15 Jan 2015, 13:37    Post subject:  

Argolance wrote:

seems to be due to the progress bar coding (same problem encountered with Startmount).

Agreed.
Try the latest. I believe is fixed.

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 3107

PostPosted: Thu 15 Jan 2015, 13:57    Post subject:  

zigbert wrote:
This release is based on M5, and does not include the latest patch. Personally, I don't like ui_Classic or other options that exist for the only reason of giving us cluttered preferences (and a harder user experience).
- Who the **** wants to use ui_Classic?
- If you got 4Gb, you have a proper system, and have no problem of running the size calculation. Backrounded feedback to the user of the status is in general a good idea.

As far as I am concerned the current GUI if fine. However, it is proven that on whatever change of any kind or subject (not computer related) 1/3 or more of the people will disagree. Add to that that 1/10 of the population is fairly opinionated and vocal even if at times are far from knowledgable on the matter and you get the idea.
I'd rather code and have fun than arguing about the "right thing". Set the defaults you consider sane and give the options for the naysayers Wink
So some people may just want what they have UI-wise. Let them, if there is no cost.
Same is true for size check. For some this extra second is a waste. It is easy enough to implement, why not?
There is indeed the configure interphase clutter. What about going back to your original clean one and add a button that will reveal the extra tabs or fields?

There is one thing however that I can not decide on since the start. The terminal window we use. Currently if you close it will abort the installation. This has obvious advantages and disadvantages. What is your (plural - not only Zig) take on this? Keep it like that, change it so installation will go on even if the terminal window closes or provide yet another configuration option (with what default?)

_________________
== Here is how to solve your Linux problems fast ==
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 14 of 24 [351 Posts]   Goto page: Previous 1, 2, 3, ..., 12, 13, 14, 15, 16, ..., 22, 23, 24 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1278s ][ Queries: 13 (0.0356s) ][ GZIP on ]