1
0
Fork 0

- added dependency on 'unzip';

- added 'unzip-file';
- fixed zip-info conatant name.
This commit is contained in:
cage 2021-08-20 14:23:21 +02:00
parent 7685e64a77
commit 1e37af8772
8 changed files with 83 additions and 6 deletions

View File

@ -327,6 +327,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
UNZIP = @UNZIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XDG_OPEN = @XDG_OPEN@

49
configure vendored
View File

@ -594,6 +594,7 @@ GIT
OPENSSL
XDG_OPEN
BASH
UNZIP
GPG
CURL
LISP_COMPILER
@ -6314,6 +6315,54 @@ if test "$GPG" = "no" ; then
exit 1;
fi
# Extract the first word of "unzip", so it can be a program name with args.
set dummy unzip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_UNZIP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $UNZIP in
[\\/]* | ?:[\\/]*)
ac_cv_path_UNZIP="$UNZIP" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_UNZIP="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_UNZIP" && ac_cv_path_UNZIP="no"
;;
esac
fi
UNZIP=$ac_cv_path_UNZIP
if test -n "$UNZIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNZIP" >&5
$as_echo "$UNZIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "$GPG" = "no" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can not find unzip, genpub support will be disabled." >&5
$as_echo "$as_me: WARNING: Can not find unzip, genpub support will be disabled." >&2;}
exit 1;
fi
# Extract the first word of "bash", so it can be a program name with args.
set dummy bash; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5

View File

@ -43,6 +43,13 @@ if test "$GPG" = "no" ; then
exit 1;
fi
AC_PATH_PROG([UNZIP],[unzip],[no])
if test "$GPG" = "no" ; then
AC_MSG_WARN([Can not find unzip, genpub support will be disabled.])
exit 1;
fi
AC_PATH_PROG([BASH],[bash],[no])
if test "$BASH" = "no" ; then

View File

@ -15,7 +15,9 @@
(alexandria:define-constant +openssl-bin+ "/usr/bin/openssl" :test #'string=)
(alexandria:define-constant +xdg-open-bin+ "/usr/bin/xdg-open" :test #'string=)
(alexandria:define-constant +xdg-open-bin+ "/usr/bin/xdg-open" :test #'string=)
(alexandria:define-constant +unzip-bin+ "/usr/bin/unzip" :test #'string=)
(defmacro with-return-untranslated ((untranslated) &body body)
`(handler-bind ((i18n-conditions:no-translation-table-error

View File

@ -15,7 +15,9 @@
(alexandria:define-constant +openssl-bin+ "@OPENSSL@" :test #'string=)
(alexandria:define-constant +xdg-open-bin+ "@XDG_OPEN@" :test #'string=)
(alexandria:define-constant +xdg-open-bin+ "@XDG_OPEN@" :test #'string=)
(alexandria:define-constant +unzip-bin+ "@UNZIP@" :test #'string=)
(defmacro with-return-untranslated ((untranslated) &body body)
`(handler-bind ((i18n-conditions:no-translation-table-error

View File

@ -162,3 +162,17 @@
give-focus-to-message-window)
(os-utils:open-link-with-program program resource))
(os-utils:xdg-open resource))))
(defun unzip-file (zip-file destination-dir)
(cond
((not (fs:file-exists-p zip-file))
(error (format nil (_ "File ~s does not exists"))))
((not (fs:directory-exists-p destination-dir))
(error (format nil (_ "Destination directory ~s does not exists"))))
(t
(run-external-program +unzip-bin+
(list "-o" zip-file "-d" destination-dir)
:search t
:wait t
:output *standard-output*
:error *standard-output*))))

View File

@ -34,6 +34,7 @@
:+issue-tracker+
:+openssl-bin+
:+xdg-open-bin+
:+unzip-bin+
:_
:n_))
@ -340,7 +341,8 @@
:generate-ssl-certificate
:send-to-pipe
:open-link-with-program
:open-resource-with-external-program))
:open-resource-with-external-program
:unzip-file))
(defpackage :text-utils
(:use

View File

@ -43,11 +43,11 @@
+eocd-tot-no-entry-cd+
+eocd-cd-size+
+eocd-cd-offset+
+zip-file-comment-length+)
+eocd-zip-file-comment-length+)
:test #'=)
(alexandria:define-constant +eocd-zip-file-comment-offset+ (- +eocd-fixed-size+
+zip-file-comment-length+)
+eocd-zip-file-comment-length+)
:test #'=)
(defun open-file (path)
@ -83,6 +83,6 @@
(eocd-offset-minus-zip-comment (- eocd-fixed-part-offset
+eocd-zip-file-comment-length+)))
(file-position stream eocd-offset-minus-zip-comment)
(let ((comment-size (read-bytes->int stream +zip-file-comment-length+)))
(let ((comment-size (read-bytes->int stream +eocd-zip-file-comment-length+)))
(= (+ eocd-fixed-part-offset comment-size)
file-size))))))))