Skip to content
Open
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions tests/discover/distgit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ EOF
WORKDIR=/var/tmp/tmt/XXX
rlRun -s 'tmt run --keep --scratch --id $WORKDIR plans --default \
discover --how fmf --dist-git-source --dist-git-type fedora --url $CLONED_RPMS_TMT \
--dist-git-merge tests --name tests/prepare/install$ prepare provision -h local'
tests --name tests/prepare/install$ prepare provision -h local'
assert_tests $WORKDIR tests/prepare/install
rlPhaseEnd

Expand All @@ -387,9 +387,9 @@ EOF
rlRun 'pushd tmt'
WORKDIR=/var/tmp/tmt/XXX
rlRun -s "tmt run --keep --scratch --id $WORKDIR plans --default discover -v --how fmf \
--dist-git-source --dist-git-merge --ref e2d36db --dist-git-extract ${prefix}tmt-1.7.0/tests/execute/framework/data \
tests --name ^/tests/beakerlib/with-framework\$ prepare provision -h local"
assert_tests $WORKDIR /tests/beakerlib/with-framework
--dist-git-source --ref 518edd9 --dist-git-extract ${prefix}tmt-1.74.0/tests/execute/basic/data \
tests --name ^/test/shell/good\$ prepare provision -h local"
assert_tests $WORKDIR /test/shell/good

rlRun 'popd'
rlPhaseEnd
Expand All @@ -398,10 +398,10 @@ EOF
rlPhaseStartTest "Specify URL and REF of DistGit repo (Fedora)"
WORKDIR=/var/tmp/tmt/XXX
rlRun -s 'tmt run --keep --scratch --id $WORKDIR plans --default discover -v --how fmf \
--dist-git-source --ref e2d36db --dist-git-merge --dist-git-init \
--dist-git-source --ref 518edd9 \
--url https://src.fedoraproject.org/rpms/tmt.git \
tests --name tests/prepare/install$ prepare provision -h local'
assert_tests $WORKDIR "/tmt-1.7.0/tests/prepare/install"
tests --name ^/tests/prepare/install$ prepare provision -h local'
assert_tests $WORKDIR "/tests/prepare/install"
rlPhaseEnd

rlPhaseStartTest "fmf and git root don't match"
Expand Down
12 changes: 1 addition & 11 deletions tmt/steps/discover/fmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,17 +650,10 @@ def go(self, *, path: Optional[Path] = None, logger: Optional[tmt.log.Logger] =
super().go(path=path, logger=logger)

dist_git_source = self.get('dist-git-source', False)
dist_git_merge = self.get('dist-git-merge', False)

# No tests are selected in some cases
self._tests: list[tmt.Test] = []

# Self checks
if dist_git_source and not dist_git_merge and (self.data.ref or self.data.url):
raise tmt.utils.DiscoverError(
"Cannot manipulate with dist-git without the `--dist-git-merge` option."
)

self.log_import_plan_details()

# Dist-git source processing during discover step
Expand All @@ -678,9 +671,7 @@ def go(self, *, path: Optional[Path] = None, logger: Optional[tmt.log.Logger] =
raise tmt.utils.DiscoverError(
f"Directory '{fmf_root}' is not a git repository."
)

distgit_dir = self.test_dir if self.data.ref else git_root
self.process_distgit_source(distgit_dir)
self.process_distgit_source(git_root)
return
except Exception as error:
raise tmt.utils.DiscoverError("Failed to process 'dist-git-source'.") from error
Expand All @@ -700,7 +691,6 @@ def process_distgit_source(self, distgit_dir: Path) -> None:
)

# Copy rest of files so TMT_SOURCE_DIR has patches, sources and spec file
# FIXME 'worktree' could be used as source_dir when 'url' is not set
tmt.utils.filesystem.copy_tree(
distgit_dir,
self.source_dir,
Expand Down
Loading