Skip to content
Snippets Groups Projects
Commit 558ede05 authored by Ludovico de Nittis's avatar Ludovico de Nittis :palm_tree:
Browse files

generate-sysroots: Add ArgumentParser and handle FileExistsError for symlinks

parent 860ae417
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,22 @@ ...@@ -24,6 +24,22 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import os import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("path")
parser.add_argument('-i', '--install', action='store_true',
help='Install the sysroot in the provided [path], using $MESON_INSTALL_DESTDIR_PREFIX as a prefix')
args = parser.parse_args()
if args.install:
full_path = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], args.path.lstrip("/"))
else:
full_path = args.path
# If the chosen destination 'sysroot' is not yet available we create it
os.makedirs(full_path, mode=0o755, exist_ok=True)
os.chdir(full_path)
# Only the leaf directories need to be listed here. # Only the leaf directories need to be listed here.
for name in ''' for name in '''
...@@ -207,7 +223,10 @@ for name, target in { ...@@ -207,7 +223,10 @@ for name, target in {
'libvdpau_radeonsi.so.1.0.0', 'libvdpau_radeonsi.so.1.0.0',
}.items(): }.items():
os.makedirs(os.path.dirname(name), mode=0o755, exist_ok=True) os.makedirs(os.path.dirname(name), mode=0o755, exist_ok=True)
os.symlink(target, name) try:
os.symlink(target, name)
except FileExistsError:
pass
with open('debian10/usr/lib/os-release', 'w') as writer: with open('debian10/usr/lib/os-release', 'w') as writer:
writer.write('''\ writer.write('''\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment