Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ypkg: Always check for broken symlinks post-install #79

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions ypkg2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def clean_build_dirs(context):

def execute_step(context, step, step_n, work_dir):
script = ScriptGenerator(context, context.spec, work_dir)
preExtraScripts = []
postExtraScripts = []
if context.emul32:
script.define_export("EMUL32BUILD", "1")
script.define_export("PKG_CONFIG_PATH", EMUL32PC)
Expand All @@ -127,8 +129,6 @@ def execute_step(context, step, step_n, work_dir):
script.define_export("PGO_GEN_BUILD", "1")
if context.use_pgo:
script.define_export("PGO_USE_BUILD", "1")
extraScript = None
endScript = None

# Allow GCC and such to pick up on our timestamp
script.define_export("SOURCE_DATE_EPOCH",
Expand All @@ -143,12 +143,15 @@ def execute_step(context, step, step_n, work_dir):
elif context.use_pgo and context.spec.pkg_clang:
profileFile = os.path.join(context.get_pgo_dir(),
"default.profdata")
extraScript = "%llvm_profile_merge"
preExtraScripts.append("%llvm_profile_merge")
script.define_export("LLVM_PROFILE_FILE", profileFile)
script.define_export("YPKG_PGO_DIR", context.get_pgo_dir())

if context.avx2 and step_n == "install":
endScript = "%avx2_lib_shift"
postExtraScripts.append("%avx2_lib_shift")

if step_n == "install":
postExtraScripts.append("%symlink_check")

# Generally, we only want fakeroot for the install and check steps due
# to the massive performance overhead unless fatfakeroot is requested.
Expand All @@ -167,11 +170,19 @@ def execute_step(context, step, step_n, work_dir):
full_text += "\n".join(exports)
if context.spec.pkg_environment:
full_text += "\n\n{}\n".format(context.spec.pkg_environment)
if extraScript:
full_text += "\n\n{}\n".format(extraScript)

# Any scripts to execute before running the step
if preExtraScripts is not None:
for preScript in preExtraScripts:
full_text += "\n\n{}\n".format(preScript)

full_text += "\n\n{}\n".format(step)
if endScript:
full_text += "\n\n{}\n".format(endScript)

# Any post scripts to execute after running the step
if postExtraScripts is not None:
for postScript in postExtraScripts:
full_text += "\n\n{}\n".format(postScript)

output = script.escape_string(full_text)

with tempfile.NamedTemporaryFile(prefix="ypkg-%s" % step_n) as script_ex:
Expand Down