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

Allow apt preferences #40

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Allow apt preferences #40

merged 1 commit into from
Jan 24, 2025

Conversation

thir820
Copy link
Collaborator

@thir820 thir820 commented Jan 23, 2025

Changes

Allow apt preferences by applying file overlays after apt config generation.
This allows overwriting the generated apt configuration and adding additional configs like apt preferences.

Dependencies:

none

Tests results

(.venv) (venv) ebcl@bce84abd09b2:/workspace$ pytest
======================================================================================= test session starts ========================================================================================
platform linux -- Python 3.10.12, pytest-8.3.3, pluggy-1.5.0
rootdir: /workspace
configfile: pyproject.toml
testpaths: tests
plugins: cov-6.0.0
collected 88 items                                                                                                                                                                                 

tests/hypervisor/test_model.py ...........                                                                                                                                                   [ 12%]
tests/test_apt.py .........                                                                                                                                                                  [ 22%]
tests/test_boot.py ..                                                                                                                                                                        [ 25%]
tests/test_cache.py ........                                                                                                                                                                 [ 34%]
tests/test_config.py .....                                                                                                                                                                   [ 39%]
tests/test_deb.py ..                                                                                                                                                                         [ 42%]
tests/test_dependency.py ..                                                                                                                                                                  [ 44%]
tests/test_fake.py ....                                                                                                                                                                      [ 48%]
tests/test_files.py ...................                                                                                                                                                      [ 70%]
tests/test_initrd.py ........                                                                                                                                                                [ 79%]
tests/test_proxy.py .......                                                                                                                                                                  [ 87%]
tests/test_root.py .ssss.                                                                                                                                                                    [ 94%]
tests/test_version.py .....                                                                                                                                                                  [100%]

============================================================================ 84 passed, 4 skipped in 139.18s (0:02:19) =============================================================================
(.venv) (venv) ebcl@bce84abd09b2:/workspace/robot_tests$ robot *.robot
==============================================================================
Boot & Initrd & Root                                                          
==============================================================================
Boot & Initrd & Root.Boot                                                     
==============================================================================
Kernel exists                                                         | PASS |
------------------------------------------------------------------------------
Config is OK                                                          | PASS |
------------------------------------------------------------------------------
Script was executed                                                   | PASS |
------------------------------------------------------------------------------
Boot & Initrd & Root.Boot                                             | PASS |
3 tests, 3 passed, 0 failed
==============================================================================
Boot & Initrd & Root.Initrd                                                   
==============================================================================
Root Device is Mounted                                                | PASS |
------------------------------------------------------------------------------
Devices are Created                                                   | PASS |
------------------------------------------------------------------------------
Rootfs should be set up                                               | PASS |
------------------------------------------------------------------------------
File dummy.txt should be OK                                           | PASS |
------------------------------------------------------------------------------
File other.txt should be OK                                           | PASS |
------------------------------------------------------------------------------
Modules are installed                                                 | PASS |
------------------------------------------------------------------------------
Check modules loaded by init                                          | PASS |
------------------------------------------------------------------------------
Boot & Initrd & Root.Initrd                                           | PASS |
7 tests, 7 passed, 0 failed
==============================================================================
Boot & Initrd & Root.Root                                                     
==============================================================================
Systemd should exist                                                  | PASS |
------------------------------------------------------------------------------
Fakeoot config executed                                               | PASS |
------------------------------------------------------------------------------
Fakechroot config was executed                                        | PASS |
------------------------------------------------------------------------------
Chroot config was executed                                            | PASS |
------------------------------------------------------------------------------
Boot & Initrd & Root.Root                                             | PASS |
4 tests, 4 passed, 0 failed
==============================================================================
Boot & Initrd & Root                                                  | PASS |
14 tests, 14 passed, 0 failed
==============================================================================
Output:  /workspace/robot_tests/output.xml
Log:     /workspace/robot_tests/log.html
Report:  /workspace/robot_tests/report.html

Developer Checklist:

  • Test: Changes are tested
  • N/A Doc: Documentation has been updated
  • Git: Informative git commit message(s)
  • N/A Issue: If a related GitHub issue exists, linking is done

Reviewer checklist:

  • Review: Changes are reviewed
  • Review: Tested by the reviewer

@thir820 thir820 requested a review from MofX January 23, 2025 09:59
@thir820 thir820 force-pushed the allow_apt_preferences branch 2 times, most recently from d238ab2 to 852a97d Compare January 23, 2025 11:36
@thir820
Copy link
Collaborator Author

thir820 commented Jan 24, 2025

@MofX The preferences only have an effect for not installed packages. Downgrading already installed packages using preferences doesn't work.

@thir820 thir820 force-pushed the allow_apt_preferences branch from 852a97d to 4674d0b Compare January 24, 2025 09:57
ebcl/tools/root/debootstrap.py Outdated Show resolved Hide resolved
ebcl/tools/root/debootstrap.py Show resolved Hide resolved
ebcl/tools/root/debootstrap.py Outdated Show resolved Hide resolved
tests/test_root.py Outdated Show resolved Hide resolved
ebcl/tools/root/debootstrap.py Show resolved Hide resolved
@thir820 thir820 force-pushed the allow_apt_preferences branch from 4674d0b to 3b7b969 Compare January 24, 2025 11:06
@thir820
Copy link
Collaborator Author

thir820 commented Jan 24, 2025

@MofX Review findings are fixed and test re-run:

(.venv) (venv) ebcl@bce84abd09b2:/workspace$ pytest
======================================================================================= test session starts ========================================================================================
platform linux -- Python 3.10.12, pytest-8.3.3, pluggy-1.5.0
rootdir: /workspace
configfile: pyproject.toml
testpaths: tests
plugins: cov-6.0.0
collected 89 items                                                                                                                                                                                 

tests/hypervisor/test_model.py ...........                                                                                                                                                   [ 12%]
tests/test_apt.py .........                                                                                                                                                                  [ 22%]
tests/test_boot.py ..                                                                                                                                                                        [ 24%]
tests/test_cache.py ........                                                                                                                                                                 [ 33%]
tests/test_config.py .....                                                                                                                                                                   [ 39%]
tests/test_deb.py ..                                                                                                                                                                         [ 41%]
tests/test_dependency.py ..                                                                                                                                                                  [ 43%]
tests/test_fake.py ....                                                                                                                                                                      [ 48%]
tests/test_files.py ...................                                                                                                                                                      [ 69%]
tests/test_initrd.py ........                                                                                                                                                                [ 78%]
tests/test_proxy.py .......                                                                                                                                                                  [ 86%]
tests/test_root.py .ssss..                                                                                                                                                                   [ 94%]
tests/test_version.py .....                                                                                                                                                                  [100%]

============================================================================= 85 passed, 4 skipped in 69.63s (0:01:09) =============================================================================
(.venv) (venv) ebcl@bce84abd09b2:/workspace$ cd robot_tests/
(.venv) (venv) ebcl@bce84abd09b2:/workspace/robot_tests$ robot *.robot
==============================================================================
Boot & Initrd & Root                                                          
==============================================================================
Boot & Initrd & Root.Boot                                                     
==============================================================================
Kernel exists                                                         | PASS |
------------------------------------------------------------------------------
Config is OK                                                          | PASS |
------------------------------------------------------------------------------
Script was executed                                                   | PASS |
------------------------------------------------------------------------------
Boot & Initrd & Root.Boot                                             | PASS |
3 tests, 3 passed, 0 failed
==============================================================================
Boot & Initrd & Root.Initrd                                                   
==============================================================================
Root Device is Mounted                                                | PASS |
------------------------------------------------------------------------------
Devices are Created                                                   | PASS |
------------------------------------------------------------------------------
Rootfs should be set up                                               | PASS |
------------------------------------------------------------------------------
File dummy.txt should be OK                                           | PASS |
------------------------------------------------------------------------------
File other.txt should be OK                                           | PASS |
------------------------------------------------------------------------------
Modules are installed                                                 | PASS |
------------------------------------------------------------------------------
Check modules loaded by init                                          | PASS |
------------------------------------------------------------------------------
Boot & Initrd & Root.Initrd                                           | PASS |
7 tests, 7 passed, 0 failed
==============================================================================
Boot & Initrd & Root.Root                                                     
==============================================================================
Systemd should exist                                                  | PASS |
------------------------------------------------------------------------------
Fakeoot config executed                                               | PASS |
------------------------------------------------------------------------------
Fakechroot config was executed                                        | PASS |
------------------------------------------------------------------------------
Chroot config was executed                                            | PASS |
------------------------------------------------------------------------------
Boot & Initrd & Root.Root                                             | PASS |
4 tests, 4 passed, 0 failed
==============================================================================
Boot & Initrd & Root                                                  | PASS |
14 tests, 14 passed, 0 failed
==============================================================================
Output:  /workspace/robot_tests/output.xml
Log:     /workspace/robot_tests/log.html
Report:  /workspace/robot_tests/report.html

@thir820 thir820 merged commit e5bf22f into main Jan 24, 2025
1 check passed
@thir820 thir820 deleted the allow_apt_preferences branch January 24, 2025 11:38
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.

3 participants