Commit ff6b00d1 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

git: Add scratching lib script.

No related merge requests found
Pipeline #55590 passed with stages
in 10 minutes and 26 seconds
Showing with 70 additions and 1 deletion
+70 -1
......@@ -32,7 +32,7 @@ scratching:
- job: build
artifacts: true
script:
- echo OK
- python3 ./scratching.py
artifacts:
paths:
- dist/
......
scratching.py 0 → 100644
# Copyright (C) 2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import os
import shutil
from subprocess import Popen, PIPE
def find_cmd(lib):
return [
"find", "/", "-type", "f",
"-name", f"{lib}.so*"
]
def find_filter(lib):
cmd = find_cmd(lib)
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=False)
files = p.communicate()[0].split()
files = filter(lambda p: not b"snap" in p, files)
files = filter(lambda p: not b"flatpak" in p, files)
files = filter(lambda p: not b"gnu/store" in p, files)
files = filter(lambda p: b"x86_64" in p, files)
files = list(map(lambda p: p.decode('ascii'), files))
return files
def make_link(name):
lib = f"{name}"
def make_link_aux(rest):
if len(rest) <= 1:
return True
ln = f"""dist/lib/{".".join(rest)}"""
print(f" LN {ln}")
os.symlink(lib, ln)
return make_link_aux(rest[:-1])
return make_link_aux(name.split(".")[:-1])
libs = ["libssl", "libcrypt", "libz", "libffi"]
for lib in libs:
files = find_filter(lib)
# Copy file to dist
for f in files:
print(f" COPY {f}")
name = os.path.basename(f)
shutil.copyfile(f, f"dist/lib/{name}")
# Make symbolic link
make_link(str(name))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment