From ff853a98fbe8bc02fd13a3339e767b45015d9f70 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Fri, 1 Jan 2016 12:29:21 +0300
Subject: [PATCH] =?UTF-8?q?libreoffice:=20readd=20and=20fix=20the=20script?=
 =?UTF-8?q?=20to=20generate=20fetch=20list=20for=20LibreOffice.=20Migratin?=
 =?UTF-8?q?g=20all=20of=20these=20to=20system=20packages=20would=20not=20w?=
 =?UTF-8?q?ork=20without=20patching=20the=20build=20system,=20I=20am=20afr?=
 =?UTF-8?q?aid=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../libreoffice/generate-libreoffice-srcs.sh  | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100755 pkgs/applications/office/libreoffice/generate-libreoffice-srcs.sh

diff --git a/pkgs/applications/office/libreoffice/generate-libreoffice-srcs.sh b/pkgs/applications/office/libreoffice/generate-libreoffice-srcs.sh
new file mode 100755
index 00000000000..d77b41a0480
--- /dev/null
+++ b/pkgs/applications/office/libreoffice/generate-libreoffice-srcs.sh
@@ -0,0 +1,54 @@
+#!/run/current-system/sw/bin/bash
+
+# Take the list of files from the main package, ooo.lst.in
+
+cat <<EOF
+[
+EOF
+
+write_entry(){
+  echo '{'
+  echo "  name = \"${name}\";"
+  echo "  md5 = \"${md5}\";"
+  echo "  brief = ${brief};"
+  echo '}'
+}
+
+while read line; do
+  case "$line" in
+    \#*)
+      echo Skipping comment: "$line" >&2;
+      ;;
+    *_MD5SUM\ :=*)
+      read tbline;
+      line=${line##* };
+      if [ "${tbline#*VERSION_MICRO}" != "$tbline" ]; then
+         verline=${tbline##* };
+         read tbline;
+         tbline=${tbline##* };
+         md5=$line
+         name=$tbline;
+         name="${name/\$([A-Z]*_VERSION_MICRO)/$verline}"
+      else
+         tbline=${tbline##* };
+         md5=$line
+         name=$tbline;
+      fi
+      brief=true;
+      write_entry;
+      ;;
+    *_TARBALL\ :=*)
+      line=${line##* };
+      line="${line#,}"
+      md5=${line:0:32};
+      name=${line:33};
+      brief=false;
+      write_entry;
+      ;;
+    *)
+      echo Skipping: "$line" >&2;
+      ;;
+  esac
+done
+
+echo ']'