mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-10-04 15:58:22 +00:00
Export binaries of 3rd-party bundles after install
When a 3rd-party bundle is installed, in order for the user to be able to use the binaries the bundle provides, it needs to have them exported. This commit exports those binaries after they have been successfully installed. Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit is contained in:
committed by
Otavio Pontes
parent
1bd709719a
commit
691f4b45e4
@@ -33,11 +33,13 @@ test_setup() {
|
||||
Bundle test-bundle2 found in 3rd-party repository test-repo2
|
||||
Bundles added from a 3rd-party repository are forced to run with the --no-scripts flag for security reasons
|
||||
Loading required manifests...
|
||||
Validating 3rd-party bundle binaries...
|
||||
No packs need to be downloaded
|
||||
Validate downloaded files
|
||||
Starting download of remaining update content. This may take a while...
|
||||
Installing files...
|
||||
Warning: post-update helper scripts skipped due to --no-scripts argument
|
||||
Exporting 3rd-party bundle binaries...
|
||||
Successfully installed 1 bundle
|
||||
EOM
|
||||
)
|
||||
@@ -89,11 +91,13 @@ test_setup() {
|
||||
Bundle test-bundle2 found in 3rd-party repository test-repo2
|
||||
Bundles added from a 3rd-party repository are forced to run with the --no-scripts flag for security reasons
|
||||
Loading required manifests...
|
||||
Validating 3rd-party bundle binaries...
|
||||
No packs need to be downloaded
|
||||
Validate downloaded files
|
||||
Starting download of remaining update content. This may take a while...
|
||||
Installing files...
|
||||
Warning: post-update helper scripts skipped due to --no-scripts argument
|
||||
Exporting 3rd-party bundle binaries...
|
||||
Successfully installed 1 bundle
|
||||
EOM
|
||||
)
|
||||
@@ -116,11 +120,13 @@ test_setup() {
|
||||
Bundle test-bundle2 found in 3rd-party repository test-repo2
|
||||
Bundles added from a 3rd-party repository are forced to run with the --no-scripts flag for security reasons
|
||||
Loading required manifests...
|
||||
Validating 3rd-party bundle binaries...
|
||||
No packs need to be downloaded
|
||||
Validate downloaded files
|
||||
Starting download of remaining update content. This may take a while...
|
||||
Installing files...
|
||||
Warning: post-update helper scripts skipped due to --no-scripts argument
|
||||
Exporting 3rd-party bundle binaries...
|
||||
Successfully installed 1 bundle
|
||||
Searching for bundle upstream-bundle in the 3rd-party repositories...
|
||||
Error: bundle upstream-bundle was not found in any 3rd-party repository
|
||||
|
||||
@@ -42,11 +42,13 @@ test_setup() {
|
||||
Bundle test-bundle1 found in 3rd-party repository test-repo
|
||||
Bundles added from a 3rd-party repository are forced to run with the --no-scripts flag for security reasons
|
||||
Loading required manifests...
|
||||
Validating 3rd-party bundle binaries...
|
||||
No packs need to be downloaded
|
||||
Validate downloaded files
|
||||
Starting download of remaining update content. This may take a while...
|
||||
Installing files...
|
||||
Warning: post-update helper scripts skipped due to --no-scripts argument
|
||||
Exporting 3rd-party bundle binaries...
|
||||
Successfully installed 1 bundle
|
||||
1 bundle was installed as dependency
|
||||
EOM
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
# Author: Castulo Martinez
|
||||
# Email: castulo.martinez@intel.com
|
||||
|
||||
load "../testlib"
|
||||
|
||||
test_setup() {
|
||||
|
||||
create_test_environment "$TEST_NAME"
|
||||
# create a 3rd-party bundle that has a couple of binaries
|
||||
add_third_party_repo "$TEST_NAME" 10 1 test-repo1
|
||||
create_bundle -n test-bundle1 -f /file1,/foo/file_2,/usr/bin/file_3,/bin/file_4 -u test-repo1 "$TEST_NAME"
|
||||
|
||||
}
|
||||
|
||||
@test "TPR056: Adding one bundle from a third party repo that will export binaries" {
|
||||
|
||||
# If a 3rd-party bundle has binaries to be exported (marked with 'x' in the
|
||||
# manifest and within /bin, /usr/bin, or /usr/local/bin) they should have a
|
||||
# script created in /opt/3rd-party/bin to make the binary available to the user
|
||||
|
||||
run sudo sh -c "$SWUPD 3rd-party bundle-add $SWUPD_OPTS test-bundle1"
|
||||
|
||||
assert_status_is "$SWUPD_OK"
|
||||
expected_output=$(cat <<-EOM
|
||||
Searching for bundle test-bundle1 in the 3rd-party repositories...
|
||||
Bundle test-bundle1 found in 3rd-party repository test-repo1
|
||||
Bundles added from a 3rd-party repository are forced to run with the --no-scripts flag for security reasons
|
||||
Loading required manifests...
|
||||
Validating 3rd-party bundle binaries...
|
||||
Downloading packs for:
|
||||
- test-bundle1
|
||||
Finishing packs extraction...
|
||||
Validate downloaded files
|
||||
No extra files need to be downloaded
|
||||
Installing files...
|
||||
Warning: post-update helper scripts skipped due to --no-scripts argument
|
||||
Exporting 3rd-party bundle binaries...
|
||||
Successfully installed 1 bundle
|
||||
EOM
|
||||
)
|
||||
assert_is_output "$expected_output"
|
||||
|
||||
# the script files should have been generated for the exported files
|
||||
assert_file_exists "$TARGETDIR"/"$THIRD_PARTY_BIN_DIR"/file_3
|
||||
assert_file_exists "$TARGETDIR"/"$THIRD_PARTY_BIN_DIR"/file_4
|
||||
|
||||
# verify the content of the scripts is correct
|
||||
run sudo sh -c "cat $TARGETDIR/$THIRD_PARTY_BIN_DIR/file_3"
|
||||
expected_output=$(cat <<-EOM
|
||||
#!/bin/bash
|
||||
export PATH=.*
|
||||
export LD_LIBRARY_PATH=.*
|
||||
$PATH_PREFIX/$THIRD_PARTY_BUNDLES_DIR/test-repo1/usr/bin/file_3 .*
|
||||
EOM
|
||||
)
|
||||
assert_regex_is_output "$expected_output"
|
||||
|
||||
}
|
||||
|
||||
@test "TPR057: Try adding one bundle from a third party repo that will export conflicting binaries" {
|
||||
|
||||
# If a 3rd-party bundle has binaries to be exported but the binary already exists
|
||||
# in the target system, the bundle installation should be aborted
|
||||
|
||||
sudo mkdir -p "$TARGETDIR"/"$THIRD_PARTY_BIN_DIR"
|
||||
sudo touch "$TARGETDIR"/"$THIRD_PARTY_BIN_DIR"/file_3
|
||||
|
||||
run sudo sh -c "$SWUPD 3rd-party bundle-add $SWUPD_OPTS test-bundle1"
|
||||
|
||||
assert_status_is "$SWUPD_COULDNT_CREATE_FILE"
|
||||
expected_output=$(cat <<-EOM
|
||||
Searching for bundle test-bundle1 in the 3rd-party repositories...
|
||||
Bundle test-bundle1 found in 3rd-party repository test-repo1
|
||||
Bundles added from a 3rd-party repository are forced to run with the --no-scripts flag for security reasons
|
||||
Loading required manifests...
|
||||
Validating 3rd-party bundle binaries...
|
||||
Error: There is already a binary called file_3 in $PATH_PREFIX/opt/3rd-party/bin
|
||||
Aborting bundle installation...
|
||||
Failed to install 1 of 1 bundles
|
||||
EOM
|
||||
)
|
||||
assert_is_output "$expected_output"
|
||||
|
||||
}
|
||||
@@ -56,11 +56,13 @@ test_setup() {
|
||||
expected_output=$(cat <<-EOM
|
||||
Bundles added from a 3rd-party repository are forced to run with the --no-scripts flag for security reasons
|
||||
Loading required manifests...
|
||||
Validating 3rd-party bundle binaries...
|
||||
No packs need to be downloaded
|
||||
Validate downloaded files
|
||||
Starting download of remaining update content. This may take a while...
|
||||
Installing files...
|
||||
Warning: post-update helper scripts skipped due to --no-scripts argument
|
||||
Exporting 3rd-party bundle binaries...
|
||||
Successfully installed 1 bundle
|
||||
EOM
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user