[kdesrc-build/make_it_mojo] /: Merge remote-tracking branch 'origin/master' into make_it_mojo

Michael Pyne null at kde.org
Sun May 10 19:39:11 BST 2020


Git commit 2d09b618029e5e3a8aa5236d7e01b7e647f74806 by Michael Pyne.
Committed on 10/05/2020 at 18:38.
Pushed by mpyne into branch 'make_it_mojo'.

Merge remote-tracking branch 'origin/master' into make_it_mojo

Conflicts:
	modules/ksb/Application.pm
	modules/ksb/Updater/Git.pm

M  +37   -6    doc/index.docbook
M  +2    -2    doc/man-kdesrc-build.1.docbook
M  +2    -1    kdesrc-build
M  +5    -2    modules/ksb/Application.pm
M  +3    -8    modules/ksb/BuildContext.pm
M  +17   -1    modules/ksb/BuildSystem.pm
M  +81   -1    modules/ksb/BuildSystem/KDE4.pm
M  +18   -11   modules/ksb/DependencyResolver.pm
M  +23   -13   modules/ksb/Module.pm
M  +1    -5    modules/ksb/ModuleSet/KDEProjects.pm
M  +130  -35   modules/ksb/Updater/Git.pm
M  +9    -12   modules/ksb/Util.pm
M  +10   -7    t/smoke/read-module-options.t
M  +6    -4    t/smoke/set-module-option-value.t

https://invent.kde.org/kde/kdesrc-build/commit/2d09b618029e5e3a8aa5236d7e01b7e647f74806

diff --cc modules/ksb/Application.pm
index 8bdbfd1,66992c2..53fd024
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@@ -455,10 -474,10 +455,10 @@@ sub establishContex
      $ctx->setKDEDependenciesMetadataModuleNeeded();
      $ctx->setKDEProjectsMetadataModuleNeeded();
  
 -    if (!exists $ENV{HARNESS_ACTIVE}) {
 -        # Running in a test harness, avoid downloading metadata which will be
 -        # ignored in the test or making changes to git config
 +    if (!exists $ENV{HARNESS_ACTIVE} && !$self->{run_mode} eq 'headless') {
 +        # In some modes (testing, acting as headless backend), we should avoid
 +        # downloading metadata automatically, so don't.
-         ksb::Updater::Git::verifyGitConfig();
+         ksb::Updater::Git::verifyGitConfig($ctx);
          $self->_downloadKDEProjectMetadata();
      }
  
diff --cc modules/ksb/BuildSystem.pm
index d17d5fc,f8e1b93..842d92d
--- a/modules/ksb/BuildSystem.pm
+++ b/modules/ksb/BuildSystem.pm
@@@ -83,9 -99,16 +99,9 @@@ sub needsRefreshe
      return "";
  }
  
 -# Returns true if the given subdirectory (reference from the module's root source directory)
 -# can be built or not. Should be reimplemented by subclasses as appropriate.
 -sub isSubdirBuildable
 -{
 -    return 1;
 -}
 -
  # Called by the module being built before it runs its build/install process. Should
  # setup any needed environment variables, build context settings, etc., in preparation
- # for the build and install phases.
+ # for the build and install phases. Should take `hasToolchain()` into account here.
  sub prepareModuleBuildEnvironment
  {
      my ($self, $ctx, $module, $prefix) = @_;
diff --cc modules/ksb/Updater/Git.pm
index 8cb3825,bc08a58..b474e0a
--- a/modules/ksb/Updater/Git.pm
+++ b/modules/ksb/Updater/Git.pm
@@@ -238,31 -303,13 +296,12 @@@ sub _setupBestRemot
      my $self     = assert_isa(shift, 'ksb::Updater::Git');
      my $module   = $self->module();
      my $cur_repo = $module->getOption('repository');
 -    my $ipc      = $self->{ipc} // croak_internal ('Missing IPC object');
  
      # Search for an existing remote name first. If none, add our alias.
-     my @remoteNames = $self->bestRemoteName($cur_repo);
- 
-     if (!@remoteNames) {
-         # The desired repo doesn't have a named remote, this should be
-         # because the user switched it in the rc-file. We control the
-         # 'origin' remote to fix this.
-         if ($self->hasRemote(DEFAULT_GIT_REMOTE)) {
-             if (log_command($module, 'git-update-remote',
-                         ['git', 'remote', 'set-url', DEFAULT_GIT_REMOTE, $cur_repo])
-                 != 0)
-             {
-                 croak_runtime("Unable to update the fetch URL for existing remote alias for $module");
-             }
-         }
-         elsif (log_command($module, 'git-remote-setup',
-                        ['git', 'remote', 'add', DEFAULT_GIT_REMOTE, $cur_repo])
-             != 0)
-         {
-             croak_runtime("Unable to add a git remote named " . DEFAULT_GIT_REMOTE . " for $cur_repo");
-         }
+     my @remoteNames = $self->bestRemoteName();
+     my $chosenRemote = @remoteNames ? $remoteNames[0] : DEFAULT_GIT_REMOTE;
  
-         push @remoteNames, DEFAULT_GIT_REMOTE;
-     }
+     $self->_setupRemote($chosenRemote);
  
      # Make a notice if the repository we're using has moved.
      my $old_repo = $module->getPersistentOption('git-cloned-repository');
@@@ -273,10 -320,11 +312,10 @@@
          note (" y[b[*]\tThe git remote named b[", DEFAULT_GIT_REMOTE, "] has been updated");
  
          # Update what we think is the current repository on-disk.
 -        $ipc->notifyPersistentOptionChange(
 -            $module->name(), 'git-cloned-repository', $cur_repo);
 +        #$ipc->notifyPersistentOptionChange($module->name(), 'git-cloned-repository', $cur_repo);
      }
  
-     return $remoteNames[0];
+     return $chosenRemote;
  }
  
  # Completes the steps needed to update a git checkout to be checked-out to
@@@ -535,13 -582,12 +574,12 @@@ sub stashAndUpdat
      # and the working dir in one command.
      my $status = 1;
      my $needsStash =
-         !pretending() &&
-         (scalar filter_program_output(
-                 undef, # don't filter output
-                 qw(git status --short --untracked-files=no))) > 0;
+         !pretending() && (system('git', 'diff-index', '--quiet', 'HEAD') >> 8);
+ 
+     log_command($module, 'git-status-before-update', [qw(git status)]);
  
      if ($needsStash) {
 -        info ("\tLocal changes detected, stashing them away...");
 +        info ("\tLocal changes detected (will stash for now and then restore)");
          $status = log_command($module, 'git-stash-save', [
                  qw(git stash save --quiet), "kdesrc-build auto-stash at $date",
              ]);
diff --cc t/smoke/read-module-options.t
index b2eaa69,f523f62..06915f9
--- a/t/smoke/read-module-options.t
+++ b/t/smoke/read-module-options.t
@@@ -40,17 -40,15 +40,19 @@@ package ksb::test 
  use ksb::Application;
  use ksb::Util qw(trimmed);
  
 -my $app = ksb::Application->new(qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc));
 -my @moduleList = @{$app->{modules}};
 +my @args = qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc);
 +my $app = ksb::Application->new;
 +my @selectors = $app->establishContext(@args);
 +my $workload = $app->modulesFromSelectors(@selectors);
 +$app->setModulesToProcess($workload);
 +my @moduleList = $app->modules();
  
  is(scalar @moduleList, 4, 'Right number of modules');
- is($moduleList[0]->name(), 'module2', 'Right module name');
  
- my $scm = $moduleList[0]->scm();
+ # module2 is last in rc-file so should sort last
+ is($moduleList[3]->name(), 'module2', 'Right module name');
+ 
+ my $scm = $moduleList[3]->scm();
  isa_ok($scm, 'ksb::Updater::Git');
  
  my ($branch, $type) = $scm->_determinePreferredCheckoutSource();


More information about the kde-doc-english mailing list