Hello community, here is the log from the commit of package mpv for openSUSE:Factory checked in at 2017-10-25 17:48:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mpv (Old) and /work/SRC/openSUSE:Factory/.mpv.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mpv" Wed Oct 25 17:48:00 2017 rev:37 rq:536484 version:unknown Changes: -------- --- /work/SRC/openSUSE:Factory/mpv/mpv.changes 2017-09-13 22:37:28.987227967 +0200 +++ /work/SRC/openSUSE:Factory/.mpv.new/mpv.changes 2017-10-25 17:48:03.397907707 +0200 @@ -1,0 +2,7 @@ +Tue Oct 24 18:33:12 UTC 2017 - [email protected] + +- Update mpv-bash-completion to 3.3.16 + * gen: make output reproducible by ensuring stable output of + pairs() by wrapping it where it matters. (Closes #18) + +------------------------------------------------------------------- Old: ---- mpv-bash-completion-3.3.15.tar.gz New: ---- mpv-bash-completion-3.3.16.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mpv.spec ++++++ --- /var/tmp/diff_new_pack.Lzr4mw/_old 2017-10-25 17:48:04.357862652 +0200 +++ /var/tmp/diff_new_pack.Lzr4mw/_new 2017-10-25 17:48:04.361862464 +0200 @@ -20,7 +20,7 @@ %define _waf_ver 1.9.13 -%define _mbc_ver 3.3.15 +%define _mbc_ver 3.3.16 %define _mpv_ver 0.27.0 %define lname libmpv1 Name: mpv ++++++ mpv-bash-completion-3.3.15.tar.gz -> mpv-bash-completion-3.3.16.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mpv-bash-completion-3.3.15/README.mkd new/mpv-bash-completion-3.3.16/README.mkd --- old/mpv-bash-completion-3.3.15/README.mkd 2017-08-20 13:52:19.000000000 +0200 +++ new/mpv-bash-completion-3.3.16/README.mkd 2017-10-24 18:53:22.000000000 +0200 @@ -1,5 +1,10 @@ # mpv-bash-completion +Latest release: **[3.3.15](https://github.com/2ion/mpv-bash-completion/releases/tag/3.3.15)** + +[](https://repology.org/metapackage/mpv-bash-completion) +[](https://repology.org/metapackage/mpv-bash-completion) + A script for generating a Bash completion script for the popular [mpv video player](https://github.com/mpv-player/mpv). It features... @@ -15,13 +20,25 @@ * Similarly, parameter completion for video and audio outputs (--vo, --ao), * Regular file name completion. -## Supported OSs +## Supported distributions / operating systems -* [Arch Linux](#arch-linux) -* [Debian Jessie/Testing/Unstable + Ubuntu 16.04 Xenial](#debian) -* Gentoo Linux, Funtoo Linux: [app-shells/mpv-bash-completion](https://packages.gentoo.org/packages/app-shells/mpv-bash-completion) -* [Generic Linux/OSX/Unix systems](#platform-agnostic-method) -* [OS X Homebrew](#osx-homebrew) (unmaintained) +For the distributions listed here, packages have been created and are being +actively maintained. For other platforms and distributions, you can build the +completion by yourself, see [below](#platform-agnostic-method), as long as the +platform can run mpv and the [dependencies](#dependencies). + +| Distribution | Repository | Package/Port | Maintainer | Comment | +| -------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------- | ---------- | ------- | +| Arch Linux | AUR | [mpv-bash-completion-git](https://aur.archlinux.org/packages/mpv-bash-completion-git/) | @2ion | Automatic completion updates via pacman hook | +| Gentoo Linux, Funtoo Linux | Mainline | [app-shells/mpv-bash-completion](https://packages.gentoo.org/packages/app-shells/mpv-bash-completion) | @coacher | | +| OpenSuSE | Leap, Tumbleweed | [mpv-bash-completion](https://software.opensuse.org/package/mpv-bash-completion) | | | +| macOS | Custom homebrew tap | @2ion/mpv-bash-completion | @2ion | See instructions [here](#homebrew) | + +### Retired packages + +There used to be Debian and Ubuntu packages for mpv-bash-completion, but +I cannot maintain them any longer. If you're interested, you can get the +package source from the [debian branch](https://github.com/2ion/mpv-bash-completion/tree/debian). ## Source code @@ -38,13 +55,13 @@ * Awk (any awk: gawk, nawk, mawk, etc -- should do) * Bash 4 * Lua 5.1 or 5.2 or 5.3 or LuaJIT -* mpv >= 0.23 +* mpv >= 0.25 **Note on older mpv versions**: The mpv command line has changed -considerably since the beginning of version 0.20 and later, making it -impossible to support older versions due to the huge number of special -cases that would need to be covered. For compatbility with older mpv -releases, please use a historic version of mpv-bash-completion. +considerably since version 0.25, making it impossible to support older +versions due to the huge number of special cases that would need to be +covered. For compatbility with older mpv releases, please use a +historic version of mpv-bash-completion. ### Optional dependencies @@ -53,10 +70,14 @@ ### Supporting inputrc configuration -We recommend the following setting for a snappier completion experience: -To the file `~/.inputrc`, add the line +We recommend the following setting for snappier and more luxurious +completion experience: To the file `~/.inputrc`, add the lines ``` -set show-all-if-ambiguous on +set blink-matching-paren On +set colored-stats On +set completion-ignore-case On +set show-all-if-ambiguous On +set visible-stats On ``` Launch a new shell to use the setting. @@ -76,53 +97,7 @@ source ./mpv.sh ``` -### Arch Linux - -Install [mpv-bash-completion-git](https://aur.archlinux.org/packages/mpv-bash-completion-git/) -from the AUR. It will install all necessary dependencies and also ships -a pacman hook which automatically rebuilds the completion file whenever -you update mpv so it's **not** necessary to install the package every time. - -### Debian - -.deb packages can be downloaded directly [here](https://pkg.bunsenlabs.org/debian/pool/main/m/mpv-bash-completion/). - -#### Stable (Jessie) - -Install via BunsenLabs. Set up the `bunsenlabs-hydrogen` repository as -described [here](https://pkg.bunsenlabs.org/index.html#bunsen-hydrogen), -then execute: - -```sh -sudo apt-get update && sudo apt-get install mpv-bash-completion -``` - -#### Testing & Sid; Ubuntu Xenial - -These currently contain mpv 0.14 for which the below package is built. - -Install via the BunsenLabs unstable repository. Set up the `unstable` -repository as explained [here](https://pkg.bunsenlabs.org/#unstable), -then execute: - -```sh -sudo apt-get update && sudo apt-get install mpv-bash-completion -``` - -#### mpv git builds / custom package build - -You can build a package on Debian testing or unstable, or if your mpv's -version is greater than approximately 0.14. Jessie's version of mpv is -too old. - -```sh -sudo apt-get install debhelper mpv lua5.3 dpkg-dev git -git clone https://github.com/2ion/mpv-bash-completion.git -cd mpv-bash-completion && git checkout debian -dpkg-buildpackage -us -uc -b # Install the resulting package: dpkg -i $package -``` - -### OSX Homebrew +### Homebrew *Note: Since I do not have access to a Mac computer anymore, I cannot maintain this formula any longer. I am leaving it here for the time diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mpv-bash-completion-3.3.15/gen.lua new/mpv-bash-completion-3.3.16/gen.lua --- old/mpv-bash-completion-3.3.15/gen.lua 2017-08-20 13:52:19.000000000 +0200 +++ new/mpv-bash-completion-3.3.16/gen.lua 2017-10-24 18:53:22.000000000 +0200 @@ -67,13 +67,6 @@ return assert(h:read(w or "*all"), "can't read from file handle: no data") end -local function bash_escape(s) - local h = io.popen(string.format([[bash -c "printf '%%q' '%s'"]], s)) - local ret = h:read("*all") - h:close() - return ret -end - ----------------------------------------------------------------------- -- Table ops ----------------------------------------------------------------------- @@ -108,10 +101,41 @@ return u end +-- pairs() replacement with iterating using sorted keys +local function spairs(t) + assert(t) + + local keys = {} + for kk,_ in pairs(t) do + table.insert(keys, kk) + end + + local len = #keys + local xi = 1 + + local function snext(t, index) + if not t + or (index and index == len) + or len == 0 then + return nil + elseif index == nil then + local k = keys[xi] + return k, t[k] + else + xi = xi + 1 + local k = keys[xi] + return k, t[k] + end + end + + table.sort(keys) + return snext, t, nil +end + local function keys(t) local u = {} if t then - for k,_ in pairs(t) do + for k,_ in spairs(t) do table.insert(u, k) end end @@ -252,9 +276,15 @@ end end -local function wantsFile(tail) +local function wantsFile(op, tail) local m = tail:match("%[file%]") - return m and true or false + if m then return true end + + for _,re in ipairs{ "%-file[s]?%-", "^script[s]?", "^scripts%-.*" } do + if op:match(re) then return true end + end + + return false end local function hasNoCfg(tail) @@ -323,7 +353,7 @@ ot = "String" elseif ot == "Relative" then clist = { "-60", "60", "50%" } ot = "Position" - elseif ot == "String" then if wantsFile(tail) then + elseif ot == "String" then if wantsFile(o, tail) then ot = "File" if o:match('directory') or o:match('dir') then ot = "Directory" @@ -335,6 +365,8 @@ elseif ot == "Window" then ot = "Dimen" elseif ot == "Profile" then clist = {} elseif ot == "DRMConnector" then clist = {} + elseif ot == "alias" then clist = { tail:match("^alias for (%S+)") or "" } + ot = "Alias" else ot = "Single" end @@ -408,6 +440,31 @@ end -- if setmetatable(t, { fargs = fargs }) + -- Resolve new-style aliases + + local function find_option(name) + for group, members in pairs(t) do + for o, oo in pairs(members) do + if o == name then + return group, oo + end + end + end + return nil + end + + if t.Alias then + for name, val in pairs(t.Alias) do + local alias = table.remove(val.clist) + local group, oo = find_option(alias) + if group then + log(" * %s is an alias of %s[%s]", name, group, alias) + t[group][name] = oo + end + end + t.Alias = nil + end + return t end @@ -418,45 +475,45 @@ local t = {} for _,k in ipairs{...} do if olist[k] then - for u,v in pairs(olist[k]) do + for u,v in spairs(olist[k]) do t[u] = v end end end - return pairs(t) + return spairs(t) end - local function i(...) + local function emit(...) for _,e in ipairs{...} do table.insert(lines, e) end end - i([[#!/bin/bash + emit([[#!/bin/bash # mpv ]]..MPV_VERSION) - i([[### LOOKUP TABLES AND CACHES ### + emit([[### LOOKUP TABLES AND CACHES ### declare _mpv_xrandr_cache declare -A _mpv_fargs declare -A _mpv_pargs]]) local fargs = getmetatable(olist).fargs - for o,fv in pairs(fargs) do - for f,pv in pairs(fv) do + for o,fv in spairs(fargs) do + for f,pv in spairs(fv) do local plist = table.concat(keys(pv), "= ") if #plist > 0 then plist = plist.."=" - i(string.format([[_mpv_fargs[%s@%s]="%s"]], o, f, plist)) + emit(string.format([[_mpv_fargs[%s@%s]="%s"]], o, f, plist)) end - for p,pa in pairs(pv) do + for p,pa in spairs(pv) do plist = pa.clist and table.concat(pa.clist, " ") or "" if #plist > 0 then - i(string.format([[_mpv_pargs[%s@%s@%s]="%s"]], o, f, p, plist )) + emit(string.format([[_mpv_pargs[%s@%s@%s]="%s"]], o, f, p, plist )) end end end end - i([=[### HELPER FUNCTIONS ### + emit([=[### HELPER FUNCTIONS ### _mpv_uniq(){ local -A w local o="" @@ -475,9 +532,8 @@ } _mpv_drm_connectors(){ type mpv &>/dev/null || return 0; - local conn=$(mpv --no-config --drm-connector help \ - | awk '/\<connected\>/{ print $1 ; }') - echo "${conn}" + mpv --no-config --drm-connector help \ + | awk '/\<connected\>/{ print $1 ; }' } _mpv_xrandr(){ if [[ -z "$_mpv_xrandr_cache" && -n "$DISPLAY" ]] && type xrandr &>/dev/null; then @@ -582,7 +638,7 @@ printf "${r% }" }]=]) - i([=[### COMPLETION ### + emit([=[### COMPLETION ### _mpv(){ local cur=${COMP_WORDS[COMP_CWORD]} local prev=${COMP_WORDS[COMP_CWORD-1]} @@ -598,26 +654,26 @@ end }) - i([=[if [[ -n $cur ]]; then case "$cur" in]=]) + emit([=[if [[ -n $cur ]]; then case "$cur" in]=]) for o,p in ofType("Choice", "Flag") do - i(string.format([[--%s=*)_mpv_s '%s' "$cur"; return;;]], + emit(string.format([[--%s=*)_mpv_s '%s' "$cur"; return;;]], o, mapcats(p.clist, function (e) return string.format("--%s=%s", o, e) end))) table.insert(all, string.format("--%s=", o)) end - i("esac; fi") + emit("esac; fi") - i([=[if [[ -n $prev && ( $cur =~ , || $cur =~ : ) ]]; then case "$prev" in]=]) + emit([=[if [[ -n $prev && ( $cur =~ , || $cur =~ : ) ]]; then case "$prev" in]=]) for o,p in ofType("Object") do if o:match("^[av][fo]") then - i(string.format([[--%s)_mpv_s "$(_mpv_objarg "$prev" "$cur" %s)" "$cur";return;;]], + emit(string.format([[--%s)_mpv_s "$(_mpv_objarg "$prev" "$cur" %s)" "$cur";return;;]], o, p.clist and table.concat(p.clist, " ") or "")) end end - i("esac; fi") + emit("esac; fi") - i([=[if [[ -n $prev ]]; then case "$prev" in]=]) + emit([=[if [[ -n $prev ]]; then case "$prev" in]=]) if olist.File then - i(string.format("%s)_filedir;return;;", + emit(string.format("%s)_filedir;return;;", mapcator(keys(olist.File), function (e) local o = string.format("--%s", e) table.insert(all, o) @@ -625,7 +681,7 @@ end))) end if olist.Profile then - i(string.format([[%s)_mpv_s "$(_mpv_profiles)" "$cur";return;;]], + emit(string.format([[%s)_mpv_s "$(_mpv_profiles)" "$cur";return;;]], mapcator(keys(olist.Profile), function (e) local o = string.format("--%s", e) table.insert(all, o) @@ -633,7 +689,7 @@ end))) end if olist.DRMConnector then - i(string.format([[%s)_mpv_s "$(_mpv_drm_connectors)" "$cur";return;;]], + emit(string.format([[%s)_mpv_s "$(_mpv_drm_connectors)" "$cur";return;;]], mapcator(keys(olist.DRMConnector), function (e) local o = string.format("--%s", e) table.insert(all, o) @@ -641,7 +697,7 @@ end))) end if olist.Directory then - i(string.format("%s)_filedir -d;return;;", + emit(string.format("%s)_filedir -d;return;;", mapcator(keys(olist.Directory), function (e) local o = string.format("--%s", e) table.insert(all, o) @@ -651,25 +707,25 @@ for o, p in ofType("Object", "Numeric", "Audio", "Color", "FourCC", "Image", "String", "Position", "Time") do if p.clist then table.sort(p.clist) end - i(string.format([[--%s)_mpv_s '%s' "$cur"; return;;]], + emit(string.format([[--%s)_mpv_s '%s' "$cur"; return;;]], o, p.clist and table.concat(p.clist, " ") or "")) all(o) end for o,p in ofType("Dimen") do - i(string.format([[--%s)_mpv_s "$(_mpv_xrandr)" "$cur";return;;]], o)) + emit(string.format([[--%s)_mpv_s "$(_mpv_xrandr)" "$cur";return;;]], o)) all(o) end - i("esac; fi") + emit("esac; fi") - i("if [[ $cur =~ ^- ]]; then") + emit("if [[ $cur =~ ^- ]]; then") for o,_ in ofType("Single") do all(o) end - i(string.format([[_mpv_s '%s' "$cur"; return;]], + emit(string.format([[_mpv_s '%s' "$cur"; return;]], table.concat(all, " "))) - i("fi") + emit("fi") - i("_filedir") + emit("_filedir") - i("}", "complete -o nospace -F _mpv "..basename(MPV_CMD)) + emit("}", "complete -o nospace -F _mpv "..basename(MPV_CMD)) return table.concat(lines, "\n") end
