I've replaced all instances in the code of `os.path.abspath` with `os.path.realpath`, as this does the same as `abspath` plus resolving symlinks. See also: https://stackoverflow.com/a/40311142
This commit is contained in:
parent
2f8d589ed6
commit
ff9f2d620f
|
@ -103,7 +103,7 @@ def aports_files_out_of_sync_with_git(args, package=None):
|
||||||
# Filter out a specific package
|
# Filter out a specific package
|
||||||
if package:
|
if package:
|
||||||
ret = []
|
ret = []
|
||||||
prefix = os.path.abspath(
|
prefix = os.path.realpath(
|
||||||
pmb.build.other.find_aport(
|
pmb.build.other.find_aport(
|
||||||
args, package)) + "/"
|
args, package)) + "/"
|
||||||
for file in aports_files_out_of_sync_with_git(args):
|
for file in aports_files_out_of_sync_with_git(args):
|
||||||
|
@ -137,10 +137,10 @@ def aports_files_out_of_sync_with_git(args, package=None):
|
||||||
working_dir=git_root, return_stdout=True)
|
working_dir=git_root, return_stdout=True)
|
||||||
|
|
||||||
# Set absolute path, filter out aports files
|
# Set absolute path, filter out aports files
|
||||||
aports_absolute = os.path.abspath(args.aports)
|
aports_absolute = os.path.realpath(args.aports)
|
||||||
files = tracked.rstrip().split("\n") + untracked.rstrip().split("\n")
|
files = tracked.rstrip().split("\n") + untracked.rstrip().split("\n")
|
||||||
for file in files:
|
for file in files:
|
||||||
file = os.path.abspath(git_root + "/" + file)
|
file = os.path.realpath(git_root + "/" + file)
|
||||||
if file.startswith(aports_absolute):
|
if file.startswith(aports_absolute):
|
||||||
ret.append(file)
|
ret.append(file)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -54,7 +54,7 @@ def build(args, apk_path):
|
||||||
repo_diff = pmb.helpers.repo.diff(args, repo_before)
|
repo_diff = pmb.helpers.repo.diff(args, repo_before)
|
||||||
|
|
||||||
# Diff the apk contents
|
# Diff the apk contents
|
||||||
staging_path = os.path.abspath(os.path.dirname(apk_path) + "/../")
|
staging_path = os.path.realpath(os.path.dirname(apk_path) + "/../")
|
||||||
for file in repo_diff:
|
for file in repo_diff:
|
||||||
file_staging = staging_path + "/" + file
|
file_staging = staging_path + "/" + file
|
||||||
file_work = args.work + "/packages/" + file
|
file_work = args.work + "/packages/" + file
|
||||||
|
|
|
@ -39,7 +39,7 @@ def zap(args):
|
||||||
patterns += ["cache_http"]
|
patterns += ["cache_http"]
|
||||||
|
|
||||||
for pattern in patterns:
|
for pattern in patterns:
|
||||||
pattern = os.path.abspath(args.work + "/" + pattern)
|
pattern = os.path.realpath(args.work + "/" + pattern)
|
||||||
matches = glob.glob(pattern)
|
matches = glob.glob(pattern)
|
||||||
for match in matches:
|
for match in matches:
|
||||||
if pmb.helpers.cli.confirm(args, "Remove " + match + "?"):
|
if pmb.helpers.cli.confirm(args, "Remove " + match + "?"):
|
||||||
|
|
|
@ -66,7 +66,7 @@ def symlink(args, file, link):
|
||||||
"""
|
"""
|
||||||
if os.path.exists(link):
|
if os.path.exists(link):
|
||||||
if (os.path.islink(link) and
|
if (os.path.islink(link) and
|
||||||
os.path.abspath(os.readlink(link)) == os.path.abspath(file)):
|
os.path.realpath(os.readlink(link)) == os.path.realpath(file)):
|
||||||
return
|
return
|
||||||
raise RuntimeError("File exists: " + link)
|
raise RuntimeError("File exists: " + link)
|
||||||
elif os.path.islink(link):
|
elif os.path.islink(link):
|
||||||
|
|
|
@ -25,7 +25,7 @@ def ismount(folder):
|
||||||
Ismount() implementation, that works for mount --bind.
|
Ismount() implementation, that works for mount --bind.
|
||||||
Workaround for: https://bugs.python.org/issue29707
|
Workaround for: https://bugs.python.org/issue29707
|
||||||
"""
|
"""
|
||||||
folder = os.path.abspath(os.path.realpath(folder))
|
folder = os.path.realpath(os.path.realpath(folder))
|
||||||
with open("/proc/mounts", "r") as handle:
|
with open("/proc/mounts", "r") as handle:
|
||||||
for line in handle:
|
for line in handle:
|
||||||
words = line.split()
|
words = line.split()
|
||||||
|
@ -86,7 +86,7 @@ def umount_all_list(prefix, source="/proc/mounts"):
|
||||||
:returns: a list of folders, that need to be umounted
|
:returns: a list of folders, that need to be umounted
|
||||||
"""
|
"""
|
||||||
ret = []
|
ret = []
|
||||||
prefix = os.path.abspath(prefix)
|
prefix = os.path.realpath(prefix)
|
||||||
with open(source, "r") as handle:
|
with open(source, "r") as handle:
|
||||||
for line in handle:
|
for line in handle:
|
||||||
words = line.split()
|
words = line.split()
|
||||||
|
|
|
@ -23,7 +23,7 @@ import glob
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
pmb_src = os.path.abspath(os.path.join(os.path.dirname(__file__) + "/.."))
|
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
|
||||||
sys.path.append(pmb_src)
|
sys.path.append(pmb_src)
|
||||||
import pmb.chroot.apk_static
|
import pmb.chroot.apk_static
|
||||||
import pmb.parse.apkindex
|
import pmb.parse.apkindex
|
||||||
|
|
|
@ -21,7 +21,7 @@ import sys
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.build.other
|
import pmb.build.other
|
||||||
import pmb.chroot.apk
|
import pmb.chroot.apk
|
||||||
|
@ -84,7 +84,7 @@ def out_of_sync_files(args):
|
||||||
def test_aport_in_sync_with_git(args):
|
def test_aport_in_sync_with_git(args):
|
||||||
aports = temp_aports_repo(args)
|
aports = temp_aports_repo(args)
|
||||||
ret_in_sync = []
|
ret_in_sync = []
|
||||||
ret_out_of_sync = [args.aports + "/main/alpine-base/APKBUILD"]
|
ret_out_of_sync = [os.path.realpath(args.aports + "/main/alpine-base/APKBUILD")]
|
||||||
|
|
||||||
# In sync (no files changed)
|
# In sync (no files changed)
|
||||||
assert out_of_sync_files(args) == ret_in_sync
|
assert out_of_sync_files(args) == ret_in_sync
|
||||||
|
|
|
@ -22,7 +22,7 @@ import pytest
|
||||||
import filecmp
|
import filecmp
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.aportgen
|
import pmb.aportgen
|
||||||
import pmb.config
|
import pmb.config
|
||||||
|
|
|
@ -21,7 +21,7 @@ import sys
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.aportgen
|
import pmb.aportgen
|
||||||
import pmb.config
|
import pmb.config
|
||||||
|
|
|
@ -21,7 +21,7 @@ import sys
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.build.other
|
import pmb.build.other
|
||||||
import pmb.helpers.logging
|
import pmb.helpers.logging
|
||||||
|
@ -73,7 +73,7 @@ def cache_files_out_of_sync(args, is_out_of_sync):
|
||||||
new = []
|
new = []
|
||||||
if is_out_of_sync:
|
if is_out_of_sync:
|
||||||
aport = pmb.build.other.find_aport(args, "hello-world")
|
aport = pmb.build.other.find_aport(args, "hello-world")
|
||||||
new = [os.path.abspath(aport + "/APKBUILD")]
|
new = [os.path.realpath(aport + "/APKBUILD")]
|
||||||
args.cache["aports_files_out_of_sync_with_git"] = new
|
args.cache["aports_files_out_of_sync_with_git"] = new
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import pytest
|
||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.challenge.apk_file
|
import pmb.challenge.apk_file
|
||||||
import pmb.config
|
import pmb.config
|
||||||
|
|
|
@ -21,7 +21,7 @@ import sys
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.challenge.apkindex
|
import pmb.challenge.apkindex
|
||||||
import pmb.config
|
import pmb.config
|
||||||
|
|
|
@ -21,7 +21,7 @@ import sys
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.build.package
|
import pmb.build.package
|
||||||
import pmb.challenge.build
|
import pmb.challenge.build
|
||||||
|
|
|
@ -24,7 +24,7 @@ def test_chroot_interactive_shell():
|
||||||
"""
|
"""
|
||||||
Open a shell with 'pmbootstrap chroot' and pass 'echo hello_world\n' as stdin.
|
Open a shell with 'pmbootstrap chroot' and pass 'echo hello_world\n' as stdin.
|
||||||
"""
|
"""
|
||||||
pmb_src = os.path.abspath(os.path.join(os.path.dirname(__file__) + "/.."))
|
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
|
||||||
os.chdir(pmb_src)
|
os.chdir(pmb_src)
|
||||||
ret = subprocess.check_output(["./pmbootstrap.py", "-q", "chroot"], timeout=300,
|
ret = subprocess.check_output(["./pmbootstrap.py", "-q", "chroot"], timeout=300,
|
||||||
input="echo hello_world\n", universal_newlines=True,
|
input="echo hello_world\n", universal_newlines=True,
|
||||||
|
|
|
@ -23,7 +23,7 @@ import glob
|
||||||
import filecmp
|
import filecmp
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.parse.apkindex
|
import pmb.parse.apkindex
|
||||||
import pmb.helpers.git
|
import pmb.helpers.git
|
||||||
|
|
|
@ -20,7 +20,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.helpers.mount
|
import pmb.helpers.mount
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import time
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
pmb_src = os.path.abspath(os.path.join(os.path.dirname(__file__) + "/.."))
|
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
|
||||||
sys.path.append(pmb_src)
|
sys.path.append(pmb_src)
|
||||||
import pmb.build.package
|
import pmb.build.package
|
||||||
import pmb.helpers.logging
|
import pmb.helpers.logging
|
||||||
|
|
|
@ -21,7 +21,7 @@ import sys
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
pmb_src = os.path.abspath(os.path.join(os.path.dirname(__file__) + "/.."))
|
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
|
||||||
sys.path.append(pmb_src)
|
sys.path.append(pmb_src)
|
||||||
import pmb.chroot.root
|
import pmb.chroot.root
|
||||||
import pmb.chroot.user
|
import pmb.chroot.user
|
||||||
|
|
|
@ -21,7 +21,7 @@ import sys
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# Import from parent directory
|
# Import from parent directory
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.realpath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.helpers.git
|
import pmb.helpers.git
|
||||||
import pmb.helpers.logging
|
import pmb.helpers.logging
|
||||||
|
|
Loading…
Reference in New Issue