Ignore:
Timestamp:
01/08/14 07:40:47 (8 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
a469e71
Parents:
8a4c7a0
Message:

Finish cleaning up the new system manager ports/source checkout functionality.
Also create a backend class that just contains a bunch of static functions for simple usage elsewhere (like generating ports update commands). This will make it easy to update the utility later if URL's or other system calls change (since we don't need to worry about all the GUI-specific stuff getting mixed in).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-sysmanager/cmdDialog.cpp

    r8a4c7a0 re9a3917  
    2727  if(cmdtype.toLower() == "ports"){ 
    2828    this->setWindowTitle(tr("Getting PC-BSD Ports Tree")); 
    29     //Check for if the port tree needs to be initialized first 
    30     qDebug() << "WARNING: Ports init check still needs to be implemented"; 
    31     bool init = true; 
    32     //Now create the commands necessary 
    33     if(init){ 
    34       ui->textEdit->setPlainText("Starting Ports Tree Initialization...."); 
    35       if(QFile::exists("/usr/ports")){ 
    36         cmds << "rm -rf /usr/ports/* /usr/ports/.g*"; info << "Removing the old ports tree"; dirs << ""; //Clean the old ports tree 
    37       }else{ 
    38         cmds << "mkdir /usr/ports"; info << "Creating the ports tree"; dirs << ""; //Create the ports tree 
    39       } 
    40       cmds << "git init"; info << "Initialize GIT"; dirs << "/usr/ports"; //setup git 
    41       cmds << "git remote remove origin"; info << ""; dirs <<"/usr/ports"; 
    42       cmds << "git remote add origin https://www.github.com/pcbsd/freebsd-ports.git"; info << ""; dirs << "/usr/ports/.git"; //setup PC-BSD git repo 
    43     }else{ 
    44       ui->textEdit->setPlainText("Updating the Ports Tree...."); 
    45     } 
    46     //Now create the git update commands 
    47     cmds << "git fetch --depth=1"; info << "Fetch new GIT info (this may take a while)"; dirs << "/usr/ports/.git"; 
    48     cmds << "git checkout master"; info << "Checkout the tree"; dirs << "/usr/ports";  
    49  
     29    Backend::generatePortsUpdateCMDS(cmds, dirs, info); 
     30           
    5031  }else if(cmdtype.toLower() == "source"){ 
    5132    this->setWindowTitle(tr("Getting PC-BSD Sources")); 
    52     //Check for if the source tree needs to be initialized first 
    53     qDebug() << "WARNING: Source init check still needs to be implemented"; 
    54     bool init = true; 
    55     //Now create the commands necessary 
    56     if(init){ 
    57       ui->textEdit->setPlainText("Starting Source Tree Initialization...."); 
    58       if(QFile::exists("/usr/src")){ 
    59         cmds << "rm -rf /usr/src/* /usr/src/.g*"; info << "Removing the old source tree"; dirs << ""; //Clean the old source tree 
    60       }else{ 
    61         cmds << "mkdir /usr/src"; info << "Creating the source tree"; dirs << ""; //Create the source tree 
    62       } 
    63       cmds << "git init"; info << "Initialize GIT"; dirs << "/usr/src"; //setup git 
    64       cmds << "git remote remove origin"; info << ""; dirs <<"/usr/src"; 
    65       cmds << "git remote add origin https://www.github.com/pcbsd/freebsd.git"; info << ""; dirs << "/usr/src/.git"; //setup PC-BSD git repo 
    66     }else{ 
    67       ui->textEdit->setPlainText("Updating the Source Tree...."); 
    68     } 
    69     //Now create the git update commands 
    70     cmds << "git fetch --depth=1"; info << "Fetch new GIT info (this may take a while)"; dirs << "/usr/src/.git"; 
    71     cmds << "git checkout "+branch; info << "Checkout the right version of the tree"; dirs << "/usr/src";  
     33    Backend::generateSourceUpdateCMDS(branch, cmds, dirs, info); 
     34           
    7235  }else{ 
    7336    ui->textEdit->setPlainText("Unknown CMD Type: "+cmdtype); 
Note: See TracChangeset for help on using the changeset viewer.