Commit 62337a6e authored by Johan Ouwerkerk's avatar Johan Ouwerkerk
Browse files

feat: support organising cloned source directories according to the 'layout'...

feat: support organising cloned source directories according to the 'layout' of repositories on invent.kde.org

Issues: #59
parent b6c37bb8
Pipeline #44426 passed with stage
in 3 minutes and 10 seconds
......@@ -81,7 +81,8 @@ our %defaultGlobalFlags = (
"delete-my-settings" => 0, # Should only be set from cmdline
"disable-agent-check" => 0, # If true we don't check on ssh-agent
"disable-snapshots" => 1, # 2016-07-31 Temp. disabled until kde.org fixed to supply snapshots
"ignore-kde-structure" => 0, # Whether to use kde dir structure like extragear/network
"ignore-kde-structure" => 0, # Whether to use kde dir structure like extragear/network. Deprecated as of late December 2020/January 2021
"directory-layout" => 'metadata', # Directory layout to use, can be 'flat', 'invent', 'metadata' (project path based hierarchy)
"include-dependencies" => 0, # 2019-08-31 Made negatable from cmdline (NB: false here but true in rcfile)
"install-after-build" => 1,
"install-environment-driver" => 1, # Setup ~/.config/kde-env-*.sh for login scripts
......
......@@ -957,12 +957,40 @@ sub destDir
my $destDir = $self->getOption('dest-dir');
my $basePath = "";
my $layout = $self->getOption('directory-layout');
if ($self->getOption('ignore-kde-structure')) {
# avoid spamming
if (!$self->getOption('#warned-deprecated-ignore-kde-structure')) {
warning("b[ignore-kde-structure] is deprecated, please use b[directory-layout] instead for b[$self]");
}
# no or equivalent layout configured, assume the user wants to use flat layout
if (!$layout || $layout eq 'flat') {
$layout = 'flat';
} else {
# avoid spamming
if (!$self->getOption('#warned-deprecated-ignore-kde-structure')) {
warning("Deprecated b[ignore-kde-structure] will be ignored in favour of b[directory-layout] for b[$self]");
}
}
# avoid spamming
$self->setOption('#warned-deprecated-ignore-kde-structure', 1);
}
if ($layout eq 'flat') {
$basePath = $self->name();
} else {
$basePath = shift // $self->getOption('#xml-full-path');
$basePath ||= $self->name(); # Default if not provided in repo-metadata
# invent layout only works for proper KDE projects, which have a kde:(.*).git pattern repository configured
if ($layout eq 'invent' && $self->getOption('repository') =~ m/kde:(.*)\.git/) {
$basePath = $1;
} else {
if (!$self->getOption('#warned-invalid-directory-layout') # avoid spamming
&& $layout ne 'invent' && $layout ne 'metadata') {
warning("Invalid b[directory-layout] value: $layout. Will use b[default] instead for b[$self]");
$self->setOption('#warned-invalid-directory-layout', 1);
}
$basePath = shift // $self->getOption('#xml-full-path');
$basePath ||= $self->name(); # Default if not provided in repo-metadata
}
}
$destDir =~ s/(\$\{MODULE})|(\$MODULE\b)/$basePath/g;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment