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

acbs: treat /tree as a "safe directory" #35

Merged
merged 1 commit into from
Dec 1, 2024

Conversation

Cyanoxygen
Copy link
Member

  • This allows maintainers to build packages with correct version numbers, if their /TREE is not owned by root (e.g. using regular user for development and SSH access).
  • Without this fix, ACBS will be unable to get commit, branch and working tree status (e.g. whether if it is in stable, to add extra version strings if TREE is in a topic branch) when the ABBS tree is not owned by root.
  • acbs/main: install safe.directory configuration if systemd-nspawn is detected (assuming it is a Ciel container instance).
  • acbs/utils: Add parameters to treat /tree as "safe directory".

Copy link

what-the-diff bot commented Nov 29, 2024

PR Summary

  • New Function to Identify Container Environments
    The introduction of a function named detect_nspawn(). Its role is to determine whether the script is operating within a specific type of container environment known as systemd-nspawn.

  • Establishment of a Safe Directory
    The variable GIT_CONFIG_SAFEDIR has been introduced; it holds a string of Git configuration that designates the /tree directory as a safe place to execute operations.

  • Enhancements to Initialization Process
    The init() method has been revised to incorporate a safety check. This check will only write the Git config for the safe directory if the previously mentioned detect_nspawn() function indicates that the script is running in the systemd-nspawn container environment.

  • Improved Git Commands for Safety
    Git commands within utils.py file have been updated to include -c safe.directory=/tree. This directive ensures that Git operations are performed safely in the previously established /tree directory.

- This allows maintainers to build packages with correct version
  numbers, even if their /TREE is not owned by root (e.g. using regular
  user for development and SSH access).
- Without this fix, ACBS will be unable to get commit, branch and
  working tree status (e.g. whether if it is in stable, to add extra
  version strings if TREE is in a topic branch) when the ABBS tree is
  not owned by root.

* acbs/main: install safe.directory configuration if systemd-nspawn is
  detected (assuming it is a Ciel container instance).
* acbs/utils: Add parameters to treat /tree as "safe directory".
@Cyanoxygen
Copy link
Member Author

Testing

I usually use my regular user to manage ABBS tree in my Ciel workspace, therefore ACBS will always fail when getting branch and commit information. The required topic timestamp is not appended to version of the resulting package:

image image

After the fix ACBS is able to pick up the branch and commit information, and:

image

The resulting package has the required timestamp appended to its version string:

image

@Cyanoxygen Cyanoxygen merged commit 21a8784 into production Dec 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants