1
0
Fork 0
mirror of synced 2024-11-26 09:15:34 -05:00

Clean compiled files from absolute path modules

We were already compiling at these paths, but not cleaning the compiled
files.
Fixes #399
This commit is contained in:
Eric Nielsen 2020-07-31 21:03:47 -05:00
parent 5059dd2c65
commit ccace0ca74
No known key found for this signature in database
GPG key ID: 47D1DBFA0765A1FB
5 changed files with 19 additions and 13 deletions

View file

@ -7,24 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
_No unreleased changes._ ### Fixed
- Compiled files must also be cleaned from modules defined with absolute paths.
## [1.3.1] - 2020-07-24 ## [1.3.1] - 2020-07-24
### Fixed ### Fixed
- gunzip failing with "unexpected end of file" when trying to upgrade zimfw. - "gzip: stdin: unexpected end of file" error when trying to upgrade.
(See [#407](https://github.com/zimfw/zimfw/issues/407)) (See [#407](https://github.com/zimfw/zimfw/issues/407))
## [1.3.0] - 2020-07-05 ## [1.3.0] - 2020-07-05
### Added ### Added
- `-c|-cmd` option to `zmodule`. - `-c|-cmd` option to `zmodule`. This allows for executing any specified command.
## [1.2.2] - 2020-06-10 ## [1.2.2] - 2020-06-10
### Fixed ### Fixed
- Allow local modules to be initialized and compiled in their respective - Allow local modules to be initialized and compiled in their respective
directories, instead of forcing them to be installed inside `ZIM_HOME`. directories, when absolute paths are given, instead of forcing them to be
installed inside `ZIM_HOME`.
## [1.2.1] - 2020-05-26 ## [1.2.1] - 2020-05-26

View file

@ -1,7 +1,9 @@
_zimfw_clean_compiled() { _zimfw_clean_compiled() {
# Array with unique dirs. ${ZIM_HOME} or any subdirectory should only occur once.
local -Ur zscriptdirs=(${ZIM_HOME} ${${_zdirs##${ZIM_HOME}/*}:A})
local zopt local zopt
if (( _zprintlevel > 0 )) zopt='-v' if (( _zprintlevel > 0 )) zopt='-v'
command rm -f ${zopt} ${ZIM_HOME}/**/*.zwc(|.old) || return 1 command rm -f ${zopt} ${^zscriptdirs}/**/*.zwc(|.old)(N) || return 1
command rm -f ${zopt} <%= home %>/<%= startup_files_glob %>.zwc(|.old)(N) || return 1 command rm -f ${zopt} <%= home %>/<%= startup_files_glob %>.zwc(|.old)(N) || return 1
_zimfw_print -P '<%= done %>Done with clean-compiled. Run %Bzimfw compile%b to re-compile.' _zimfw_print -P '<%= done %>Done with clean-compiled. Run %Bzimfw compile%b to re-compile.'
} }

View file

@ -57,8 +57,8 @@ Options:
_zimfw_compile _zimfw_compile
;; ;;
init) _zimfw_source_zimrc && _zimfw_build ;; init) _zimfw_source_zimrc && _zimfw_build ;;
clean) _zimfw_clean_compiled && _zimfw_clean_dumpfile ;; clean) _zimfw_source_zimrc && _zimfw_clean_compiled && _zimfw_clean_dumpfile ;;
clean-compiled) _zimfw_clean_compiled ;; clean-compiled) _zimfw_source_zimrc && _zimfw_clean_compiled ;;
clean-dumpfile) _zimfw_clean_dumpfile ;; clean-dumpfile) _zimfw_clean_dumpfile ;;
compile) _zimfw_source_zimrc && _zimfw_build_login_init && _zimfw_compile ;; compile) _zimfw_source_zimrc && _zimfw_build_login_init && _zimfw_compile ;;
help) print -PR ${zusage} ;; help) print -PR ${zusage} ;;

View file

@ -6,7 +6,7 @@ class Zim
@home = "${ZDOTDIR:-${HOME}}" @home = "${ZDOTDIR:-${HOME}}"
@min_zsh_version = "5.2" @min_zsh_version = "5.2"
@startup_files_glob = ".z(shenv|profile|shrc|login|logout)" @startup_files_glob = ".z(shenv|profile|shrc|login|logout)"
@version = "1.3.1" @version = "1.3.2-SNAPSHOT"
@ellipsis = " ..." @ellipsis = " ..."
@okay = "%F{green})%f " @okay = "%F{green})%f "
@warn = "! " @warn = "! "

View file

@ -291,9 +291,11 @@ _zimfw_version_check() {
} }
_zimfw_clean_compiled() { _zimfw_clean_compiled() {
# Array with unique dirs. ${ZIM_HOME} or any subdirectory should only occur once.
local -Ur zscriptdirs=(${ZIM_HOME} ${${_zdirs##${ZIM_HOME}/*}:A})
local zopt local zopt
if (( _zprintlevel > 0 )) zopt='-v' if (( _zprintlevel > 0 )) zopt='-v'
command rm -f ${zopt} ${ZIM_HOME}/**/*.zwc(|.old) || return 1 command rm -f ${zopt} ${^zscriptdirs}/**/*.zwc(|.old)(N) || return 1
command rm -f ${zopt} ${ZDOTDIR:-${HOME}}/.z(shenv|profile|shrc|login|logout).zwc(|.old)(N) || return 1 command rm -f ${zopt} ${ZDOTDIR:-${HOME}}/.z(shenv|profile|shrc|login|logout).zwc(|.old)(N) || return 1
_zimfw_print -P 'Done with clean-compiled. Run %Bzimfw compile%b to re-compile.' _zimfw_print -P 'Done with clean-compiled. Run %Bzimfw compile%b to re-compile.'
} }
@ -313,7 +315,7 @@ _zimfw_compile() {
} }
_zimfw_info() { _zimfw_info() {
print -R 'zimfw version: '${_zversion}' (previous commit is 713b7b2)' print -R 'zimfw version: '${_zversion}' (previous commit is 5059dd2)'
print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION} print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a) print -R 'System info: '$(command uname -a)
@ -357,7 +359,7 @@ _zimfw_upgrade() {
} }
zimfw() { zimfw() {
local -r _zversion='1.3.1' local -r _zversion='1.3.2-SNAPSHOT'
local -r zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions: Actions:
@ -493,8 +495,8 @@ fi
_zimfw_compile _zimfw_compile
;; ;;
init) _zimfw_source_zimrc && _zimfw_build ;; init) _zimfw_source_zimrc && _zimfw_build ;;
clean) _zimfw_clean_compiled && _zimfw_clean_dumpfile ;; clean) _zimfw_source_zimrc && _zimfw_clean_compiled && _zimfw_clean_dumpfile ;;
clean-compiled) _zimfw_clean_compiled ;; clean-compiled) _zimfw_source_zimrc && _zimfw_clean_compiled ;;
clean-dumpfile) _zimfw_clean_dumpfile ;; clean-dumpfile) _zimfw_clean_dumpfile ;;
compile) _zimfw_source_zimrc && _zimfw_build_login_init && _zimfw_compile ;; compile) _zimfw_source_zimrc && _zimfw_build_login_init && _zimfw_compile ;;
help) print -PR ${zusage} ;; help) print -PR ${zusage} ;;