Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package xdg-terminal-exec for 
openSUSE:Factory checked in at 2023-10-27 22:28:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xdg-terminal-exec (Old)
 and      /work/SRC/openSUSE:Factory/.xdg-terminal-exec.new.17445 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "xdg-terminal-exec"

Fri Oct 27 22:28:09 2023 rev:3 rq:1120603 version:20231014+git.b6d2874

Changes:
--------
--- /work/SRC/openSUSE:Factory/xdg-terminal-exec/xdg-terminal-exec.changes      
2023-10-08 12:22:17.062712916 +0200
+++ 
/work/SRC/openSUSE:Factory/.xdg-terminal-exec.new.17445/xdg-terminal-exec.changes
   2023-10-27 22:28:41.488610973 +0200
@@ -1,0 +2,12 @@
+Thu Oct 26 14:51:17 UTC 2023 - mc...@cepl.eu
+
+- Update to version 20231014+git.b6d2874:
+  * update readme
+  * WIP #28 internal list deduplicator, formatting
+  * WIP #28 add stock applications controls to configs
+  * check_bool function
+  * WIP #28 filter terminals from applications
+  * tr is faster than xargs -n1 on lots of lines
+- Store only *.obscpio, the tarball is generated in buildtime.
+
+-------------------------------------------------------------------

Old:
----
  xdg-terminal-exec-20231003+git.e5c20d0.obscpio
  xdg-terminal-exec-20231003+git.e5c20d0.tar.xz

New:
----
  xdg-terminal-exec-20231014+git.b6d2874.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ xdg-terminal-exec.spec ++++++
--- /var/tmp/diff_new_pack.98U5Zj/_old  2023-10-27 22:28:42.368643249 +0200
+++ /var/tmp/diff_new_pack.98U5Zj/_new  2023-10-27 22:28:42.372643395 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           xdg-terminal-exec
-Version:        20231003+git.e5c20d0
+Version:        20231014+git.b6d2874
 Release:        0
 Summary:        XDG terminal execution utility and default terminal 
specification
 # FIXME: Select a correct license from 
https://github.com/openSUSE/spec-cleaner#spdx-licenses

++++++ _service ++++++
--- /var/tmp/diff_new_pack.98U5Zj/_old  2023-10-27 22:28:42.400644423 +0200
+++ /var/tmp/diff_new_pack.98U5Zj/_new  2023-10-27 22:28:42.404644570 +0200
@@ -8,8 +8,8 @@
     <param name="revision">master</param>
     <param name="changesgenerate">enable</param>
   </service>
-  <service name="tar" mode="manual"/>
-  <service name="recompress" mode="manual">
+  <service name="tar" mode="buildtime"/>
+  <service name="recompress" mode="buildtime">
     <param name="file">*.tar</param>
     <param name="compression">xz</param>
   </service>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.98U5Zj/_old  2023-10-27 22:28:42.420645156 +0200
+++ /var/tmp/diff_new_pack.98U5Zj/_new  2023-10-27 22:28:42.424645303 +0200
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/Vladimir-csp/xdg-terminal-exec</param>
-              <param 
name="changesrevision">e5c20d043bd34bde671a4344e2147da9360f6fc2</param></service></servicedata>
+              <param 
name="changesrevision">b6d2874f062f40c94cf665277ccdd62d7b8beff4</param></service></servicedata>
 (No newline at EOF)
 

++++++ xdg-terminal-exec-20231003+git.e5c20d0.obscpio -> 
xdg-terminal-exec-20231014+git.b6d2874.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdg-terminal-exec-20231003+git.e5c20d0/README.md 
new/xdg-terminal-exec-20231014+git.b6d2874/README.md
--- old/xdg-terminal-exec-20231003+git.e5c20d0/README.md        2023-10-03 
21:12:13.000000000 +0200
+++ new/xdg-terminal-exec-20231014+git.b6d2874/README.md        2023-10-14 
22:27:57.000000000 +0200
@@ -1,9 +1,12 @@
 # xdg-terminal-exec
+
 Proposal for XDG terminal execution utility and default terminal specification.
 
 The configuration spec is crafted in image of 
[mime-apps-spec](https://specifications.freedesktop.org/mime-apps-spec/latest/ar01s02.html)
 using different names in similar structure, governed by 
[basedir-spec](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html).
 
-Terminal emulators with their exec arguments are described by desktop entries 
placed in directories named `xdg-terminals` provided via XDG_DATA hierarchy.
+Terminal emulators with their exec arguments are described by desktop entries.
+Either stock entries can be used (marked by `TerminalEmulator` category),
+or separate entries placed in directories named `xdg-terminals` provided via 
XDG_DATA hierarchy. Selection mechanism is described below.
 
 Preferred terminals are configured in config files named `xdg-terminals.list` 
provided via XDG_CONFIG hierarchy.
 Format for config file is a a simple newline-separated list of desktop 
entries. #Comments and dangling whitespaces are trimmed.
@@ -17,7 +20,11 @@
   - `/etc/xdg/xdg-terminals.list`
   - `/usr/etc/xdg/$desktop-xdg-terminals.list`
   - `/usr/etc/xdg/xdg-terminals.list`
-- data
+- data (stock)
+  - `$HOME/.local/share/applications/`
+  - `/usr/local/share/applications`
+  - `/usr/share/applications`
+- data (separate)
   - `$HOME/.local/share/xdg-terminals/`
   - `/usr/local/share/xdg-terminals`
   - `/usr/share/xdg-terminals`
@@ -25,7 +32,12 @@
 Where `$desktop` is a lowercased string derived from `$XDG_CURRENT_DESKTOP`.
 If `$XDG_CURRENT_DESKTOP` is set then it contains a colon-separated list of 
names for the current DE.
 
-## Priority of selecting entry:
+Data source can be explicitly controlled by first encountered line 
`use_stock_applications|use_xdg_terminals` in configs.
+Default can be set by `XTE_STOCK_TERMINALS` environment var and currently is 
normally `false`,
+but most likely will change to `true` in the future.
+
+## Priority of selecting entry
+
   - Read configs throughout XDG_CONFIG hierarchy.
     - in each tier `$desktop-xdg-terminals.list` gets first priority, 
`xdg-terminals.list` gets second priority
     - each entry found in configs is checked for applicability (same rules as 
in Desktop Entry Spec) and is skipped on failure.
@@ -33,11 +45,13 @@
   - If all of the above fails, `xterm` and `-e` are used.
 
 ## Desktop entry for terminal
+
 When defining terminals usual desktop entries may be used. The only addition 
is the key `X-ExecArg` which defines the execution argument for the terminal 
emulator.
 It defaults to `-e` if unset, but may be specifically set to an empty string.
 With this behavior stock entries for terminals that use `-e` as execution 
argument may be used unaltered.
 
 ## syntax
+
 ```
 xdg-terminal-exec [command [arguments]]
 ```
@@ -46,6 +60,7 @@
 Run with `DEBUG=1` to see verbose messages to stderr.
 
 ## limitations
+
 There is no mechanism for handling special quoting and arguments/strings that 
may be required for some terminals.
 Argument array is transmitted as is.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/xdg-terminal-exec-20231003+git.e5c20d0/xdg-terminal-exec 
new/xdg-terminal-exec-20231014+git.b6d2874/xdg-terminal-exec
--- old/xdg-terminal-exec-20231003+git.e5c20d0/xdg-terminal-exec        
2023-10-03 21:12:13.000000000 +0200
+++ new/xdg-terminal-exec-20231014+git.b6d2874/xdg-terminal-exec        
2023-10-14 22:27:57.000000000 +0200
@@ -10,8 +10,8 @@
 # (at your option) any later version. See <http://www.gnu.org/licenses/>.
 #
 # Contributors:
-# Roman Chistokhodov   https://github.com/FreeSlave/
-# fluvf                https://github.com/fluvf
+# Roman Chistokhodov    https://github.com/FreeSlave/
+# fluvf                 https://github.com/fluvf
 
 # Treat non-zero exit status from simple commands as an error
 # Treat unset variables as errors when performing parameter expansion
@@ -24,17 +24,44 @@
 N='
 '
 
-if [ "${DEBUG-0}" = '1' ]; then
-       debug() { printf '%s\n' "$1" >&2; }
-else
-       debug() { :; }
-fi
-
 trim_start() {
        # Remove all but leading whitespace, and trim that from the given string
        printf '%s' "${1#"${1%%[![:space:]]*}"}"
 }
 
+check_bool() {
+       case "$1" in
+       true | True | TRUE | yes | Yes | YES | 1) return 0 ;;
+       false | False | FALSE | no | No | NO | 0) return 1 ;;
+       *)
+               echo "Assuming \"$1\" means no" >&2
+               return 1
+               ;;
+       esac
+}
+
+append() {
+       # returns $N-separated list $1 with $2 item appended if not already 
there
+       IFS="$N"
+       FOUND=0
+       while read -r ITEM; do
+               [ -n "$ITEM" ] && printf '%s\n' "$ITEM"
+               [ "$ITEM" = "$2" ] && FOUND=1
+       done <<- EOL
+               $1
+       EOL
+       if [ "$FOUND" = "0" ]; then
+               printf '%s\n' "$2"
+       fi
+       IFS="$OIFS"
+}
+
+if check_bool "${DEBUG-0}"; then
+       debug() { printf '%s\n' "$1" >&2; }
+else
+       debug() { :; }
+fi
+
 # Read config from given path, print sanitised entries
 read_config_path() {
        config_path="$1"
@@ -152,8 +179,9 @@
 # Read entry from given path, only parse 'Desktop Entry' group
 read_entry_path() {
        entry_path="$1"
-
        debug "reading desktop entry '$entry_path'"
+       # failsafe for empty entries
+       HAS_DATA=false
        # Let `read` trim leading/trailing whitespace from the line
        while read -r line; do
                case $line in
@@ -161,6 +189,7 @@
                '[Desktop Entry]'*) ;;
                # A `Key=Value` pair, check it
                [A-Za-z0-9-]*)
+                       HAS_DATA=true
                        check_entry "$line" && continue
                        # Reset values that might have been set
                        unset EXEC
@@ -172,11 +201,12 @@
                esac
                # By default empty lines and comments get ignored
        done < "$entry_path"
-       return 0
+       case $HAS_DATA in
+       true) return 0 ;;
+       false) return 1 ;;
+       esac
 }
 
-# Subfolder within $XDG_DATA_*, analoguous to 'applications/' used with 
desktop entry files
-DATA_PREFIX_DIR=xdg-terminals
 # Name of config files to search and read
 CONFIG_NAME=xdg-terminals.list
 
@@ -209,6 +239,73 @@
        ENTRY_IDS="${ENTRY_IDS}${N}$(read_config_path 
"$config_dir"/"$CONFIG_NAME")"
 done
 
+# whether to use entries in 'xdg-terminals' or stock terminals in 
'applications'
+# decide by checking for special lines in configs
+# default is governed by XTE_STOCK_TERMINALS
+STOCK_TERMINALS=$(
+       # find special parameters in ENTRY_IDS
+       while read -r LINE; do
+               case "$LINE" in
+               # special parameters to control data subdir and entry filtering
+               use_stock_applications)
+                       debug "encountered use_stock_applications"
+                       echo true
+                       break
+                       ;;
+               use_xdg_terminals)
+                       debug "encountered use_xdg_terminals"
+                       echo false
+                       break
+                       ;;
+               esac
+       done <<- EOL
+               $ENTRY_IDS
+       EOL
+)
+
+if [ -z "$STOCK_TERMINALS" ]; then
+       debug "no stock terminals control in configs, XTE_STOCK_TERMINALS: 
${XTE_STOCK_TERMINALS:-undefined}"
+       STOCK_TERMINALS=${XTE_STOCK_TERMINALS:-false}
+fi
+
+debug "STOCK_TERMINALS=$STOCK_TERMINALS"
+
+# drop special and empty lines from ENTRY_IDS, deduplicate
+ENTRY_IDS=$(
+       LIST=''
+       while read -r LINE; do
+               case "$LINE" in
+               use_stock_applications | use_xdg_terminals | '') continue ;;
+               *) LIST=$(append "$LIST" "$LINE") ;;
+               esac
+       done <<- EOL
+               $ENTRY_IDS
+       EOL
+       printf '%s' "$LIST"
+)
+
+debug "final entry ID list '$ENTRY_IDS'"
+
+# select DATA_PREFIX_DIR and entry filtering:
+# operate in separate "xdg-terminals" subdirs (default),
+# or filter terminals from native "applications" subdirs by category
+if check_bool "$STOCK_TERMINALS"; then
+       debug "filtering stock terminal entries from applications"
+       DATA_PREFIX_DIR=applications
+       list_entry_files() {
+               find -L "$1" -type f -iname '*.desktop' -print0 |
+                       xargs -0r grep -ZlE 
'^[[:space:]]*Categories[[:space:]]*=[[:space:]]*(.*;)?TerminalEmulator(;|$)' |
+                       sort -z | tr '\0' '\n'
+       }
+else
+       debug "getting terminal entries from xdg-terminals"
+       DATA_PREFIX_DIR=xdg-terminals
+       list_entry_files() {
+               find -L "$1" -type f -iname '*.desktop' -print0 |
+                       sort -z | tr '\0' '\n'
+       }
+fi
+
 # Generate list of possible terminal entry files and also add their IDs to
 IFS=':'
 for data_dir in $DATA_HIERARCHY; do
@@ -216,6 +313,7 @@
        if [ -d "$data_dir"/"$DATA_PREFIX_DIR" ]; then
                debug "searching in '$data_dir/$DATA_PREFIX_DIR'"
                while read -r entry_path; do
+                       [ -z "$entry_path" ] && continue
                        debug "found desktop entry '$entry_path'"
                        # Remove data directory path
                        
entry_path="${entry_path#"$data_dir"/"$DATA_PREFIX_DIR"/}"
@@ -234,15 +332,11 @@
                        ENTRY_PATHS="${ENTRY_PATHS}${N}${entry_path}"
                        # Print order of found files is unpredictable, sort them
                done <<- EOF
-                       $(find -L "$data_dir"/"$DATA_PREFIX_DIR" -type f -iname 
'*.desktop' -print0 | sort -z | xargs -0rn 1)
+                       $(list_entry_files "$data_dir"/"$DATA_PREFIX_DIR")
                EOF
        fi
 done
 
-# Remove duplicate IDs
-ENTRY_IDS="$(printf '%s' "$ENTRY_IDS" | awk '!seen[$0]++')"
-debug "final entry ID list '$ENTRY_IDS'"
-
 # Loop through IDs, any empty lines should be discarded by word splitting
 IFS="$N"
 for entry_id in $ENTRY_IDS; do

++++++ xdg-terminal-exec.obsinfo ++++++
--- /var/tmp/diff_new_pack.98U5Zj/_old  2023-10-27 22:28:42.520648824 +0200
+++ /var/tmp/diff_new_pack.98U5Zj/_new  2023-10-27 22:28:42.524648971 +0200
@@ -1,5 +1,5 @@
 name: xdg-terminal-exec
-version: 20231003+git.e5c20d0
-mtime: 1696360333
-commit: e5c20d043bd34bde671a4344e2147da9360f6fc2
+version: 20231014+git.b6d2874
+mtime: 1697315277
+commit: b6d2874f062f40c94cf665277ccdd62d7b8beff4
 

Reply via email to