From 6b6ac60d8ce19c20af35ccaf78974ceb0b66908b Mon Sep 17 00:00:00 2001
From: Daniel Mueller <daniel.q.mueller@stud.h-da.de>
Date: Fri, 25 Dec 2020 18:52:51 +0100
Subject: [PATCH] Remove the patchelf hack

The arm-elf-insight depends on libncurses5 while libncurses6 is installed by default.
Previously the dependecy was patched to use version 6 which is pretty bad.
Now libncurses5 is simply installed instead. Yes that package exists -_-
This also removes the need for the checksum.
---
 roles/mpstools/tasks/main.yml | 38 +----------------------------------
 1 file changed, 1 insertion(+), 37 deletions(-)

diff --git a/roles/mpstools/tasks/main.yml b/roles/mpstools/tasks/main.yml
index 628859c..159c816 100644
--- a/roles/mpstools/tasks/main.yml
+++ b/roles/mpstools/tasks/main.yml
@@ -13,22 +13,10 @@
     name:
       - git
       - make
-      - patchelf
+      - libncurses5
     install_recommends: false
     force_apt_get: true
 
-- name: Get current mpstools hash
-  set_fact:
-    mpstools_curr_hash: "{{ lookup('file', '/opt/mpstools/checksum', errors='ignore') }}"
-    
-- name: Get new mpstools hash
-  stat:
-    path: "{{ role_path }}/files/mpstools.tgz"
-    checksum_algorithm: sha1
-    get_checksum: true
-  delegate_to: localhost
-  register: mpstools_new
-
 - name: Install toolchain
   become: true
   unarchive:
@@ -36,30 +24,6 @@
     group: root
     src: mpstools.tgz
     dest: /opt
-    keep_newer: true
-  when: mpstools_curr_hash != mpstools_new.stat.checksum
-
-# This has worked while testing but it is not a good way to solve the issue.
-# It basically forces the executables to use the newer version of libncurses
-- name: Patch arm debugger binaries to use libncurses.so.6
-  become: true
-  shell: "ldd {{ item }} | grep libncurses.so.5 && patchelf --replace-needed libncurses.so.5 libncurses.so.6 {{ item }}; exit 0"
-  with_items:
-    - /opt/mpstools/bin/arm-v4t-eabi-insight
-    - /opt/mpstools/bin/arm-v4t-eabi-gdbtui
-    - /opt/mpstools/bin/arm-v4t-eabi-gdb
-    - /opt/mpstools/bin/arm-elf-insight
-    - /opt/mpstools/bin/arm-elf-eabi-insight
-  when: mpstools_curr_hash != mpstools_new.stat.checksum and patch_libncurses5_to_6
-
-- name: Set toolchain checksum
-  become: true
-  copy:
-    owner: root
-    group: root
-    dest: /opt/mpstools/checksum
-    content: "{{ mpstools_new.stat.checksum }}"
-  when: mpstools_curr_hash != mpstools_new.stat.checksum
 
 - name: Add toolchain to PATH (for bash only)
   become: true
-- 
GitLab