Menu

#157 fink needs to check for dev-tools and if absent run 'xcode-select --install' for user

open
None
5
2015-02-02
2015-02-01
No

To eliminate the many reports of users trying to build with fink in the absence of the command line tools, a change similar to...

--- Engine.pm.orig 2015-02-01 15:01:03.000000000 -0500
+++ Engine.pm 2015-02-01 15:12:36.000000000 -0500
@@ -178,6 +178,13 @@
return;
}

  • check for Command Line Tools via dev-tools virtual package

  • if (not Fink::VirtPackage->query_package("dev-tools")) {
  • print "Command Line Tools are not installed!";
  • system('xcode-select --install');
  • exit(0);
  • }
    +
    # Pop up help text when arbitrary verbs are used.
    exit &execute("fink --help", quiet=>1) if (not exists $commands{$cmd});

should be added to fink. After reinstalling OS X 10.10.2 to purge /usr/include, this change results in the desired behavior of...

% fink rebuild cmake
Command Line Tools are not installed!xcode-select: note: install requested for command line developer tools
%

with the dialog that offers to install the Command Line Tools appearing for the user.

Discussion

  • Jack Howarth

    Jack Howarth - 2015-02-01
    --- Engine.pm.orig  2015-02-01 15:01:03.000000000 -0500
    +++ Engine.pm   2015-02-01 15:12:36.000000000 -0500
    @@ -178,6 +178,13 @@
            return;
        }
    
    +   # check for Command Line Tools via dev-tools virtual package
    +   if (not Fink::VirtPackage->query_package("dev-tools")) {
    +       print "Command Line Tools are not installed!";
    +       system('xcode-select --install');
    +       exit(0);
    +   }
    +
        # Pop up help text when arbitrary verbs are used.
        exit &execute("fink --help", quiet=>1) if (not exists $commands{$cmd});
    
     
  • Jack Howarth

    Jack Howarth - 2015-02-02
    -- Engine.pm.orig   2015-02-01 15:01:03.000000000 -0500
    +++ Engine.pm   2015-02-01 19:11:13.000000000 -0500
    @@ -173,11 +173,39 @@
        my $start = time;
        my ($proc, $pkgflag, $rootflag, $aptgetflag);
    
    +   my $osversion = &Fink::Services::get_osx_vers();
    +
        unless (defined $cmd) {
            print "NOP\n";
            return;
        }
    
    +   # check for Xcode.app via xcode.app virtual package
    +   if (not Fink::VirtPackage->query_package("dev-tools")) {
    +       print "Xcode.app not found!\n";
    +       if ($osversion eq "10.7") {
    +           print "Download Xcode 4.6 from developer.apple.com.\n";
    +       } elsif ($osversion eq "10.8") {
    +           print "Download Xcode 5.1.1 from developer.apple.com.\n";
    +       } elsif ($osversion eq "10.9" or $osversion eq "10.10") {
    +       print "Install current Xcode.app from the App Store.\n";
    +       }
    +       exit(0);
    +   }
    +
    +   # check for Command Line Tools via dev-tools virtual package
    +   if (not Fink::VirtPackage->query_package("dev-tools")) {
    +       print "Command Line Tools are not installed!\n";
    +       if ($osversion eq "10.7") {
    +           print "Install them from the Components panel in Xcode 4.6.\n";
    +       } elsif ($osversion eq "10.8") {
    +           print "Install them from the Components panel in Xcode 5.1.1.\n";
    +       } elsif ($osversion eq "10.9" or $osversion eq "10.10") {   
    +           print "Execute 'sudo xcode-select --install' to obtain them.\n";
    +       }
    +       exit(0);
    +   }
    +
        # Pop up help text when arbitrary verbs are used.
        exit &execute("fink --help", quiet=>1) if (not exists $commands{$cmd});
    
    @@ -240,7 +268,6 @@
            # Check if the Distribution encoded in fink.conf matches the current OS version
            # or if there is a permitted upgrade path.
            my $distribution = $Fink::Config::distribution;
    -       my $osversion = &Fink::Services::get_osx_vers();
            # return immediately if distribution and OS match
            unless ($osversion eq $distribution) {
                my $valid_upgrade = 0; #default
    

    This works for the CLI but for the current xcode.app virtual package test doesn't detect if /Application/Xcode.app has been renamed or removed.

     
  • Jack Howarth

    Jack Howarth - 2015-02-02

    I think this check would be a great place to provide guidance to the end-users as to which Xcode to download from developer.apple.com for 10.7 and 10.8. Of course 10.9, will eventually join these OS versions in listing an explicit Xcode release to download from developer.apple.com once 11.11 appears drops 10.9 support from Xcode.

     
  • Jack Howarth

    Jack Howarth - 2015-02-02

    Final copy with fix for Xcode.app check to use...

    if (not Fink::VirtPackage->query_package("xcode.app")) {

     
  • Jack Howarth

    Jack Howarth - 2015-02-02

    Confirmed on 10.10 now that when Xcode.app is renamed the changes produce the desired output of...

    Xcode.app not found!
    Install current Xcode.app from the App Store.

     
  • Alexander Hansen

    Why is this not exiting the same way that ever other nearby block of code is, with die() or warn()? I'd rather that we try to be consistent.

    And what's the point of the Xcode.app check? We don't require Xcode.app, except for specific packages that need SDKs from it or xcodebuild.

     
    • Daniel Macks

      Daniel Macks - 2015-02-02

      And for that last detail, those packages already (should) assert a BuildDepends on xcode.app or the sdk or whatever.

       
  • Daniel Macks

    Daniel Macks - 2015-02-02

    If I understand the code correctly, you are proposing that fink be unusable unless both xcode and xcode.app are present. That's a hopelessly broken approach regardless of implementation. Why do we need xcode in order to run 'fink help' or 'fink list'? We have bindist. We have ability to install locally available .deb.

     
    • Alexander Hansen

      This test is in a block of code which gets run only when a package could potentially be installed--it's only triggered for appropriate verbs.

       
  • Jack Howarth

    Jack Howarth - 2015-02-02

    Okay. I'ved dropped the Xcode check and changed the exiting code to using die statements.

     
  • Jack Howarth

    Jack Howarth - 2015-02-02

    Reduced patch that emits simple error message...

    Command Line Tools are not installed!
    For 10.8 or earlier, install from the Components panel in Xcode.
    For 10.9 or later, install by executing 'sudo xcode-select --install'.

     

Log in to post a comment.