From: Bruno Haible Date: Mon, 26 Nov 2001 22:28:41 +0000 (+0000) Subject: Add some checking of file name. X-Git-Tag: v0.11~266 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a782c80da6d3621cfdf71cb403081b78dcd6ea2;p=thirdparty%2Fgettext.git Add some checking of file name. --- diff --git a/misc/ChangeLog b/misc/ChangeLog index 6d5d9d675..770f999de 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,8 @@ +2001-11-25 Karl Eichwalder + + * po-mode.el (po-guess-archive-name): Verify that versions provided by + file name and by Project-Id-Version field match. + 2001-11-18 Bruno Haible * gettextize.in: New option --intl. diff --git a/misc/po-mode.el b/misc/po-mode.el index dc1b57651..a8f68d485 100644 --- a/misc/po-mode.el +++ b/misc/po-mode.el @@ -3139,7 +3139,8 @@ Leave point after marked string." (defun po-guess-archive-name () "Return the ideal file name for this PO file in the central archives." - (let (start-of-header end-of-header package version team) + (let ((filename (file-name-nondirectory buffer-file-name)) + start-of-header end-of-header package version team) (save-excursion ;; Find the PO file header entry. (goto-char (point-min)) @@ -3156,6 +3157,17 @@ Leave point after marked string." (if (or (not package) (string-equal package "PACKAGE") (not version) (string-equal version "VERSION")) (error (_"Project-Id-Version field does not have a proper value"))) + ;; File name version and Project-Id-Version must match + (cond (;; A `filename' w/o package and version info at all + (string-match "^[^\\.]*\\.po\\'" filename)) + (;; TP Robot compatible `filename': PACKAGE-VERSION.LL.po + (string-match (concat (regexp-quote package) + "-\\(.*\\)\\.[^\\.]*\\.po\\'") filename) + (if (not (equal version (po-match-string 1 filename))) + (error (_"\ +Version mismatch: file name: %s; header: %s.\n\ +Adjust Project-Id-Version field to match file name and try again") + (po-match-string 1 filename) version)))) ;; Get the team. (if (stringp po-team-name-to-code) (setq team po-team-name-to-code)