From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] package.el: check tarball signature Date: Wed, 02 Oct 2013 15:15:10 +0200 Message-ID: <8738oj4xwh.fsf@zigzag.favinet> References: <874n92x9em.fsf@flea.lifelogs.com> <87fvsk9m8b.fsf-ueno@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1380719535 23051 80.91.229.3 (2 Oct 2013 13:12:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Oct 2013 13:12:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 02 15:12:16 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VRMDv-0001xA-6q for ged-emacs-devel@m.gmane.org; Wed, 02 Oct 2013 15:12:15 +0200 Original-Received: from localhost ([::1]:36081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRMDu-0003Kz-HB for ged-emacs-devel@m.gmane.org; Wed, 02 Oct 2013 09:12:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRMDm-0003EE-Hw for emacs-devel@gnu.org; Wed, 02 Oct 2013 09:12:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRMDg-0001dN-I9 for emacs-devel@gnu.org; Wed, 02 Oct 2013 09:12:06 -0400 Original-Received: from smtp207.alice.it ([82.57.200.103]:42011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRMDf-0001br-W5 for emacs-devel@gnu.org; Wed, 02 Oct 2013 09:12:00 -0400 Original-Received: from zigzag.favinet (95.245.72.3) by smtp207.alice.it (8.6.060.28) id 52455760012CDA6C for emacs-devel@gnu.org; Wed, 2 Oct 2013 15:11:58 +0200 Original-Received: from ttn by zigzag.favinet with local (Exim 4.80) (envelope-from ) id 1VRMGv-0003Ef-5E for emacs-devel@gnu.org; Wed, 02 Oct 2013 15:15:21 +0200 Mail-Followup-To: emacs-devel@gnu.org In-Reply-To: <87fvsk9m8b.fsf-ueno@gnu.org> (Daiki Ueno's message of "Wed, 02 Oct 2013 16:16:04 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.103 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:163804 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain () Daiki Ueno () Wed, 02 Oct 2013 16:16:04 +0900 Or, perhaps you wanted to develop a user interface to upload tarballs with signature? For this, i wrote gnupload.el a few months back, attached here: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=gnupload.el Content-Transfer-Encoding: quoted-printable ;;; gnupload.el ;;; ;;; Copyright (C) 2013 Thien-Thi Nguyen ;;; ;;; This file is part of ttn's personal elisp library, released under ;;; the terms of the GNU General Public License as published by the ;;; Free Software Foundation; either version 3, or (at your option) any ;;; later version. There is NO WARRANTY. See file COPYING for details. ;;; ;;; Description: GNUishly sign files and upload them to the right place. (require 'cl) (require 'dired) (require 'epg) (require 'epa) (require 'net-utils) (defvar gnupload-fool nil "*The name (string) of the signer, or nil. This is passed to `epg-list-keys' as the NAME argument.") ;;;###autoload (defun gnupload-sign-files-from-dired (&optional dir) "Prompt for GPG key passphrase and sign marked files. The signatures are binary and detached, named FILENAME.sig. Optional arg DIR a non-empty string means also prepare the related directive files, with version 1.2 and directory DIR. The directive files are text, named FILENAME.directive.asc. See variable `gnupload-fool'." (interactive "sDirectory (RET to skip xfer prep): ") (let* ((all (or (remove-if 'file-directory-p (dired-get-marked-files)) (error "No files selected"))) (count (length all)) (signers (epg-list-keys (epg-make-context 'OpenPGP) gnupload-fool t)) (cache (list nil)) auth xfer) (flet ((mkc (purpose) (let ((context (epg-make-context 'OpenPGP)) ;; unnecessary at the moment ;;- (auth (eq 'auth purpose)) (xfer (eq 'xfer purpose))) (epg-context-set-armor context xfer) (epg-context-set-textmode context xfer) (epg-context-set-signers context signers) (epg-context-set-passphrase-callback context (cons (lambda (context key-id cache) (or (copy-sequence (car cache)) (let ((rv (epa-passphrase-callback-functi= on context key-id nil))) (when (consp cache) (setcar cache (copy-sequence rv))) rv))) cache)) context))) ;; First, sign the tarball. (setq auth (mkc 'auth)) (dolist (filename all) (let ((action (format "Signing %s..." (file-name-nondirectory filen= ame))) (signature (concat filename ".sig"))) (epg-context-set-progress-callback auth (cons #'epa-progress-callback-function action)) (message "%s" action) (epg-sign-file auth filename signature 'detached) (message "%swrote %s" action (file-name-nondirectory signature)))) ;; Next (maybe), create the directive files. (when (setq xfer (and dir (not (zerop (length dir))) (mkc 'xfer))) (dolist (filename all) (with-temp-file (concat filename ".directive.asc") (insert (epg-sign-string xfer (format "version: 1.2\ndirectory: %s\nfilename: %s\n" dir (file-name-nondirectory filename)) 'cleartext))))) ;; Lastly, clean up. (when (car cache) (clear-string (car cache)) (setcar cache nil)) (message "Files written: %d auth, %d xfer" count (if xfer count 0))))) ;;;###autoload (defun gnupload-from-dired (&optional alpha) "Upload marked files to GNU. Normally, the upload directory is /incoming/ftp. Prefix arg means write to /incoming/alpha, instead." (interactive "P") (let ((all (or (remove-if 'file-directory-p (dired-get-marked-files)) (error "No files selected"))) (proc (progn (ftp "ftp-upload.gnu.org") (get-buffer-process (current-buffer))))) (set (make-local-variable 'comint-preoutput-filter-functions) (list (lambda (string) (replace-regexp-in-string "ftp> " "(ftp)\n" string t t)))) (flet ((send-line (s &rest args) (comint-send-string proc (concat (apply 'format s args) "\n")) (accept-process-output))) (mapc 'send-line '("anonymous" ; login "passive" ; on "glob" ; off "prompt" ; off )) (send-line "cd /incoming/%s" (if alpha "alpha" "ftp")) (send-line "mput %s" (mapconcat 'file-name-nondirectory all " ")) (send-line "quit")))) ;;; This is another implementation, using the mighty Ange-FTP. ;;; It shares async nature (good) but is too noisy (bad). ';;;DISABLED (require 'ange-ftp) ';;;DISABLED (defun gnupload-from-dired (&optional alpha) (interactive "P") (let ((all (or (remove-if 'file-directory-p (dired-get-marked-files)) (error "No files selected"))) (dir (format "/anonymous@ftp-upload.gnu.org:/incoming/%s/" (if alpha "alpha" "ftp"))) ;; Don't futz around w/ ASCII. (ange-ftp-binary-file-name-regexp ".")) (ange-ftp-copy-files-async ;; required args for internal (ange-ftp) consistency t nil ;; don't display progress messages (does not affect "Copying...[done]") nil (mapcar (lambda (filename) (list filename (concat dir (file-name-nondirectory filename)) 'ok-if-already-exists 'keep-date)) all)))) ;;;------------------------------------------------------------------------= --- ;;; that's it! (provide 'gnupload) ;;; gnupload.el ends here --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable and have used it personally for several GNU packages i maintain (seems to work fine, so far). Posted as FYI-FWIW-HTH-HAND, but critique more than welcome. Thanks for reminding me to share! =2D-=20 Thien-Thi Nguyen GPG key: 4C807502 (if you're human and you know it) read my lisp: (responsep (questions 'technical) (not (via 'mailing-list))) =3D> nil --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlJMHGIACgkQZwMiJEyAdQIfpgCgwQ9/wUoin6pNfoI0o5UJH6WD qw4AnArN9F+jGIjKAsOOdWzyGyyNzy1w =hZSg -----END PGP SIGNATURE----- --==-=-=--