[debian-edu-commits] debian-edu/ 40/183: - fixed list-desktop-profiles to work with multiple dirs - allow whitespace before '#' marker in comments - optimization of Xsession.d script -> only test requirements once, instead of once for each profile kind. This script is now up to 6 times faster (if all profile kinds are activated), execution speed is no longer noticably depend on the number of active profile kinds (unless you have insane amounts of profiles that is) - There's no real reason anymore to deactivate profile kinds anymore -> loose the debconf question. - fixed typo in manpage of list-desktop-profiles

Alexander Alemayhu ccscanf-guest at moszumanska.debian.org
Wed Jun 11 16:48:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

ccscanf-guest pushed a commit to branch master
in repository desktop-profiles.

commit 6d7a4acbc19231180fce4eae1039e2f9069634aa
Author: Bart Cornelis <cobaco at linux.be>
Date:   Tue Jan 11 19:10:43 2005 +0000

    - fixed list-desktop-profiles to work with multiple dirs
    - allow whitespace before '#' marker in comments
    - optimization of Xsession.d script -> only test requirements once, instead of once for each
      profile kind. This script is now up to 6 times faster (if all profile kinds are activated),
      execution speed is no longer noticably depend on the number of active profile kinds
      (unless you have insane amounts of profiles that is)
    - There's no real reason anymore to deactivate profile kinds anymore -> loose the debconf
      question.
    - fixed typo in manpage of list-desktop-profiles
---
 20desktop-profiles_activateDesktopProfiles | 49 ++++++++++++++++++----------
 TODO                                       |  7 ++--
 debian/changelog                           |  9 +++---
 debian/config                              | 15 ---------
 debian/po/nl.po                            | 51 +++++++++++++++++++-----------
 debian/po/templates.pot                    | 19 +----------
 debian/postinst                            | 23 --------------
 debian/templates                           | 11 -------
 desktop-profiles                           | 11 +++----
 list-desktop-profiles.1                    |  2 +-
 listingmodule                              | 12 +++----
 11 files changed, 86 insertions(+), 123 deletions(-)

diff --git a/20desktop-profiles_activateDesktopProfiles b/20desktop-profiles_activateDesktopProfiles
index 30be219..421c9a0 100644
--- a/20desktop-profiles_activateDesktopProfiles
+++ b/20desktop-profiles_activateDesktopProfiles
@@ -20,25 +20,33 @@ else
   errormsg "Shell library $LIB is missing! No desktop profiles will be activated.";
 fi;
 
-############################################################
-# get the listings for all profiles of the kind given as $1 
-# $1 = one of (KDE, ROX, UDE, GCONF, XDG_DATA or XDG_CONFIG)
-############################################################
-get_profiles() {
+################################################################################
+# Get a preference sorted list of all profiles that have their requirements met
+################################################################################
+sort_profiles(){
   (# get profiles that are have fulfilled requirements
-     cat $(list_listings) | grep -v "^#" | while read PROFILE; do
+     cat $(list_listings) | grep -v -e "^[[:space:]]*#" -e "^[[:space:]]*$" | while read PROFILE; do
       if (test_profile_requirements "$PROFILE"); then
         echo $PROFILE;      
       fi;  
     done;
    #and sort them by preference
-  ) | sort --reverse --general-numeric-sort --field-separator=";" --key 3 | \
-  while read PROFILE; do
+  ) | sort --reverse --general-numeric-sort --field-separator=";" --key 3
+}
+
+############################################################
+# get the listings for all profiles of the kind given as $1 
+# $1 = one of (KDE, ROX, UDE, GCONF, XDG_DATA or XDG_CONFIG)
+############################################################
+get_profiles() {
+  PROFILES_LIST=${PROFILES_LIST:-`sort_profiles`}
+
+  echo $PROFILES_LIST | while read PROFILE; do
     # output the profile-root if this is the right profile kind
     if echo -n `echo "$PROFILE" | cut --fields 5 --delimiter ";"` | grep $1 > /dev/null; then
-      if (test "$1" != "GCONF"); then
+      if (test "$1" != "GCONF"); then 
         echo -n "`echo "$PROFILE" | cut --fields 2 --delimiter ";"` ";
-      else	
+      else
         echo "`echo "$PROFILE" | cut --fields 2 --delimiter ";"` ";
       fi;	
     fi;
@@ -48,7 +56,6 @@ get_profiles() {
 ##########################################################
 # Functions for activating the different kinds of profile
 ##########################################################
-DEFAULT_LISTING=/etc/desktop-profiles/desktop-profiles.listing
 activate_KDE () {
   KDEDIRS=`get_profiles KDE | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`
   if (test "$KDEDIRS"x != x) &&
@@ -153,12 +160,20 @@ activate_GCONF () {
   # Make sure the variable we need are initialized
   #################################################
   LISTINGS_DIRS=${LISTINGS_DIRS:-'/etc/desktop-profiles'}
-  PROFILE_PATH_FILES_DIR=${PROFILE_PATH_FILES_DIR:-'/var/cache/desktop-profiles/'}
   ACTIVE_PROFILE_KINDS=${ACTIVE_PROFILE_KINDS:-''}
+  DEFAULT_LISTING=/etc/desktop-profiles/desktop-profiles.listing
+  PROFILE_PATH_FILES_DIR=${PROFILE_PATH_FILES_DIR:-'/var/cache/desktop-profiles/'}
 
-  ################################
+  ############################################################
   # Actual activation of profiles
-  ################################
-  for KIND in $ACTIVE_PROFILE_KINDS; do
-    activate_$KIND;
-  done;
+  # don't test requirements if no profile kinds are activated
+  ############################################################
+  if (test "$ACTIVE_PROFILE_KINDS"x != "x"); then
+    # initalize this var here in stead of in get_profiles
+    # (_MAJOR_ speedup when there are multiple profile kinds active)
+    PROFILES_LIST=$(sort_profiles) 
+
+    for KIND in $ACTIVE_PROFILE_KINDS; do
+      activate_$KIND;
+    done;
+  fi;  
diff --git a/TODO b/TODO
index 5db6e8c..7b39678 100644
--- a/TODO
+++ b/TODO
@@ -2,15 +2,18 @@
   - add kiosktool to Suggests when it becomes available in Debian (can i suggest
     something not yet in the archive?)
     
-  - Are there any docs on the kiosk system of XFCE 4.2 available anywhere we can
+  - Are there any docs on the kiosk system of XFCE 4.2 available anywhere we can  	
     point to? -> not yet apperently
+    -> panel: http://www.loculus.nl/xfce/documentation/docs-4.2/xfce4-panel.html#panel-kiosk
+    -> xfce4-session: 
+       
 
 - Tools to build (cross-desktop) profiles? (if at all possible)
   - background
   - add something to desktop/panel/bookmarks/menu
   
+- Tooltip for splitter in kommander gui	
 - Find sponsor  
   -> switch debian-edu-config + desktop-base to use desktop-profiles
-  -> get dh_installlisting into debhelper
   -> talk to gconf-maintainers, to have gconf support this package (current
      system-wide gconf path file needs replacing with the one from this package)
diff --git a/debian/changelog b/debian/changelog
index 3e61a3e..4192517 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,14 +2,13 @@ desktop-profiles (1.2-1) unstable; urgency=low
 
   * Added kommander GUI for managing the /etc/desktop-profiles/*.listing files
   * Added debhelper program for installing .listing files (and use it)
-  * Add medium priority debconf questions to allow using dpkg-reconfigure to
-    manage the profile kinds in use. I Should probably extend this to allow 
-    full handling of the configuration file through debconf, but this is the 
-    only option that should be routinely changed.
   * Make it possible to specify additional directories containg .listing files
     (usefull for testing)
+  * Optimization in Xsession.d script: only test requirements once, instead of
+    once for each profile kind. Provides major speedup since execution time is
+    now mostly independ from the number of active profile kinds.
 
- -- Bart Cornelis (cobaco) <cobaco at linux.be>  Wed,  5 Jan 2005 22:09:04 +0100
+ -- Bart Cornelis (cobaco) <cobaco at linux.be>  Mon, 10 Jan 2005 16:43:50 +0100
 
 desktop-profiles (1.1-2) unstable; urgency=low
 
diff --git a/debian/config b/debian/config
index aa7cb7f..9747645 100755
--- a/debian/config
+++ b/debian/config
@@ -18,18 +18,3 @@ elif (test -e /etc/gconf/2/path) ; then
     db_go || true;
   fi;
 fi;  
-
-# override defaults with actual values from config file (if it's present)
-if (test -e /etc/default/desktop-profiles); then
-  . /etc/default/desktop-profiles || true;
-  
-  # change contents of variable to listformat expected by debconf
-  # (i.e. separate with ', ' instead of just ' ')
-  ACTIVE_PROFILE_KINDS="$(echo "$ACTIVE_PROFILE_KINDS" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /, /g")";
-  db_set desktop-profiles/active-profile-kinds "$ACTIVE_PROFILE_KINDS";
-fi;
-
-# Allow user to change the configuration values
-db_input medium desktop-profiles/active-profile-kinds || true;
-db_go || true;
-
diff --git a/debian/po/nl.po b/debian/po/nl.po
index 4fadcd0..377ac01 100644
--- a/debian/po/nl.po
+++ b/debian/po/nl.po
@@ -15,7 +15,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: desktop-profiles\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-01-05 20:53+0100\n"
+"POT-Creation-Date: 2005-01-10 16:56+0100\n"
 "PO-Revision-Date: 2005-01-05 21:21+0100\n"
 "Last-Translator: Bart Cornelis <cobaco at linux.be>\n"
 "Language-Team: debian-l10n-dutch <debian-l10n-dutch at lists.debian.org>\n"
@@ -25,32 +25,47 @@ msgstr ""
 "X-Poedit-Language: nl\n"
 
 #. Type: boolean
+#. Description
 #: ../templates:4
 msgid "Replace the default system-wide path file?"
 msgstr "Systeemwijd 'path'-bestand vervangen?"
 
 #. Type: boolean
+#. Description
 #: ../templates:4
-msgid "The default gconf (i.e. GNOME) setup doesn't facilitate the use of profiles for certain groups only. The approach used by this package does. To have gconf use the approach of this package the system-wide gconf 'path' file needs to be replaced by one provided by this package."
-msgstr "De default gconf (en dus GNOME) instellingen ondersteunen het gebruik van profielen voor bepaalde groepen niet. Dit pakket voorziet een aanpak die dit wel ondersteund. Om ervoor te zorgen dat gconf de aanpak van dit pakket gebruikt dient het systeemwijde 'path'-bestand vervangen te worden door het door dit pakket voorziene 'path'-bestand."
+msgid ""
+"The default gconf (i.e. GNOME) setup doesn't facilitate the use of profiles "
+"for certain groups only. The approach used by this package does. To have "
+"gconf use the approach of this package the system-wide gconf 'path' file "
+"needs to be replaced by one provided by this package."
+msgstr ""
+"De default gconf (en dus GNOME) instellingen ondersteunen het gebruik van "
+"profielen voor bepaalde groepen niet. Dit pakket voorziet een aanpak die dit "
+"wel ondersteund. Om ervoor te zorgen dat gconf de aanpak van dit pakket "
+"gebruikt dient het systeemwijde 'path'-bestand vervangen te worden door het "
+"door dit pakket voorziene 'path'-bestand."
 
 #. Type: boolean
+#. Description
 #: ../templates:4
-msgid "Doin so won't change the default behaviour of gconf but it will allow the subsequent installation and activation of gconf profiles. Thus it is recommended that you let me replace the default system-wide gconf 'path' file."
-msgstr "Dit veranderdt het standaardgedrag van gconf niet, maar laat wel toe om later gconf profielen te installeren en te activeren. Het is bijgevolg aan te raden om het default systeemwijde 'path'-bestand te vervangen."
+msgid ""
+"Doin so won't change the default behaviour of gconf but it will allow the "
+"subsequent installation and activation of gconf profiles. Thus it is "
+"recommended that you let me replace the default system-wide gconf 'path' "
+"file."
+msgstr ""
+"Dit veranderdt het standaardgedrag van gconf niet, maar laat wel toe om "
+"later gconf profielen te installeren en te activeren. Het is bijgevolg aan "
+"te raden om het default systeemwijde 'path'-bestand te vervangen."
 
 #. Type: boolean
+#. Description
 #: ../templates:4
-msgid "You can always do this later by running `dpkg-reconfigure desktop-profiles', or by manually replacing /etc/gconf/<gconf-version>/path with /usr/share/doc/desktop-profiles/examples/path."
-msgstr "U kunt dit altijd later doen via het commando 'desktop-reconfigure desktop-profiles', of door handmatig /etc/gconf/<gconf-version>path te vervangen door /usr/share/doc/desktop-profiles/examples/path"
-
-#. Type: multiselect
-#: ../templates:23
-msgid "Which profile kinds do you want to enable?"
-msgstr "Welke profiel-soorten wilt u inschakelen?"
-
-#. Type: multiselect
-#: ../templates:23
-msgid "Disabling profile kinds you won't use will improve performance of the  Xsession.d script of this package (and thus of X startup). Thus it is wise to only activate profiles kinds that will be used by the  programs you'll run. (e.g. most people won't have any ROX or UDE apps installed in which case those 2 profile kinds shouldn't be enabled)."
-msgstr "Uitschakelen van profiel-soorten die niet gebruikt zullen worden versnelt de uitvoering van het 'Xsession.d'-script van dit pakket (en dus het opstarten van de grafische interface). Om die reden kunt u best enkel die profiel-soorten activeren die van belang zijn voor de door u gebruikte programma's (vb. tenzij u een van de weinigen bent die ROX- of UDE-programma's ge�nstalleerd heeft, kunt u deze profiel-soorten best niet activeren)."
-
+msgid ""
+"You can always do this later by running `dpkg-reconfigure desktop-profiles', "
+"or by manually replacing /etc/gconf/<gconf-version>/path with /usr/share/doc/"
+"desktop-profiles/examples/path."
+msgstr ""
+"U kunt dit altijd later doen via het commando 'desktop-reconfigure desktop-"
+"profiles', of door handmatig /etc/gconf/<gconf-version>path te vervangen "
+"door /usr/share/doc/desktop-profiles/examples/path"
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
index 8b923b6..baeb10c 100644
--- a/debian/po/templates.pot
+++ b/debian/po/templates.pot
@@ -16,7 +16,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-01-05 20:53+0100\n"
+"POT-Creation-Date: 2005-01-10 16:56+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -58,20 +58,3 @@ msgid ""
 "or by manually replacing /etc/gconf/<gconf-version>/path with /usr/share/doc/"
 "desktop-profiles/examples/path."
 msgstr ""
-
-#. Type: multiselect
-#. Description
-#: ../templates:23
-msgid "Which profile kinds do you want to enable?"
-msgstr ""
-
-#. Type: multiselect
-#. Description
-#: ../templates:23
-msgid ""
-"Disabling profile kinds you won't use will improve performance of the  "
-"Xsession.d script of this package (and thus of X startup). Thus it is wise "
-"to only activate profiles kinds that will be used by the  programs you'll "
-"run. (e.g. most people won't have any ROX or UDE apps installed in which "
-"case those 2 profile kinds shouldn't be enabled)."
-msgstr ""
diff --git a/debian/postinst b/debian/postinst
index ffb2df7..3ff2eee 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -28,27 +28,4 @@ if (test "$RET" = true); then
   fi;  
 fi;
 
-###############################################################################
-# Adapt config-file as indicated by user answers to debconf questions
-#
-# The cp + mv are to ensures we do not mess up the config file's ownership and
-# permissions.
-###############################################################################
-CONFIGFILE=/etc/default/desktop-profiles
-
-cp -a -f $CONFIGFILE $CONFIGFILE.tmp
-  # Sync (possibly modified) debconf db setting for which profile kinds to 
-  # activate with the config file (from which that settings was initialized)
-  db_get desktop-profiles/active-profile-kinds  
-  ACTIVE_PROFILE_KINDS="$( echo "$RET" | sed 's/, / /g' )"; # switch from debconf listformat to shell listformat
-
-  if (grep -Eq '^ *ACTIVE_PROFILE_KINDS=' $CONFIGFILE); then 
-    cat $CONFIGFILE | sed -e "s/^ *ACTIVE_PROFILE_KINDS=.*/ACTIVE_PROFILE_KINDS=\"$ACTIVE_PROFILE_KINDS\"/" > $CONFIGFILE.tmp;
-  else
-    echo "ACTIVE_PROFILE_KINDS=\"$ACTIVE_PROFILE_KINDS\"" >> $CONFIGFILE.tmp;
-  fi;  
-
-  #FIXME: rest of values in config file maybe
-mv -f $CONFIGFILE.tmp $CONFIGFILE
-
 #DEBHELPER#
diff --git a/debian/templates b/debian/templates
index 54fb4cd..7286726 100644
--- a/debian/templates
+++ b/debian/templates
@@ -15,14 +15,3 @@ _Description: Replace the default system-wide path file?
  You can always do this later by running `dpkg-reconfigure desktop-profiles',
  or by manually replacing /etc/gconf/<gconf-version>/path with
  /usr/share/doc/desktop-profiles/examples/path.
-
-Template: desktop-profiles/active-profile-kinds
-Type: multiselect
-Choices: XDG_CONFIG, XDG_DATA, KDE, GCONF, ROX, UDE
-Default: XDG_CONFIG, XDG_DATA, KDE, GCONF
-_Description: Which profile kinds do you want to enable?
- Disabling profile kinds you won't use will improve performance of the 
- Xsession.d script of this package (and thus of X startup). 
- Thus it is wise to only activate profiles kinds that will be used by the
- programs you'll run. (e.g. most people won't have any ROX or UDE apps 
- installed in which case those 2 profile kinds shouldn't be enabled).
diff --git a/desktop-profiles b/desktop-profiles
index 9826143..cbe0686 100644
--- a/desktop-profiles
+++ b/desktop-profiles
@@ -21,12 +21,11 @@ LISTINGS_DIRS="/etc/desktop-profiles"
 # profile kinds. The following variable contains the subset of profile kinds
 # for which you want to activate the profiles.
 #
-# Disabling profile kinds you won't use will improve performance of the
-# Xsession.d script (and thus X startup). Thus it is wise to only activate 
-# profile kinds that will be used by the programs you'll run 
-# (e.g. most people won't have any ROX or UDE apps installed in which case 
-# those 2 profile kinds probably shouldn't be enabled).
-ACTIVE_PROFILE_KINDS="KDE XDG_CONFIG XDG_DATA GCONF"
+# Disabling profile kinds you don't used to cause a noticable decrease in the 
+# time needed to run this script. The problem that caused that has been solved
+# and the difference is no longer really noticable. It's probably not worth 
+# the bother to mess with this.
+ACTIVE_PROFILE_KINDS="KDE XDG_CONFIG XDG_DATA GCONF ROX UDE"
 
 ##############################################
 # SETTINGS FOR list-desktop-profiles 
diff --git a/list-desktop-profiles.1 b/list-desktop-profiles.1
index bbd7a0c..2ee537a 100644
--- a/list-desktop-profiles.1
+++ b/list-desktop-profiles.1
@@ -70,7 +70,7 @@ list-desktop-profiles -k KDE -s precedence -u user1
 List all kde-profiles that will be activated for user1 in order of precedence.
 
 .PP
-list-desktop-profiles -k 'KDE\|GCONF'
+list-desktop-profiles -k 'KDE\\|GCONF'
 .IP
 List all kde and gnome profiles.
 .PP
diff --git a/listingmodule b/listingmodule
index a5fc58d..df74c76 100644
--- a/listingmodule
+++ b/listingmodule
@@ -159,8 +159,9 @@ list_listings () {
   # Make sure the variable we need are initialized
   LISTINGS_DIRS=${LISTINGS_DIRS:-'/etc/desktop-profiles'}
 
-  for DIR in "$LISTINGS_DIRS"; do
+  for DIR in $LISTINGS_DIRS; do
     echo -n $(ls -1 $DIR/*.listing);
+    echo -n " ";
   done;
   
   echo;
@@ -189,8 +190,6 @@ list_listings () {
 # - SORT_ARGS: extra arguments to be given to the sort command (e.g. when
 #   sorting on the precedence field (3) you probably want to set this to
 #   '--general-numeric-sort --reverse')
-# - EXTRA_LISTINGS: may contain a comma-separated list of extra (outside the 
-#   $LISTINGS_DIRS) .listing files to be taken into account.
 # - LISTINGS_DIRS: the directory containing the .listing files to include 
 #   (defaults to '/etc/desktop-profiles', probably shouldn't be changed ever)
 #
@@ -202,8 +201,6 @@ list_listings () {
 ###############################################################################
 filter_listings () {
   # Make sure the variable we need are initialized
-  #LISTINGS_DIRS=${LISTINGS_DIRS:-'/etc/desktop-profiles'}
-  #EXTRA_LISTINGS=${EXTRA_LISTINGS:-''}
 
   SORT_KEY=${SORT_KEY:-1}
   SORT_ARGS=${SORT_ARGS:-''}
@@ -220,8 +217,9 @@ filter_listings () {
   FORMAT=${FORMAT:-'$NAME\;$LOCATION\;$PRECEDENCE\;$REQUIREMENTS\;$KIND\;$DESCRIPTION'};
   
   LISTINGS_LIST=$(list_listings)
+
   # do the filtering
-  cat $LISTINGS_LIST |  grep -v -e "^#" -e "^ *$" | sort $SORT_ARGS --key="$SORT_KEY" --field-separator=';' | \
+  cat $LISTINGS_LIST |  grep -v -e "^[[:space:]]*#" -e "^[[:space:]]*$" | sort $SORT_ARGS --key="$SORT_KEY" --field-separator=';' | \
   while read PROFILE; do
     # split fields
     export NAME="`echo $PROFILE | cut --delimiter ';' --fields 1`";
@@ -231,7 +229,7 @@ filter_listings () {
     export KIND="`echo $PROFILE | cut --delimiter ';' --fields 5`";
     export DESCRIPTION="`echo $PROFILE | cut --delimiter ';' --fields 6`";
 
-    export FILE=`grep -l "^$NAME;" $LISTINGS_LIST`;
+    export FILE=`cat $LISTINGS_LIST | grep -l "^$NAME;"`;
 
     if (test "$PRECEDENCE"x = x); then 
       #unset = lower then anything, so set to insanely low value

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/desktop-profiles.git



More information about the debian-edu-commits mailing list