Close ssl_sock before returning error in connect_https_socket()
[platform/upstream/openconnect.git] / Makefile.am
index 3fc6a2c..7ab813c 100644 (file)
@@ -101,11 +101,35 @@ tag: uncommitted-check
        @git tag v$(VERSION)
        @cd $(srcdir) && ./autogen.sh
 
-update-translations:
+update-translations: po/$(PACKAGE).pot
        @cd $(top_srcdir); if ! git diff-index --name-only --exit-code HEAD -- po/; then \
                echo "*** ERROR: Uncommitted changes in above files"; exit 1; \
        else \
-               tx pull -af ; git commit -s -m "Update translations from Transifex" -- po/ ; \
+               for a in po/*.po; do \
+                       msgmerge -q -N -F $$a $(abs_builddir)/po/$(PACKAGE).pot | sed '0,/^#:/d' > $$a.old ; \
+               done && \
+               tx pull -af && \
+               for a in po/*.po; do \
+                       msgmerge -q -N -F $$a $(abs_builddir)/po/$(PACKAGE).pot > $$a.new ; \
+                       sed '0,/^#:/d' $$a.new > $$a.new.cmp ; \
+                       if ! git ls-tree --name-only HEAD $$a | grep -q $$a; then \
+                               echo New file $$a ; \
+                               git add $$a ; \
+                       elif ! diff -u $$a.old $$a.new.cmp; then \
+                               echo New changes for $$a; \
+                               mv $$a.new $$a; \
+                       else \
+                               git checkout -f HEAD $$a ; \
+                       fi ; \
+                       rm -f $$a.old $$a.new $$a.new.cmp ; \
+               done && \
+               ls po/*.po | sed 's%^po/\(.*\)\.po%\1%' > po/LINGUAS ; \
+               if ! git update-index -q --refresh --unmerged || \
+                  ! git diff-index --name-only --exit-code HEAD -- po/ >/dev/null; then \
+                       git commit -s -m "Update translations from Transifex" -- po/ ; \
+               else \
+                       echo No changes to commit ; \
+               fi ; \
        fi
 
 upload-pot: po/$(PACKAGE).pot