Ignore:
Timestamp:
02/18/14 08:36:13 (5 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2
Children:
480db50
Parents:
b0eb497
Message:

Update EasyPBI to 2.3:
Changes Include:
Add ability to build from ports directly again.
Add legacy port-build options to the GUI.
Add item to show current package compile-time options.
Add ability to create a new module from either ports/packages.
Fix a bug in the default wrapper script for 10.x PBI's (container path is /usr/local/ now when running)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/EasyPBI/mainGUI.cpp

    r23d2792 r0c42827  
    4747          ui->tool_repoCat->setMenu(&menu_validRepoCats); 
    4848          connect(&menu_validRepoCats, SIGNAL(triggered(QAction*)), this, SLOT(slotSetRepoCat(QAction*)) ); 
     49        ui->tool_config_setmkopt->setIcon(Backend::icon("left")); 
     50          ui->tool_config_setmkopt->setMenu(&menu_portopts); 
     51          connect(&menu_portopts, SIGNAL(triggered(QAction*)), this, SLOT(slotSetPortOpt(QAction*)) ); 
    4952        // -- resources tab -- 
    5053        ui->push_resources_savewrapper->setIcon(Backend::icon("save")); 
     
    112115      connect(ui->check_config_nopkg, SIGNAL(clicked()),this,SLOT(slotOptionChanged()) ); 
    113116      connect(ui->check_config_notmpfs, SIGNAL(clicked()),this,SLOT(slotOptionChanged()) ); 
     117      connect(ui->text_config_makeopts, SIGNAL(textChanged()), this, SLOT(slotOptionChanged()) ); 
    114118      connect(ui->group_config_overrides, SIGNAL(clicked()), this, SLOT(updateConfigVisibility()) ); 
    115119      connect(ui->group_config_repo, SIGNAL(clicked()), this, SLOT(updateConfigVisibility()) ); 
    116120      connect(ui->group_config_repomgmt, SIGNAL(clicked()), this, SLOT(updateConfigVisibility()) ); 
     121      connect(ui->group_config_ports, SIGNAL(clicked()), this, SLOT(updateConfigVisibility()) ); 
    117122      // Resources tab 
    118123      connect(ui->text_resources_script,SIGNAL(textChanged()),this,SLOT(slotResourceScriptChanged()) ); 
     
    194199  ui->frame_repoInfo->setVisible(ui->group_config_repo->isChecked()); 
    195200  ui->frame_repoMgmt->setVisible(ui->group_config_repomgmt->isChecked()); 
     201  ui->frame_ports->setVisible(ui->group_config_ports->isChecked()); 
    196202} 
    197203 
     
    238244    ui->list_portafter->clear(); 
    239245    ui->list_portafter->addItems( MODULE.text("PBI_MKPORTAFTER").split("\n") ); 
     246    ui->list_config_mkportbefore->clear(); 
     247    ui->list_config_mkportbefore->addItems(MODULE.text("PBI_MKPORTBEFORE").split("\n") ); 
    240248    // -- Integer Values 
    241249    ui->spin_repoBuildKey->setValue( MODULE.number("PBI_BUILDKEY") ); 
    242250    ui->spin_repoPriority->setValue( MODULE.number("PBI_AB_PRIORITY") ); 
    243251    ui->spin_repoRevision->setValue( MODULE.number("PBI_PROGREVISION") ); 
     252    // -- Text Boxes 
     253    ui->text_config_makeopts->clear(); 
     254    ui->text_config_makeopts->setPlainText(MODULE.text("PBI_MAKEOPTS")); 
    244255    // -- Combo Boxes (Select the proper item only) 
    245256    QStringList icons = MODULE.existingResources().filter(".png"); 
     
    266277      else{ menu_validRepoCats.addAction(tmp[i]); } 
    267278    } 
     279    //Now update the available port build options; 
     280    menu_portopts.clear(); 
     281    QStringList opts = Backend::getPortOpts(settings->value("portsdir")+"/"+MODULE.text("PBI_MAKEPORT")); 
     282    for(int i=0; i<opts.length(); i++){ 
     283      QAction *act = new QAction(this); 
     284        if(opts[i].section(":::",1,1)=="off"){ act->setText( QString(tr("Enable %1")).arg(opts[i].section(":::",0,0)) ); } 
     285        else{ act->setText( QString(tr("Disable %1")).arg(opts[i].section(":::",0,0)) ); } 
     286        act->setToolTip(opts[i].section(":::",2,2)); 
     287        act->setWhatsThis(opts[i].section(":::",0,1).replace(":::","=")); 
     288      menu_portopts.addAction(act); 
     289    } 
     290    ui->tool_config_setmkopt->setEnabled(!menu_portopts.isEmpty()); 
    268291    //Now disable the save button 
    269292    ui->push_config_save->setEnabled(FALSE);  //disable the save button until something changes 
     
    281304      ui->line_config_license->setPlaceholderText(""); 
    282305    } 
     306    pkgInfo = Backend::getPkgOpts(MODULE.text("PBI_MAKEPORT")); 
     307    qDebug() << "pkg opts:" << pkgInfo; 
     308    ui->combo_config_pkgopts->clear(); 
     309    if(!pkgInfo.isEmpty()){ ui->combo_config_pkgopts->addItems(pkgInfo); } 
    283310  } 
    284311  // -----RESOURCES-------- 
     
    372399  //------OVERALL SETTINGS------ 
    373400  if( doall || doeditor ){ 
    374     //Enable/disable the buttons that require the FreeBSD ports tree 
    375     if( settings->check("isportsavailable") ){ 
    376       ui->push_change_makeport->setEnabled(TRUE); 
    377       //ui->push_addportbefore->setEnabled(TRUE); 
    378       ui->push_addportafter->setEnabled(TRUE); 
    379     }else{ 
    380       ui->push_change_makeport->setEnabled(FALSE); 
    381       //ui->push_addportbefore->setEnabled(FALSE); 
    382       ui->push_addportafter->setEnabled(FALSE); 
    383     } 
    384401    //Check for a 64-bit system to enable the 32-bit build option 
    385402    //if( settings->check("is64bit") ){ ui->check_build_32->setVisible(TRUE); } 
     
    390407  } 
    391408} 
     409 
     410QString MainGUI::getPortPackage(){ 
     411  QString portSel; 
     412  if( settings->check("isportsavailable") && ui->check_config_nopkg->isChecked()){ 
     413    //Prompt for a new port 
     414    portSel = QFileDialog::getExistingDirectory(this, tr("Select Port"), settings->value("portsdir"));   
     415  }else{ 
     416    //Prompt for a package 
     417    pkgSelect dlg(this); 
     418    dlg.exec(); 
     419    if(dlg.selected){ portSel = dlg.portSelected; }; 
     420  } 
     421  return portSel; 
     422} 
     423 
    392424/*---------------------------------- 
    393425   MENU OPTIONS 
     
    462494  qDebug() << "New Module triggered"; 
    463495  //Create and run the new dialog 
    464   NewModuleDialog* dlg = new NewModuleDialog(this); 
     496  QString pDir = ""; 
     497  if(settings->check("isportsavailable")){ pDir = settings->value("portsdir"); } 
     498  NewModuleDialog* dlg = new NewModuleDialog(this, pDir); 
    465499  dlg->setDefaultIconFile(settings->value("defaulticon")); 
    466500  dlg->exec(); 
     
    477511    }else{ 
    478512      line_module->setText( MODULE.basepath().replace(QDir::homePath(), "~") ); 
     513      if(dlg->isPort){ 
     514        //A couple additional conveniances for port builds 
     515        MODULE.setEnabled("PBI_AB_NOPKGBUILD",true); 
     516        MODULE.saveConfig(); 
     517        ui->group_config_ports->setChecked(true); 
     518      } 
    479519    } 
    480520  } 
     
    533573*/ 
    534574void MainGUI::on_push_change_makeport_clicked(){ 
    535   pkgSelect dlg(this); 
    536   dlg.exec(); 
    537   if(!dlg.selected){ return; } 
    538   QString portSel = dlg.portSelected;      
     575  QString portSel = getPortPackage();      
    539576  if(portSel.isEmpty()){return;}         
    540577 
     
    544581} 
    545582 
    546 void MainGUI::on_push_addportafter_clicked(){ 
    547   if( !settings->check("isportsavailable") ){ 
    548     //No ports tree available 
    549     QMessageBox::warning(this,tr("EasyPBI: No FreeBSD Ports"), tr("The FreeBSD Ports tree could not be found on your system. You may fetch the ports tree through the EasyPBI menu or manually set the path to the port tree in the EasyPBI preferences if it is installed in a non-standard location.")); 
    550   } 
     583void MainGUI::on_tool_addportafter_clicked(){ 
    551584  //Prompt for a new port 
    552   QString portSel = QFileDialog::getExistingDirectory(this, tr("Select Port"), settings->value("portsdir")); 
     585  QString portSel = getPortPackage(); 
    553586  if(portSel.isEmpty()){return;} //action cancelled or closed    
    554587  //Save the port info to the GUI 
     
    558591} 
    559592 
    560 void MainGUI::on_push_rmportafter_clicked(){ 
     593void MainGUI::on_tool_rmportafter_clicked(){ 
    561594  int index = ui->list_portafter->currentIndex(); 
    562595  if(index != -1){ 
    563596    ui->list_portafter->removeItem(index); 
     597  } 
     598  ui->push_config_save->setEnabled(TRUE); 
     599} 
     600 
     601void MainGUI::on_tool_config_addportbefore_clicked(){ 
     602  QString portSel = getPortPackage(); 
     603  if(portSel.isEmpty()){return;} //action cancelled or closed    
     604  //Save the port info to the GUI 
     605  if(ui->list_config_mkportbefore->count() == 1 && ui->list_config_mkportbefore->currentText().isEmpty() ){ ui->list_config_mkportbefore->clear(); } 
     606  ui->list_config_mkportbefore->addItem(portSel.remove(settings->value("portsdir")+"/")); 
     607  ui->push_config_save->setEnabled(TRUE); 
     608} 
     609 
     610void MainGUI::on_tool_config_rmportbefore_clicked(){ 
     611  int index = ui->list_config_mkportbefore->currentIndex(); 
     612  if(index != -1){ 
     613    ui->list_config_mkportbefore->removeItem(index); 
    564614  } 
    565615  ui->push_config_save->setEnabled(TRUE); 
     
    587637  for(int i=0; i<ui->list_portafter->count(); i++){ addports << ui->list_portafter->itemText(i); } 
    588638  MODULE.setText("PBI_MKPORTAFTER", addports.join("\n") ); 
     639  addports.clear(); 
     640  for(int i=0; i<ui->list_config_mkportbefore->count(); i++){ addports << ui->list_config_mkportbefore->itemText(i); } 
     641  MODULE.setText("PBI_MKPORTBEFORE", addports.join("\n") ); 
    589642  MODULE.setText("PBI_PROGICON", ui->list_progicon->currentText() ); 
    590643  //Number values 
     
    592645  MODULE.setNumber("PBI_AB_PRIORITY", ui->spin_repoPriority->value() ); 
    593646  MODULE.setNumber("PBI_PROGREVISION", ui->spin_repoRevision->value() ); 
     647  //Text Values 
     648  MODULE.setText("PBI_MAKEOPTS", ui->text_config_makeopts->toPlainText()); 
    594649   
    595650  //save the new settings to pbi.conf 
     
    618673} 
    619674 
     675void MainGUI::slotSetPortOpt(QAction* act){ 
     676  QString opt = act->whatsThis(); 
     677  QStringList cOpts = ui->text_config_makeopts->toPlainText().split("\n"); 
     678  QString header; 
     679  if(opt.endsWith("=off")){ 
     680    //This needs to be enabled 
     681    header = MODULE.text("PBI_MAKEPORT").section("/",-1) + "_SET="; 
     682  }else{ 
     683    //This needs to be disabled 
     684    header = MODULE.text("PBI_MAKEPORT").section("/",-1) + "_UNSET="; 
     685  } 
     686  bool added = false; 
     687  for(int i=0; i<cOpts.length(); i++){ 
     688    if(cOpts[i].startsWith(header)){  
     689      if( !cOpts[i].contains(opt.section("=",0,0)) ){ 
     690        //Not already set, so set it 
     691        cOpts[i].append(" "+opt.section("=",0,0));  
     692      } 
     693      added=true;  
     694      break; 
     695    } 
     696  } 
     697  if(!added){ cOpts << header+opt.section("=",0,0); } 
     698  ui->text_config_makeopts->clear(); 
     699  cOpts.removeAll(""); //Remove empty lines 
     700  ui->text_config_makeopts->setPlainText( cOpts.join("\n") ); 
     701} 
    620702/*------------------------------------------------ 
    621703   RESOURCE EDITOR OPTIONS 
     
    12601342  QString sigFile; 
    12611343  if( settings->check("usesignature") && QFile::exists(settings->value("sigfile")) ){ sigFile = settings->value("sigfile"); } 
    1262   QString cmd = ModuleUtils::generatePbiBuildCmd(MODULE.basepath(), outdir, sigFile); 
     1344  QString cmd = ModuleUtils::generatePbiBuildCmd(MODULE.basepath(), outdir, sigFile, !MODULE.isEnabled("PBI_AB_NOPKGBUILD") ); 
    12631345  //Display the command created in hte terminal 
    12641346  qDebug() << "Build PBI command created:"<<cmd; 
Note: See TracChangeset for help on using the changeset viewer.