Check-in [f2dec708da]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:f2dec708da7095c9ec905e06b38c2fc34d43a7d5
Date: 2012-08-18 09:10:18
User: BarryK
Comment:improved Categories= and Icon= assignments in .desktop files, refer scripts 2createpackages and /usr/local/petget/installpkg.sh

Tags And Properties
Changes

Changes to woof-code/2createpackages

@@ -33,10 +33,11 @@
 #120628 fix Categories= assignment in .desktop files. see also usr/local/petget/installpkg.sh.
 #120719 support raspbian.
 #120720 raspbian wheezy has files in /lib/arm-linux-gnueabihf and /usr/lib/arm-linux-gnueabihf
 #120721 support ubuntu and debian arm multiarch.
 #120812 db category now allows optional subcategory (for which an icons exists in /usr/local/lib/X11/mini-icons).
+#120818 Categories management improved. pkg db now has category[;subcategory] (see 0setup), xdg enhanced (see /etc/xdg and /usr/share/desktop-directories), and generic icons for all subcategories (see /usr/local/lib/X11/mini-icons).
 
 export LANG=C #faster.
 
 . /etc/xdg/menus/hierarchy #w478 has PUPHIERARCHY variable.
 
@@ -546,94 +547,84 @@
      continue
     fi
    ;;
   esac
 
+  #120818 overhauled. Pkg db now has category[;subcategory] (see 0setup), xdg enhanced (see /etc/xdg and /usr/share/desktop-directories), and generic icons for all subcategories (see /usr/local/lib/X11/mini-icons).
   #w019 fix .desktop files... 120628 improve...
   DEFICON='Executable.xpm'
   FULLPKGNAME="`basename $ONEBINARYPKG`"
-  fnPATTERN='|'"$FULLPKGNAME"'|'
-  #DB_ENTRY="`cat $PKGLISTS_COMPAT | grep "$fnPATTERN" | head -n 1`"
+#  fnPATTERN='|'"$FULLPKGNAME"'|'
+#  #DB_ENTRY="`cat $PKGLISTS_COMPAT | grep "$fnPATTERN" | head -n 1`"
   DB_ENTRY="`echo -n "$ONEDBENTRY" | cut -f 4-19 -d '|'`" #take GENERICNAME|PETorCOMPAT|DBFILE| off start.
-  CATEGORY="`echo -n "$DB_ENTRY" | cut -f 5 -d '|' | cut -f 1 -d ';'`" #120812
-  #see also /usr/local/petget/installpkg.sh...
+
+  #120818 find out if Categories entry in .desktop is valid, if not use 'category' field in pkg db...
+  CATEGORY="`echo -n "$DB_ENTRY" | cut -f 5 -d '|'`" #exs: Document, Document;edit
+  [ "$CATEGORY" = "" ] && CATEGORY='BuildingBlock' #paranoid precaution.
+  #xCATEGORY and DEFICON will be the fallbacks if Categories entry in .desktop is invalid...
+  xCATEGORY="`echo -n "$CATEGORY" | sed -e 's%^%X-%' -e 's%;%-%'`" #ex: X-Document-edit (refer /etc/xdg/menu/*.menu)
+  DEFICON="`echo -n "$CATEGORY" | sed -e 's%^%mini-%' -e 's%;%-%'`" #ex: mini-Document-edit (refer /usr/local/lib/X11/mini-icons -- these are in jwm search path)
   case $CATEGORY in
-   Desktop)    xCATEGORY='X-Desktop' ; DEFICON='mini.window3d.xpm' ;;
-   System)     xCATEGORY='System' ; DEFICON='mini-term.xpm' ;;
-   Setup)      xCATEGORY='X-SetupEntry' ; DEFICON='so.xpm' ;;
-   Utility)    xCATEGORY='Utility' ; DEFICON='mini-hammer.xpm' ;;
-   Filesystem) xCATEGORY='FileSystem' ; DEFICON='mini-filemgr.xpm' ;;
-   Graphic)    xCATEGORY='Presentation' ; DEFICON='image_2.xpm' ;;
-   Document)   xCATEGORY='X-Document' ; DEFICON='mini-doc1.xpm' ;;
-   Business)   xCATEGORY='X-Calculate' ; DEFICON='mini-calc.xpm' ;; #110821 Calculate is old name, now Business.
-   Calculate)  CATEGORY='Business' ; xCATEGORY='X-Calculate' ; DEFICON='mini-calc.xpm' ;; #110821 Calculate is old name, now Business.
-   Personal)   xCATEGORY='X-Personal' ; DEFICON='mini-book2.xpm' ;;
-   Network)    xCATEGORY='Network' ; DEFICON='pc-2x.xpm' ;;
-   Internet)   xCATEGORY='X-Internet' ; DEFICON='pc2www.xpm' ;;
-   Multimedia) xCATEGORY='AudioVideo' ; DEFICON='Animation.xpm' ;;
-   Fun)        xCATEGORY='Game' ; DEFICON='mini-maze.xpm' ;;
-   Develop)    CATEGORY='Utility' ; xCATEGORY='Utility' ; DEFICON='mini-hex.xpm' ;;
-   Help)       CATEGORY='Utility' ; xCATEGORY='Utility' ; DEFICON='info16.xpm' ;;
-   BuildingBlock) CATEGORY='Utility' ; xCATEGORY='Utility' ; DEFICON='mini-hex.xpm' ;; #unlikely to have a .desktop file.
-   *)          CATEGORY='Utility' ; xCATEGORY='Utility' ; DEFICON='mini-hex.xpm' ;;    #this should not happen.
+   Calculate)     CATEGORY='Business'             ; xCATEGORY='X-Business'            ; DEFICON='mini-Business.xpm'            ;; #Calculate is old name, now Business.
+   Develop)       CATEGORY='Utility;development'  ; xCATEGORY='X-Utility-development' ; DEFICON='mini-Utility-development.xpm' ;; #maybe an old pkg has this.
+   Help)          CATEGORY='Utility'              ; xCATEGORY='Utility'               ; DEFICON='mini-Help.xpm'                ;; #maybe an old pkg has this.
+   BuildingBlock) CATEGORY='Utility'              ; xCATEGORY='Utility'               ; DEFICON='mini-BuildingBlock.xpm'       ;; #unlikely to have a .desktop file.
   esac
-  #echo "PKGLISTS_COMPAT=$PKGLISTS_COMPAT ONEBINARYPKG=$ONEBINARYPKG CATEGORY=$CATEGORY" #TEST
-  tPATTERN="^${CATEGORY} "
+  #check validity of Categories= and Icon= entries in .desktop file...
+  topCATEGORY="`echo -n "$CATEGORY" | cut -f 1 -d ';'`"
+  tPATTERN="^${topCATEGORY} "
   cPATTERN="s%^Categories=.*%Categories=${xCATEGORY}%"
   iPATTERN="s%^Icon=.*%Icon=${DEFICON}%"
   FND_DESKTOP="`find sandbox2/usr/share/applications sandbox2/usr/local/share/applications sandbox2/usr/X11R7/applications -type f -name \*.desktop 2>/dev/null | tr '\n' ' '`"
   for ONEDESKTOP in $FND_DESKTOP
   do
-   #w478 find if category is already valid...
    CATFOUND="no"
    for ONEORIGCAT in `cat $ONEDESKTOP | grep '^Categories=' | head -n 1 | cut -f 2 -d '=' | tr ';' ' ' | rev` #search in reverse order.
    do
+    #find out if category already valid, if not fallback to xCATEGORY...
     ONEORIGCAT="`echo -n "$ONEORIGCAT" | rev`" #restore rev of one word.
     oocPATTERN=' '"$ONEORIGCAT"' '
     [ "`echo "$PUPHIERARCHY" | tr -s ' ' | grep "$tPATTERN" | cut -f 3 -d ' ' | tr ',' ' ' | sed -e 's%^% %' -e 's%$% %' | grep "$oocPATTERN"`" != "" ] && CATFOUND="yes"
     #got a problem with sylpheed, "Categories=GTK;Network;Email;News;" this displays in both Network and Internet menus...
     if [ "$CATFOUND" = "yes" ];then
      cPATTERN="s%^Categories=.*%Categories=${ONEORIGCAT}%"
      break
     fi
    done
-   #if [ "$CATFOUND" = "no" ];then
-    sed -i -e "$cPATTERN" $ONEDESKTOP
-   #fi
+   sed -i -e "$cPATTERN" $ONEDESKTOP #fix Category field.
    #does the icon exist?... fix .desktop... 110821 improve...
    ICON="`grep '^Icon=' $ONEDESKTOP | cut -f 2 -d '='`"
    if [ "$ICON" != "" ];then
     [ -e "sandbox2${ICON}" ] && continue #it may have a hardcoded path.
     [ -e "${ICON}" ] && continue #it may have a hardcoded path, look in running puppy.
-    #if [ "`echo -n "$ICON" | cut -c 1`" != "/" ];then #w478 absolute path.
-     ICONBASE="`basename "$ICON"`"
-     #first search where jwm looks for icons... 111207 check if paths exist...
-     FNDICON=""
-     [ -d sandbox2/usr/share/pixmaps ] && FNDICON="`find sandbox2/usr/share/pixmaps -maxdepth 1 -name $ICONBASE -o -name $ICONBASE.png -o -name $ICONBASE.xpm -o -name $ICONBASE.jpg -o -name $ICONBASE.jpeg -o -name $ICONBASE.gif -o -name $ICONBASE.svg | grep -i -E 'png$|xpm$|jpg$|jpeg$|gif$|svg$' | head -n 1`"
-     [ ! "$FNDICON" ] && [ -d sandbox2/usr/local/lib/X11/mini-icons ] && FNDICON="`find sandbox2/usr/local/lib/X11/mini-icons -maxdepth 1 -name $ICONBASE -o -name $ICONBASE.png -o -name $ICONBASE.xpm -o -name $ICONBASE.jpg -o -name $ICONBASE.jpeg -o -name $ICONBASE.gif -o -name $ICONBASE.svg | grep -i -E 'png$|xpm$|jpg$|jpeg$|gif$|svg$' | head -n 1`"
+    ICONBASE="`basename "$ICON"`"
+    #first search where jwm looks for icons... 111207 check if paths exist...
+    FNDICON=""
+    [ -d sandbox2/usr/share/pixmaps ] && FNDICON="`find sandbox2/usr/share/pixmaps -maxdepth 1 -name $ICONBASE -o -name $ICONBASE.png -o -name $ICONBASE.xpm -o -name $ICONBASE.jpg -o -name $ICONBASE.jpeg -o -name $ICONBASE.gif -o -name $ICONBASE.svg | grep -i -E 'png$|xpm$|jpg$|jpeg$|gif$|svg$' | head -n 1`"
+    [ ! "$FNDICON" ] && [ -d sandbox2/usr/local/lib/X11/mini-icons ] && FNDICON="`find sandbox2/usr/local/lib/X11/mini-icons -maxdepth 1 -name $ICONBASE -o -name $ICONBASE.png -o -name $ICONBASE.xpm -o -name $ICONBASE.jpg -o -name $ICONBASE.jpeg -o -name $ICONBASE.gif -o -name $ICONBASE.svg | grep -i -E 'png$|xpm$|jpg$|jpeg$|gif$|svg$' | head -n 1`"
+    if [ "$FNDICON" ];then
+     ICONNAMEONLY="`basename $FNDICON`"
+     iPTN="s%^Icon=.*%Icon=${ICONNAMEONLY}%"
+     sed -i -e "$iPTN" $ONEDESKTOP
+     continue
+    else
+     #look elsewhere, including in running puppy... 111207 fix for parole /usr/share/parole/parole.png...
+     FNDICON="`find sandbox2 /usr/share/icons /usr/local/share/pixmaps /usr/share/pixmaps -name $ICONBASE -o -name $ICONBASE.png -o -name $ICONBASE.xpm -o -name $ICONBASE.jpg -o -name $ICONBASE.jpeg -o -name $ICONBASE.gif -o -name $ICONBASE.svg  | sed -e 's%sandbox2%%' | grep -i -E 'png$|xpm$|jpg$|jpeg$|gif$|svg$' | head -n 1`"
      if [ "$FNDICON" ];then
-      ICONNAMEONLY="`basename $FNDICON`"
+      ICONNAMEONLY="`basename "$FNDICON"`"
+      mkdir -p sandbox2/usr/share/pixmaps #120514
+      ln -snf "$FNDICON" sandbox2/usr/share/pixmaps/${ICONNAMEONLY} #111207 fix path.
       iPTN="s%^Icon=.*%Icon=${ICONNAMEONLY}%"
       sed -i -e "$iPTN" $ONEDESKTOP
       continue
-     else
-      #look elsewhere, including in running puppy... 111207 fix for parole /usr/share/parole/parole.png...
-      FNDICON="`find sandbox2 /usr/share/icons /usr/local/share/pixmaps /usr/share/pixmaps -name $ICONBASE -o -name $ICONBASE.png -o -name $ICONBASE.xpm -o -name $ICONBASE.jpg -o -name $ICONBASE.jpeg -o -name $ICONBASE.gif -o -name $ICONBASE.svg  | sed -e 's%sandbox2%%' | grep -i -E 'png$|xpm$|jpg$|jpeg$|gif$|svg$' | head -n 1`"
-      if [ "$FNDICON" ];then
-       ICONNAMEONLY="`basename "$FNDICON"`"
-       mkdir -p sandbox2/usr/share/pixmaps #120514
-       ln -snf "$FNDICON" sandbox2/usr/share/pixmaps/${ICONNAMEONLY} #111207 fix path.
-       iPTN="s%^Icon=.*%Icon=${ICONNAMEONLY}%"
-       sed -i -e "$iPTN" $ONEDESKTOP
-       continue
-      fi
      fi
-    #fi
+    fi
     #substitute a default icon...
     sed -i -e "$iPATTERN" $ONEDESKTOP
    fi
   done
+
   #w019 T2 pkgs have /var/adm...
   [ -d sandbox2/var/adm ] && rm -rf sandbox2/var/adm
   #and these...
   [ -d sandbox2/etc/postinstall.d ] && rm -rf sandbox2/etc/postinstall.d
   [ -d sandbox2/etc/stone.d ] && rm -rf sandbox2/etc/stone.d

Changes to woof-code/rootfs-skeleton/etc/xdg/menus/hierarchy


Changes to woof-code/rootfs-skeleton/usr/local/petget/installpkg.sh

@@ -27,10 +27,11 @@
 #120107 rerwin: need quotes around some paths in case of space chars. remove '--unlink-first' from tar (was introduced 120102, don't think necessary).
 #120126 noryb009: fix typo.
 #120219 was not properly internationalized (there was no TEXTDOMAIN).
 #120523 may need to run gio-query-modules and/or glib-compile-schemas. (refer also rc.update and 3builddistro)
 #120628 fix Categories= assignment in .desktop files. see also 2createpackages in woof.
+#120818 Categories management improved. pkg db now has category[;subcategory] (see 0setup), xdg enhanced (see /etc/xdg and /usr/share/desktop-directories), and generic icons for all subcategories (see /usr/local/lib/X11/mini-icons).
 
 #information from 'labrador', to expand a .pet directly to '/':
 #NAME="a52dec-0.7.4"
 #pet2tgz "${NAME}.pet"
 #tar -C / --transform 's/^\(\.\/\)\?'"$NAME"'//g' -zxf "${NAME}.tar.gz"
@@ -351,37 +352,26 @@
  DB_ENTRY=`echo "$DB_ENTRY" |sed "s#$db_pkg_name#$DLPKG_NAME#"`
 fi
 ##+++2011-12-27 KRG
 
 #see if a .desktop file was installed, fix category... 120628 improve...
+#120818 overhauled. Pkg db now has category[;subcategory] (see 0setup), xdg enhanced (see /etc/xdg and /usr/share/desktop-directories), and generic icons for all subcategories (see /usr/local/lib/X11/mini-icons).
+#note, similar code also in Woof 2createpackages.
 ONEDOT=""
-DEFICON='Executable.xpm'
-CATEGORY="`echo -n "$DB_ENTRY" | cut -f 5 -d '|'`"
-#fix category so finds a place in menu... (same code in woof 2createpackages)
-#i think allow field5 to specify a sub-category, 'category;subcategory'
-#if no sub-cat then it will come into one of these cases:
+CATEGORY="`echo -n "$DB_ENTRY" | cut -f 5 -d '|'`" #exs: Document, Document;edit
+[ "$CATEGORY" = "" ] && CATEGORY='BuildingBlock' #paranoid precaution.
+#xCATEGORY and DEFICON will be the fallbacks if Categories entry in .desktop is invalid...
+xCATEGORY="`echo -n "$CATEGORY" | sed -e 's%^%X-%' -e 's%;%-%'`" #ex: X-Document-edit (refer /etc/xdg/menu/*.menu)
+DEFICON="`echo -n "$CATEGORY" | sed -e 's%^%mini-%' -e 's%;%-%'`" #ex: mini-Document-edit (refer /usr/local/lib/X11/mini-icons -- these are in jwm search path)
 case $CATEGORY in
- Desktop)    xCATEGORY='X-Desktop' ; DEFICON='mini.window3d.xpm' ;;
- System)     xCATEGORY='System' ; DEFICON='mini-term.xpm' ;;
- Setup)      xCATEGORY='X-SetupEntry' ; DEFICON='so.xpm' ;;
- Utility)    xCATEGORY='Utility' ; DEFICON='mini-hammer.xpm' ;;
- Filesystem) xCATEGORY='FileSystem' ; DEFICON='mini-filemgr.xpm' ;;
- Graphic)    xCATEGORY='Presentation' ; DEFICON='image_2.xpm' ;;
- Document)   xCATEGORY='X-Document' ; DEFICON='mini-doc1.xpm' ;;
- Business)   xCATEGORY='X-Calculate' ; DEFICON='mini-calc.xpm' ;; #110821 Calculate is old name, now Business.
- Calculate)  CATEGORY='Business' ; xCATEGORY='X-Calculate' ; DEFICON='mini-calc.xpm' ;; #110821 Calculate is old name, now Business.
- Personal)   xCATEGORY='X-Personal' ; DEFICON='mini-book2.xpm' ;;
- Network)    xCATEGORY='Network' ; DEFICON='pc-2x.xpm' ;;
- Internet)   xCATEGORY='X-Internet' ; DEFICON='pc2www.xpm' ;;
- Multimedia) xCATEGORY='AudioVideo' ; DEFICON='Animation.xpm' ;;
- Fun)        xCATEGORY='Game' ; DEFICON='mini-maze.xpm' ;;
- Develop)    CATEGORY='Utility' ; xCATEGORY='Utility' ; DEFICON='mini-hex.xpm' ;;
- Help)       CATEGORY='Utility' ; xCATEGORY='Utility' ; DEFICON='info16.xpm' ;;
- BuildingBlock) CATEGORY='Utility' ; xCATEGORY='Utility' ; DEFICON='mini-hex.xpm' ;; #unlikely to have a .desktop file.
- *)          CATEGORY='Utility' ; xCATEGORY='Utility' ; DEFICON='mini-hex.xpm' ;;    #this should not happen.
+ Calculate)     CATEGORY='Business'             ; xCATEGORY='X-Business'            ; DEFICON='mini-Business.xpm'            ;; #Calculate is old name, now Business.
+ Develop)       CATEGORY='Utility;development'  ; xCATEGORY='X-Utility-development' ; DEFICON='mini-Utility-development.xpm' ;; #maybe an old pkg has this.
+ Help)          CATEGORY='Utility'              ; xCATEGORY='Utility'               ; DEFICON='mini-Help.xpm'                ;; #maybe an old pkg has this.
+ BuildingBlock) CATEGORY='Utility'              ; xCATEGORY='Utility'               ; DEFICON='mini-BuildingBlock.xpm'       ;; #unlikely to have a .desktop file.
 esac
-tPATTERN="^${CATEGORY} "
+topCATEGORY="`echo -n "$CATEGORY" | cut -f 1 -d ';'`"
+tPATTERN="^${topCATEGORY} "
 cPATTERN="s%^Categories=.*%Categories=${xCATEGORY}%"
 iPATTERN="s%^Icon=.*%Icon=${DEFICON}%"
 for ONEDOT in `grep '\.desktop$' /root/.packages/${DLPKG_NAME}.files | tr '\n' ' '`
 do
  #w478 find if category is already valid...
@@ -395,15 +385,11 @@
   if [ "$CATFOUND" = "yes" ];then
    cPATTERN="s%^Categories=.*%Categories=${ONEORIGCAT}%"
    break
   fi
  done
- #if [ "$CATFOUND" = "no" ];then
-  sed -i -e "$cPATTERN" $ONEDOT
- #else
- # CATEGORY="`echo -n "$ONEORIGCAT" | rev | cut -f 1 -d ' ' | rev`" #w482
- #fi
+ sed -i -e "$cPATTERN" $ONEDOT #fix Categories= entry.
  #w019 does the icon exist?...
  ICON="`grep '^Icon=' $ONEDOT | cut -f 2 -d '='`"
  if [ "$ICON" != "" ];then
   [ -e "$ICON" ] && continue #it may have a hardcoded path.
   ICONBASE="`basename "$ICON"`"

Deleted woof-code/rootfs-skeleton/usr/share/sss/desk_strings/desk_strings.de

Deleted woof-code/rootfs-skeleton/usr/share/sss/initrd_strings/initrd_strings.de

Deleted woof-code/rootfs-skeleton/usr/share/sss/menu_strings/menu_strings.de