From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- parts/distpart/Makefile.am | 16 + parts/distpart/README | 3 + parts/distpart/README.dox | 24 + parts/distpart/distpart_part.cpp | 84 +++ parts/distpart/distpart_part.h | 55 ++ parts/distpart/distpart_ui.ui | 1243 +++++++++++++++++++++++++++++++++++ parts/distpart/distpart_widget.cpp | 605 +++++++++++++++++ parts/distpart/distpart_widget.h | 210 ++++++ parts/distpart/kdevdistpart.desktop | 70 ++ parts/distpart/kdevpart_distpart.rc | 8 + parts/distpart/lsmsupport.cpp | 32 + parts/distpart/lsmsupport.h | 35 + parts/distpart/packagebase.cpp | 117 ++++ parts/distpart/packagebase.h | 84 +++ parts/distpart/specsupport.cpp | 315 +++++++++ parts/distpart/specsupport.h | 54 ++ 16 files changed, 2955 insertions(+) create mode 100644 parts/distpart/Makefile.am create mode 100644 parts/distpart/README create mode 100644 parts/distpart/README.dox create mode 100644 parts/distpart/distpart_part.cpp create mode 100644 parts/distpart/distpart_part.h create mode 100644 parts/distpart/distpart_ui.ui create mode 100644 parts/distpart/distpart_widget.cpp create mode 100644 parts/distpart/distpart_widget.h create mode 100644 parts/distpart/kdevdistpart.desktop create mode 100644 parts/distpart/kdevpart_distpart.rc create mode 100644 parts/distpart/lsmsupport.cpp create mode 100644 parts/distpart/lsmsupport.h create mode 100644 parts/distpart/packagebase.cpp create mode 100644 parts/distpart/packagebase.h create mode 100644 parts/distpart/specsupport.cpp create mode 100644 parts/distpart/specsupport.h (limited to 'parts/distpart') diff --git a/parts/distpart/Makefile.am b/parts/distpart/Makefile.am new file mode 100644 index 00000000..0a1d949f --- /dev/null +++ b/parts/distpart/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdevdistpart.la +libkdevdistpart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevdistpart_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdevdistpart_la_SOURCES = distpart_ui.ui distpart_part.cpp distpart_widget.cpp packagebase.cpp lsmsupport.cpp specsupport.cpp + +METASOURCES = AUTO +KDEICON = AUTO +servicedir = $(kde_servicesdir) +service_DATA = kdevdistpart.desktop + +rc_DATA = kdevpart_distpart.rc +rcdir = $(kde_datadir)/kdevdistpart diff --git a/parts/distpart/README b/parts/distpart/README new file mode 100644 index 00000000..731741e1 --- /dev/null +++ b/parts/distpart/README @@ -0,0 +1,3 @@ +Please read the on-line, automaticaly updated KDevelop API documentation at: +http://www.kdevelop.org +or read the README.dox file. diff --git a/parts/distpart/README.dox b/parts/distpart/README.dox new file mode 100644 index 00000000..994b4f84 --- /dev/null +++ b/parts/distpart/README.dox @@ -0,0 +1,24 @@ +/** \class DistpartPart +This part aims to provide some help to the developpers for packaging +and publishing their projects by ftp protocol. + +Only RPM package format is supported for now. More to come. +If you want to develop a new package support, please have a look at +specsupport.h and specsupport.cpp. Help is always welcome :-) + +\authors Ian Reinart Geiser + +\maintainer Yann Hodique + +\feature provide some help to the developpers for packaging and publishing their projects by ftp protocol +\feature support RPM package format + +\bug Development package, documentation package, application icon and local +options (in publishing tab) are currently ignored. + +\bug The creation of the source archive is just a +call to "dist" or "dist-bzip2" target of the Makefile. If those +targets don't exist, nothing is done to solve the problem (for +example when the project is QMake-based) + +*/ diff --git a/parts/distpart/distpart_part.cpp b/parts/distpart/distpart_part.cpp new file mode 100644 index 00000000..b719533d --- /dev/null +++ b/parts/distpart/distpart_part.cpp @@ -0,0 +1,84 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "distpart_part.h" + +#include + +#include +#include +#include +#include + +#include "kdevcore.h" +#include + +#include "distpart_widget.h" + +#include + +typedef KDevGenericFactory DistpartFactory; +static const KDevPluginInfo data("kdevdistpart"); +K_EXPORT_COMPONENT_FACTORY( libkdevdistpart, DistpartFactory( data ) ) + +DistpartPart::DistpartPart(QObject *parent, const char *name, const QStringList &) + : KDevPlugin(&data, parent, name ? name : "DistpartPart") { + + kdDebug(9007) << "DistpartPart::DistpartPart()" << endl; + setInstance(DistpartFactory::instance()); + + setXMLFile("kdevpart_distpart.rc"); + + m_action = new KAction( i18n("Distribution && Publishing"), "package", 0, + this, SLOT(show()), + actionCollection(), "make_dist" ); + + m_action->setToolTip(i18n("Make source and binary distribution")); + m_action->setWhatsThis(i18n("Project distribution & publishing

Helps users package and publish their software.")); + //QWhatsThis::add(m_widget, i18n("This will help users package and publish their software.")); + + m_dlg = new KDialogBase( 0 , "dist_part", false, i18n("Distribution & Publishing"), KDialogBase::Ok|KDialogBase::Cancel); + + m_dialog = new DistpartDialog(this, m_dlg ); + m_dlg->setMainWidget(m_dialog); + + connect( m_dlg, SIGNAL(okClicked()), m_dialog, SLOT(slotokayPushButtonPressed())); + connect( m_dlg, SIGNAL(cancelClicked()), m_dialog, SLOT(slotcancelPushButtonPressed())); + // Package types + //RpmPackage = new SpecSupport(this); + //LsmPackage = new LsmSupport(this); +} + + +DistpartPart::~DistpartPart() { + kdDebug(9007) << "DistpartPart::~DistpartPart()" << endl; + delete m_dialog; + //delete RpmPackage; + //delete LsmPackage; +} + +void DistpartPart::show() { + m_dlg->exec(); +} + +void DistpartPart::hide() { + m_dlg->cancel(); +} + +#include "distpart_part.moc" diff --git a/parts/distpart/distpart_part.h b/parts/distpart/distpart_part.h new file mode 100644 index 00000000..c8caa0a3 --- /dev/null +++ b/parts/distpart/distpart_part.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + +#ifndef __KDEVPART_DISTPART_H__ +#define __KDEVPART_DISTPART_H__ + + +#include +#include +#include + +#include "packagebase.h" + +class DistpartDialog; +class KDialogBase; + +class DistpartPart : public KDevPlugin { + Q_OBJECT + +public: + + DistpartPart(QObject *parent, const char *name, const QStringList &); + ~DistpartPart(); + +public slots: + void show(); + void hide(); + +private: + packageBase *RpmPackage, *LsmPackage; + QGuardedPtr m_dialog; + KAction *m_action; + QGuardedPtr m_dlg; +}; + + +#endif diff --git a/parts/distpart/distpart_ui.ui b/parts/distpart/distpart_ui.ui new file mode 100644 index 00000000..a987c009 --- /dev/null +++ b/parts/distpart/distpart_ui.ui @@ -0,0 +1,1243 @@ + +distpart_ui +Ian Reinhart Geiser <geiseri@yahoo.com> + + + packaging_dialog + + + + 0 + 0 + 606 + 649 + + + + + 5 + 5 + 0 + 0 + + + + + 0 + 0 + + + + + 32767 + 32767 + + + + Prepare for Release + + + + unnamed + + + 0 + + + 0 + + + + Layout30 + + + + unnamed + + + 0 + + + + titleLabel + + + + 7 + 5 + 0 + 0 + + + + + 250 + 0 + + + + <H2>Project Packaging & Publishing</H2> + + + + + KDevelopGraphic + + + + 5 + 5 + 0 + 0 + + + + + 48 + 48 + + + + + 48 + 48 + + + + "kdevelop" + + + true + + + + + + + actions_box + + + + 5 + 3 + 0 + 0 + + + + Top + + + + tab + + + Source &Distribution + + + + unnamed + + + + srcDistFileListBox + + + + + customProjectCheckBox + + + &Use custom options + + + Default is: %n-%v.tar.gz + + + + + Layout19 + + + + unnamed + + + 0 + + + + sourceOptionsGroupBox + + + Source Options + + + + unnamed + + + + bzipCheckBox + + + Use &bzip2 instead of gzip + + + + + Layout34 + + + + unnamed + + + 0 + + + + archiveNameLabel + + + <b>Archive name format: </b><br> %n - File name <br> %v - File version <br> %d - Date of archive + + + archNameFormatLineEdit + + + + + archNameFormatLineEdit + + + %n-%v + + + Enter the filename using the format options. + + + + + + + + + Spacer37 + + + Vertical + + + Expanding + + + + 0 + 20 + + + + + + addFile + + + + 1 + 5 + 0 + 0 + + + + &Add Files + + + + + createSrcArchPushButton + + + + 1 + 5 + 0 + 0 + + + + &Create Source Archive + + + + + resetSrcPushButton + + + + 1 + 5 + 0 + 0 + + + + R&eset + + + + + + + fileListLabel + + + File &list: + + + srcDistFileListBox + + + + + + + tab + + + Package &Information + + + + unnamed + + + + layout12 + + + + unnamed + + + + layout11 + + + + unnamed + + + + licenseLineEdit + + + + 7 + 0 + 2 + 0 + + + + + + vendorLabel + + + Ve&ndor: + + + vendorLineEdit + + + + + releaseLineEdit + + + + 7 + 0 + 2 + 0 + + + + + + appNameLineEdit + + + + 7 + 0 + 2 + 0 + + + + Application name + + + + + vendorLineEdit + + + + 7 + 0 + 2 + 0 + + + + + + appNameLabel + + + &Application name: + + + appNameLineEdit + + + + + summaryLabel + + + S&ummary: + + + summaryLineEdit + + + + + licenseLabel + + + &License: + + + licenseLineEdit + + + + + releaseLabel + + + R&elease: + + + releaseLineEdit + + + + + versionLabel + + + &Version: + + + versionLineEdit + + + + + summaryLineEdit + + + + 7 + 0 + 2 + 0 + + + + + + packagerLineEdit + + + + 7 + 0 + 2 + 0 + + + + + + versionLineEdit + + + + 7 + 0 + 2 + 0 + + + + Version of the file package. +Menu item: Project/Project Options/General/Version +changes project compiled version number + + + + + groupLabel + + + &Group: + + + groupLineEdit + + + + + packagerLabel + + + Pac&kager: + + + packagerLineEdit + + + + + groupLineEdit + + + + 7 + 0 + 2 + 0 + + + + + + + + advancedOptionsGroupBox + + + Advanced Package Op&tions + + + + unnamed + + + + devPackageCheckBox + + + &Create development package + + + + + docsPackageCheckBox + + + Create documentation package + + + + + appIconCheckBox + + + Include application icon + + + + + archLabel + + + Architecture target:<BR><b>(Note: You must have a compiler that supports this target)</b> + + + + + + i386 + + + + + i586 + + + + + i686 + + + + + AMD K6 + + + + + AMD K7 + + + + + PPC + + + + + PPC G3 + + + + + PPC Altevec + + + + + Dec Alpha (AXP) + + + + + Sparc + + + + archComboBox + + + 0 + + + true + + + 10 + + + true + + + + + + + + + layout13 + + + + unnamed + + + + layout8 + + + + unnamed + + + + srcPackagePushButton + + + &Build Source +Package + + + + + buildAllPushButton + + + Build Binar&y +Package + + + + + exportSPECPushButton + + + E&xport +Build Files + + + + + importSPECPushButton + + + I&mport +Build Files + + + + + + + + + layout16 + + + + unnamed + + + + layout14 + + + + unnamed + + + + projectDescriptionLabel + + + + 5 + 5 + 0 + 0 + + + + &Description: + + + projectDescriptionMultilineEdit + + + + + projectDescriptionMultilineEdit + + + + 7 + 3 + 0 + 0 + + + + Manual + + + + + + + layout15 + + + + unnamed + + + + TextLabel1 + + + + 5 + 5 + 0 + 0 + + + + C&hangelog: + + + projectChangelogMultilineEdit + + + + + projectChangelogMultilineEdit + + + + 7 + 3 + 0 + 0 + + + + + + + + + + + + tab + + + Pr&oject Publishing + + + + unnamed + + + + localOptionsGroupBox + + + + 5 + 5 + 0 + 0 + + + + Local Options + + + + unnamed + + + + Layout15 + + + + unnamed + + + 0 + + + + genHTMLCheckBox + + + Ge&nerate HTML information page + + + + + useRPMInfoCheckBox + + + &User information generated by RPM + + + + + Spacer7 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + + + Spacer8 + + + Horizontal + + + Expanding + + + + 20 + 0 + + + + + + Layout21 + + + + unnamed + + + 0 + + + + genHTMLPushButton + + + &Generate + + + + + resetHTMLPushButton + + + R&eset + + + + + + + + + remoteOptionsGroupBox + + + + 5 + 5 + 0 + 0 + + + + Re&mote Options + + + + unnamed + + + + uploadFileListBox + + + + 1 + 7 + 0 + 0 + + + + + 250 + 0 + + + + + + Layout23 + + + + unnamed + + + 0 + + + + fileSubmissionLabel + + + File su&bmission list: + + + uploadFileListBox + + + + + Spacer24 + + + Horizontal + + + Minimum + + + + 20 + 20 + + + + + + uploadAddFileToolButton + + + + 5 + 1 + 0 + 0 + + + + + + + + + + uploadRemoveToolButton + + + + 5 + 1 + 0 + 0 + + + + - + + + + + + + Layout25 + + + + unnamed + + + 0 + + + + uploadCustomCheckBox + + + Upload to &custom FTP site + + + + + uploadftpkdeorgCheckBox + + + Upload files to ftp.&kde.org + + + + + Spacer6 + + + Vertical + + + Expanding + + + + 0 + 20 + + + + + + uploadSubmitPushButton + + + Sub&mit + + + + + uploadURLLineEdit + + + ftp://username:password@ftp.server.com/path/ + + + + + uploadResetPushButton + + + Reset + + + + + uploadAppsKDEcomCheckBox + + + Upload to &apps.kde.com + + + + + + + + + + + + + + buildAllPushButton + clicked() + packaging_dialog + slotbuildAllPushButtonPressed() + + + exportSPECPushButton + clicked() + packaging_dialog + slotexportSPECPushButtonPressed() + + + srcPackagePushButton + clicked() + packaging_dialog + slotsrcPackagePushButtonPressed() + + + importSPECPushButton + clicked() + packaging_dialog + slotimportSPECPushButtonPressed() + + + addFile + clicked() + packaging_dialog + slotAddFileButtonPressed() + + + srcDistFileListBox + clicked(QListBoxItem*) + packaging_dialog + slotRemoveFile(QListBoxItem*) + + + + actions_box + customProjectCheckBox + bzipCheckBox + archNameFormatLineEdit + createSrcArchPushButton + resetSrcPushButton + srcDistFileListBox + appNameLineEdit + versionLineEdit + releaseLineEdit + vendorLineEdit + licenseLineEdit + summaryLineEdit + groupLineEdit + packagerLineEdit + projectDescriptionMultilineEdit + projectChangelogMultilineEdit + devPackageCheckBox + docsPackageCheckBox + appIconCheckBox + archComboBox + genHTMLCheckBox + useRPMInfoCheckBox + genHTMLPushButton + resetHTMLPushButton + uploadftpkdeorgCheckBox + uploadAppsKDEcomCheckBox + uploadCustomCheckBox + uploadURLLineEdit + uploadSubmitPushButton + uploadResetPushButton + uploadAddFileToolButton + uploadRemoveToolButton + uploadFileListBox + + + kdialog.h + kiconloader.h + kpushbutton.h + klistbox.h + klineedit.h + ktextedit.h + + + slotbuildAllPushButtonPressed() + slotexportSPECPushButtonPressed() + slotimportSPECPushButtonPressed() + slotsrcPackagePushButtonPressed() + slotAddFileButtonPressed() + slotRemoveFile(QListBoxItem *item) + +DesktopIcon + + + + klistbox.h + klineedit.h + kpushbutton.h + kpushbutton.h + klineedit.h + klineedit.h + klineedit.h + klineedit.h + klineedit.h + klineedit.h + klineedit.h + klineedit.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + ktextedit.h + ktextedit.h + kpushbutton.h + kpushbutton.h + klistbox.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + klineedit.h + kpushbutton.h + + diff --git a/parts/distpart/distpart_widget.cpp b/parts/distpart/distpart_widget.cpp new file mode 100644 index 00000000..71c981e8 --- /dev/null +++ b/parts/distpart/distpart_widget.cpp @@ -0,0 +1,605 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "distpart_widget.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "kdevproject.h" +#include "domutil.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include "distpart_part.h" +#include +#include +#include +#include +#include +#include "kdevmakefrontend.h" +#include + +#include +#include "specsupport.h" +#include "lsmsupport.h" + +DistpartDialog::DistpartDialog(DistpartPart *part, QWidget *parent) + :distpart_ui(parent, "dist_widget"), m_part(part) { + m_spec = new SpecSupport(m_part); + + connect( customProjectCheckBox, SIGNAL(toggled(bool) ), + this, SLOT(slotcustomProjectCheckBoxChanged())); + connect( uploadCustomCheckBox, SIGNAL(toggled(bool)), + this, SLOT(slotuploadCustomCheckBoxChanged())); + +// connect( okayPushButton, SIGNAL(clicked()), +// this, SLOT(slotokayPushButtonPressed())); +// connect( cancelPushButton, SIGNAL(clicked()), +// this, SLOT(slotcancelPushButtonPressed())); +/* connect(help_PushButton, SIGNAL(clicked()), + this, SLOT(slothelp_PushButtonPressed()));*/ + connect( createSrcArchPushButton, SIGNAL(clicked()), + this, SLOT(slotcreateSrcArchPushButtonPressed())); + connect( resetSrcPushButton, SIGNAL(clicked()), + this, SLOT(slotresetSrcPushButtonPressed())); + + connect( genHTMLPushButton, SIGNAL(clicked()), + this, SLOT(slotgenHTMLPushButtonPressed())); + connect( resetHTMLPushButton, SIGNAL(clicked()), + this, SLOT(slotresetHTMLPushButtonPressed())); + connect( uploadSubmitPushButton, SIGNAL(clicked()), + this, SLOT(slotuploadSubmitPushButtonPressed())); + connect( uploadResetPushButton, SIGNAL(clicked()), + this, SLOT(slotuploadResetPushButtonPressed())); + connect( uploadAddFileToolButton, SIGNAL(clicked()), + this, SLOT(slotuploadAddFileToolButtonPressed())); + connect( uploadRemoveToolButton, SIGNAL(clicked()), + this, SLOT(slotuploadRemoveToolButtonPressed())); + connect ( srcDistFileListBox, SIGNAL(clicked(QListBoxItem *item)), this, SLOT(slotRemoveFile(QListBoxItem *item))); +// connect( buildAllPushButton, SIGNAL( clicked() ), this, SLOT( slotbuildAllPushButtonPressed() )); +// connect( exportSPECPushButton, SIGNAL( clicked() ), this, SLOT( slotexportSPECPushButtonPressed( ) ) ); +// connect( srcPackagePushButton, SIGNAL( clicked() ), this, SLOT( slotsrcPackagePushButtonPressed() ) ); +// connect( importSPECPushButton, SIGNAL( clicked() ), this, SLOT( slotimportSPECPushButtonPressed() ) ); + loadSettings(); + + + localOptionsGroupBox->setEnabled(false); + devPackageCheckBox->setEnabled(false); + docsPackageCheckBox->setEnabled(false); + appIconCheckBox->setEnabled(false); + uploadftpkdeorgCheckBox->setEnabled(false); + uploadAppsKDEcomCheckBox->setEnabled(false); +} + + +DistpartDialog::~DistpartDialog() { +} + +// QPushButton* okayPushButton; + +void DistpartDialog::slotokayPushButtonPressed() { + storeSettings(); +// accept(); +} +// QPushButton* cancelPushButton; + +void DistpartDialog::slotcancelPushButtonPressed() { +// reject(); +} +// QPushButton* help_PushButton; + +/*void DistpartDialog::slothelp_PushButtonPressed() { + QMessageBox::about(this,i18n("Distpart Help"),i18n("In order to build a RPM package :\n\t1) Create a source archive\n\t2) Generate a SPEC File\n\t3) Build the package")); +}*/ + +// QPushButton* createSrcArchPushButton; +void DistpartDialog::slotcreateSrcArchPushButtonPressed() { + kdDebug() << "Starting archive..." << endl; + QString dist = (getcustomProjectCheckBoxState() && getbzipCheckBoxState()) ? "application/x-bzip2" : "application/x-gzip"; + + QString filename = m_part->project()->projectDirectory() + "/" + getSourceName(); + + KTar tar(filename, dist); + if ( tar.open(IO_WriteOnly) ) + { + //QStringList files = m_part->project()->distFiles(); + KProgressDialog *prog = new KProgressDialog( 0, "dialog", i18n("Building Package"), "", true ); + prog->show(); + for( uint idx = 0; idx < srcDistFileListBox->numRows(); ++idx) + { + QString file = srcDistFileListBox->text(idx); + if ( !tar.addLocalFile( m_part->project()->projectDirectory() + "/" + file, getappNameFormatLineEditText() + "/" + file) ) + { + kdDebug() << "Failed to write file " << file << endl; + } + else + { + prog->setLabel(i18n("Adding file: %1").arg( file) ); + prog->progressBar()->setValue( (idx*100)/srcDistFileListBox->numRows() ); + } + } + tar.close( ); + prog->hide(); + delete prog; + KMessageBox::information( this, i18n("Archive made at: %1").arg( filename ), i18n("Archive Done") ); + + } + else + { + kdDebug() << "Failed to open archive..." << endl; + } + +} + +// QPushButton* resetSrcPushButton; +void DistpartDialog::slotresetSrcPushButtonPressed() { + srcDistFileListBox->clear(); + loadSettings(); +} + + + +// QPushButton* genHTMLPushButton; +void DistpartDialog::slotgenHTMLPushButtonPressed() {} + +// QPushButton* resetHTMLPushButton; +void DistpartDialog::slotresetHTMLPushButtonPressed() {} + +// QToolButton* uploadAddFileToolButton; +void DistpartDialog::slotuploadAddFileToolButtonPressed() { + uploadFileListBox->insertStringList(KFileDialog::getOpenFileNames()); +} + +// QToolButton* uploadRemoveToolButton; +void DistpartDialog::slotuploadRemoveToolButtonPressed() { + for(unsigned int i=0; i< uploadFileListBox->count(); i++) + if ( uploadFileListBox->isSelected(i)) uploadFileListBox->removeItem(i); +} + +// QPushButton* uploadSubmitPushButton; +void DistpartDialog::slotuploadSubmitPushButtonPressed() { + + if(getuploadftpkdeorgCheckBoxState() || getuploadAppsKDEcomCheckBoxState()) + kdDebug() << "Implement ftp.kde.org & apps.kde.com ftp transfer" << endl; + else { + for(unsigned int i=0; i< uploadFileListBox->count(); i++) + KIO::NetAccess::copy(KURL::fromPathOrURL( uploadFileListBox->text(i) ), + KURL::fromPathOrURL( getuploadURLLineEditText() + uploadFileListBox->text(i).replace(QRegExp("[^/]*/"),"") )); + } +} + +// QPushButton* uploadResetPushButton; +void DistpartDialog::slotuploadResetPushButtonPressed() { + uploadFileListBox->clear(); +} + +// Connect Slots to the following widgets and add +// accessors and mutators + + +// QCheckBox* customProjectCheckBox; +void DistpartDialog::slotcustomProjectCheckBoxChanged() { + kdDebug () << "New State" << customProjectCheckBox->isChecked() << endl; + sourceOptionsGroupBox->setEnabled( customProjectCheckBox->isChecked()); +} + +bool DistpartDialog::getcustomProjectCheckBoxState() { + return customProjectCheckBox->isChecked(); +} + +void DistpartDialog::setcustomProjectCheckBoxState(bool state) { + customProjectCheckBox->setChecked(state); +} + +// QCheckBox* uploadCustomCheckBox; +void DistpartDialog::slotuploadCustomCheckBoxChanged() { + uploadURLLineEdit->setEnabled( uploadCustomCheckBox->isChecked()); +} + +bool DistpartDialog::getuploadCustomCheckBoxState() { + return uploadCustomCheckBox->isChecked(); +} + +void DistpartDialog::setuploadCustomCheckBoxState(bool state) { + uploadCustomCheckBox->setChecked(state); +} + +// Add accessors and mutators for the following + +// QCheckBox* bzipCheckBox; +bool DistpartDialog::getbzipCheckBoxState() { + return bzipCheckBox->isChecked(); +} + +void DistpartDialog::setbzipCheckBoxState(bool state) { + bzipCheckBox->setChecked(state); +} + +// QCheckBox* appIconCheckBox; +bool DistpartDialog::getappIconCheckBoxState() { + return appIconCheckBox->isChecked(); +} + +void DistpartDialog::setappIconCheckBoxState(bool state) { + appIconCheckBox->setChecked(state); +} + +// QCheckBox* genHTMLCheckBox; +bool DistpartDialog::getgenHTMLCheckBoxState() { + return genHTMLCheckBox->isChecked(); +} + +void DistpartDialog::setgenHTMLCheckBoxState(bool state) { + genHTMLCheckBox->setChecked(state); +} + +// QCheckBox* useRPMInfoCheckBox; +bool DistpartDialog::getuseRPMInfoCheckBoxState() { + return useRPMInfoCheckBox->isChecked(); +} + +void DistpartDialog::setuseRPMInfoCheckBoxState(bool state) { + useRPMInfoCheckBox->setChecked(state); +} + +// QCheckBox* uploadAppsKDEcomCheckBox; +bool DistpartDialog::getuploadAppsKDEcomCheckBoxState() { + return uploadAppsKDEcomCheckBox->isChecked(); +} + +void DistpartDialog::setuploadAppsKDEcomCheckBoxState(bool state) { + uploadAppsKDEcomCheckBox->setChecked(state); +} + +// QCheckBox* uploadftpkdeorgCheckBox; +bool DistpartDialog::getuploadftpkdeorgCheckBoxState() { + return uploadftpkdeorgCheckBox->isChecked(); +} + +void DistpartDialog::setuploadftpkdeorgCheckBoxState(bool state) { + uploadftpkdeorgCheckBox->setChecked(state); +} + +// QCheckBox* devPackageCheckBox; +bool DistpartDialog::getdevPackageCheckBoxState() { + return devPackageCheckBox->isChecked(); +} + +void DistpartDialog::setdevPackageCheckBoxState(bool state) { + devPackageCheckBox->setChecked(state); +} + +// QCheckBox* docsPackageCheckBox; +bool DistpartDialog::getdocsPackageCheckBoxState() { + return docsPackageCheckBox->isChecked(); +} + +void DistpartDialog::setdocsPackageCheckBoxState(bool state) { + docsPackageCheckBox->setChecked(state); +} + +// QLineEdit* archNameFormatLineEdit; +QString DistpartDialog::getarchNameFormatLineEditText() { + return archNameFormatLineEdit->text(); +} + +void DistpartDialog::setarchNameFormatLineEditText(QString text) { + archNameFormatLineEdit->setText(text); +} + +// QLineEdit* appNameLineEdit; +QString DistpartDialog::getappNameFormatLineEditText() { + return appNameLineEdit->text(); +} + +void DistpartDialog::setappNameFormatLineEditText(QString text) { + appNameLineEdit->setText(text); +} + +// QLineEdit* summaryLineEdit; +QString DistpartDialog::getsummaryLineEditText() { + return summaryLineEdit->text(); +} + +void DistpartDialog::setsummaryLineEditText(QString text) { + summaryLineEdit->setText(text); +} + +// QLineEdit* groupLineEdit; +QString DistpartDialog::getgroupLineEditText() { + return groupLineEdit->text(); +} + +void DistpartDialog::setgroupLineEditText(QString text) { + groupLineEdit->setText(text); +} + +// QLineEdit* releaseLineEdit; +QString DistpartDialog::getreleaseLineEditText() { + return releaseLineEdit->text(); +} + +void DistpartDialog::setreleaseLineEditText(QString text) { + releaseLineEdit->setText(text); +} + +// QLineEdit* VersionLineEdit; +QString DistpartDialog::getversionLineEditText() { + return versionLineEdit->text(); +} + +void DistpartDialog::setversionLineEditText(QString text) { + versionLineEdit->setText( text ); +} + +// QLineEdit* VendorLineEdit; +QString DistpartDialog::getvendorLineEditText() { + return vendorLineEdit->text(); +} + +void DistpartDialog::setvendorLineEditText(QString text) { + vendorLineEdit->setText(text); +} + +// QLineEdit* LicenseLineEdit; +QString DistpartDialog::getlicenseLineEditText() { + return licenseLineEdit->text(); +} + +void DistpartDialog::setlicenseLineEditText(QString text) { + licenseLineEdit->setText(text); +} + +// QLineEdit* uploadURLLineEdit; +QString DistpartDialog::getuploadURLLineEditText() { + return uploadURLLineEdit->text(); +} + +void DistpartDialog::setuploadURLLineEditText(QString text) { + uploadURLLineEdit->setText(text); +} + +// QLineEdit* PackagerLineEdit; +QString DistpartDialog::getpackagerLineEditText() { + return packagerLineEdit->text(); +} + +void DistpartDialog::setpackagerLineEditText(QString text) { + packagerLineEdit->setText(text); +} + +// QComboBox* archComboBox; +QString DistpartDialog::getarchComboBoxText() { + return archComboBox->currentText(); +} + +int DistpartDialog::getarchComboBoxItem() { + return archComboBox->currentItem(); +} + +void DistpartDialog::setarchComboBoxItem(int item) { + archComboBox->setCurrentItem( item ); +} + +// QListBox* uploadFileListBox; +QString DistpartDialog::getuploadFileListBoxText() { + return uploadFileListBox->currentText(); +} + +int DistpartDialog::getuploadFileListBoxItem() { + return uploadFileListBox->currentItem(); +} + +void DistpartDialog::setuploadFileListBoxItem(int item) { + uploadFileListBox->setCurrentItem( item); +} + +// QListBox* srcDistFileListBox; +QString DistpartDialog::getsrcDistFileListBoxText() { + return srcDistFileListBox->currentText (); +} + +int DistpartDialog::getsrcDistFileListBoxItem() { + return srcDistFileListBox->currentItem (); +} + +void DistpartDialog::setsrcDistFileListBoxItem(int item) { + srcDistFileListBox->setCurrentItem( item ); +} + +// QMultiLineEdit* projectDescriptionMultilineEdit; +QString DistpartDialog::getprojectDescriptionMultilineEditText() { + return projectDescriptionMultilineEdit->text(); +} + +void DistpartDialog::setprojectDescriptionMultilineEditText(QString text) { + projectDescriptionMultilineEdit->setText(text); +} + +QString DistpartDialog::getprojectChangelogMultilineEditText() { + return projectChangelogMultilineEdit->text(); +} + +void DistpartDialog::setprojectChangelogMultilineEditText(QString text) { + projectChangelogMultilineEdit->setText(text); +} + +QString DistpartDialog::getSourceName() { + QString name = (getcustomProjectCheckBoxState()) ? getarchNameFormatLineEditText() : QString("%n-%v"); + name += (getcustomProjectCheckBoxState() && getbzipCheckBoxState()) ? ".tar.bz2" : ".tar.gz"; + return name.replace(QRegExp("%n"),getappNameFormatLineEditText()) + .replace(QRegExp("%v"),getversionLineEditText()) + .replace(QRegExp("%d"),QDate::currentDate().toString("yyyyMMdd")); +} + +void DistpartDialog::loadSettings() { + QDomDocument &dom = *m_part->projectDom(); + + srcDistFileListBox->insertStringList( m_part->project()->distFiles() ); + + // First Tab + setcustomProjectCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/custom",false)); + slotcustomProjectCheckBoxChanged(); + setbzipCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/bzip",false)); + setarchNameFormatLineEditText(DomUtil::readEntry(dom,"/dist/archname")); + + + // Second Tab + setappNameFormatLineEditText(DomUtil::readEntry(dom,"/dist/appname", m_part->project()->projectName() )); + setversionLineEditText(DomUtil::readEntry(dom,"/dist/version",DomUtil::readEntry(dom,"/general/version"))); + setreleaseLineEditText(DomUtil::readEntry(dom,"/dist/release")); + setvendorLineEditText(DomUtil::readEntry(dom,"/dist/vendor")); + setlicenseLineEditText(DomUtil::readEntry(dom,"/dist/licence")); + setsummaryLineEditText(DomUtil::readEntry(dom,"/dist/summary")); + setgroupLineEditText(DomUtil::readEntry(dom,"/dist/group")); + setpackagerLineEditText(DomUtil::readEntry(dom,"/dist/packager")); + setprojectDescriptionMultilineEditText(DomUtil::readEntry(dom,"/dist/description",DomUtil::readEntry(dom,"/general/description"))); + setprojectChangelogMultilineEditText(DomUtil::readEntry(dom,"/dist/changelog")); + setdevPackageCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/devpackage")); + setdocsPackageCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/docspackage")); + setappIconCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/appicon")); + setarchComboBoxItem(DomUtil::readIntEntry(dom,"/dist/arch")); + + // Third Tab + setgenHTMLCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/genHTML")); + setuseRPMInfoCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/useRPM")); + setuploadftpkdeorgCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/ftpkde")); + setuploadAppsKDEcomCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/appskde")); + setuploadCustomCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/custom")); + slotuploadCustomCheckBoxChanged(); + setuploadURLLineEditText(DomUtil::readEntry(dom,"/dist/url")); +} + +void DistpartDialog::storeSettings() { + QDomDocument &dom = *m_part->projectDom(); + + // First Tab + DomUtil::writeBoolEntry(dom,"/dist/custom",getcustomProjectCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/bzip",getbzipCheckBoxState()); + DomUtil::writeEntry(dom,"/dist/archname",getarchNameFormatLineEditText()); + + // Second Tab + DomUtil::writeEntry(dom,"/dist/appname",getappNameFormatLineEditText()); + DomUtil::writeEntry(dom,"/dist/version",getversionLineEditText()); + DomUtil::writeEntry(dom,"/dist/release",getreleaseLineEditText()); + DomUtil::writeEntry(dom,"/dist/vendor",getvendorLineEditText()); + DomUtil::writeEntry(dom,"/dist/licence",getlicenseLineEditText()); + DomUtil::writeEntry(dom,"/dist/summary",getsummaryLineEditText()); + DomUtil::writeEntry(dom,"/dist/group",getgroupLineEditText()); + DomUtil::writeEntry(dom,"/dist/packager",getpackagerLineEditText()); + DomUtil::writeEntry(dom,"/dist/description",getprojectDescriptionMultilineEditText()); + DomUtil::writeEntry(dom,"/dist/changelog",getprojectChangelogMultilineEditText()); + DomUtil::writeBoolEntry(dom,"/dist/devpackage",getdevPackageCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/docspackage",getdocsPackageCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/appicon",getappIconCheckBoxState()); + DomUtil::writeIntEntry(dom,"/dist/arch",getarchComboBoxItem()); + + // Third Tab + DomUtil::writeBoolEntry(dom,"/dist/genHTML",getgenHTMLCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/useRPM",getuseRPMInfoCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/ftpkde",getuploadftpkdeorgCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/appskde",getuploadAppsKDEcomCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/custom",getuploadCustomCheckBoxState()); + DomUtil::writeEntry(dom,"/dist/url",getuploadURLLineEditText()); +} +// Populate Spec Data from UI; +void DistpartDialog::setPackageData() +{ + m_spec->setAppRevision( releaseLineEdit->text()); + m_spec->setAppName( appNameLineEdit->text()); + m_spec->setAppVendor( vendorLineEdit->text()); + m_spec->setAppLicense( licenseLineEdit->text()); + m_spec->setAppSummary( summaryLineEdit->text()); + m_spec->setAppPackager( packagerLineEdit->text()); + m_spec->setAppVersion( versionLineEdit->text()); + m_spec->setAppGroup( groupLineEdit->text()); + m_spec->setAppDescription( projectDescriptionMultilineEdit->text()); + m_spec->setAppChangelog( projectChangelogMultilineEdit->text()); +} +// Populate UI from Spec data; +void DistpartDialog::getPackageData() +{ + releaseLineEdit->setText(m_spec->getAppRevision()); + appNameLineEdit->setText(m_spec->getAppName()); + vendorLineEdit->setText(m_spec->getAppVendor()); + licenseLineEdit->setText(m_spec->getAppLicense( )); + summaryLineEdit->setText(m_spec->getAppSummary( )); + packagerLineEdit->setText(m_spec->getAppPackager( )); + versionLineEdit->setText(m_spec->getAppVersion()); + groupLineEdit->setText(m_spec->getAppGroup( )); + projectDescriptionMultilineEdit->setText(m_spec->getAppDescription( )); + projectChangelogMultilineEdit->setText(m_spec->getAppChangelog( )); +} +void DistpartDialog::slotbuildAllPushButtonPressed( ) +{ + setPackageData(); + m_spec->slotbuildAllPushButtonPressed(); +} + +void DistpartDialog::slotexportSPECPushButtonPressed( ) +{ + setPackageData(); + m_spec->slotexportSPECPushButtonPressed(); +} + +void DistpartDialog::slotimportSPECPushButtonPressed( ) +{ + m_spec->slotimportSPECPushButtonPressed(); + getPackageData(); +} + +void DistpartDialog::slotsrcPackagePushButtonPressed( ) +{ + setPackageData(); + m_spec->slotsrcPackagePushButtonPressed(); +} + + +void DistpartDialog::slotAddFileButtonPressed(){ + QStringList filenames = KFileDialog::getOpenFileNames(); + for(uint count =0; count< filenames.size(); count++){ + QString base = m_part->project()->projectDirectory() +"/"; + srcDistFileListBox->insertItem(filenames[count].remove(base)); + } +} + +void DistpartDialog::slotRemoveFile(QListBoxItem *item){ + if ( KMessageBox::Yes == KMessageBox::warningYesNo( this, i18n("Remove %1").arg( item->text() ), i18n("Remove File") )){ + for(uint count =0; count< srcDistFileListBox->numRows(); count++){ + if ( item == srcDistFileListBox->item(count)){ + srcDistFileListBox->removeItem(count); + break; + } + } + } +} + +#include "distpart_widget.moc" diff --git a/parts/distpart/distpart_widget.h b/parts/distpart/distpart_widget.h new file mode 100644 index 00000000..81d91700 --- /dev/null +++ b/parts/distpart/distpart_widget.h @@ -0,0 +1,210 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef __DISTPART_WIDGET_H__ +#define __DISTPART_WIDGET_H__ + + +#include +#include +#include "distpart_ui.h" +#include +#include +#include +#include +#include +#include +#include + +class KDevProject; +class DistpartPart; +class QUrlOperator; +class KProcess; +class QTabWidget; +class SpecSupport; + +namespace KParts { +class ReadOnlyPart; +} + + +class DistpartDialog : public distpart_ui { + Q_OBJECT + +public: + + DistpartDialog(DistpartPart *part, QWidget *parent); + ~DistpartDialog(); + +signals: + void okay(); + void cancel(); + void help(); + void createsrc(); + void resetsrc(); + void buildall(); + void savespec(); + void loadspec(); + void srcrpm(); + void genhtml(); + void resethtml(); + void upload(); + void resetupload(); + + // Accessors and mutators to control GUI + // Connect Slots to the following widgets + + +public slots: + // QPushButton* okayPushButton; + + + void slotokayPushButtonPressed(); + // QPushButton* cancelPushButton; + void slotcancelPushButtonPressed(); + // QPushButton* help_PushButton; +// void slothelp_PushButtonPressed(); + // QPushButton* createSrcArchPushButton; + void slotcreateSrcArchPushButtonPressed(); + // QPushButton* resetSrcPushButton; + void slotresetSrcPushButtonPressed(); + + // QPushButton* genHTMLPushButton; + void slotgenHTMLPushButtonPressed(); + // QPushButton* resetHTMLPushButton; + void slotresetHTMLPushButtonPressed(); + // QToolButton* uploadAddFileToolButton; + void slotuploadAddFileToolButtonPressed(); + // QToolButton* uploadRemoveToolButton; + void slotuploadRemoveToolButtonPressed(); + // QPushButton* uploadSubmitPushButton; + void slotuploadSubmitPushButtonPressed(); + // QPushButton* uploadResetPushButton; + void slotuploadResetPushButtonPressed(); + + // Connect Slots to the following widgets and add + // accessors and mutators + // QCheckBox* customProjectCheckBox; + void slotcustomProjectCheckBoxChanged(); + // QCheckBox* uploadCustomCheckBox; + void slotuploadCustomCheckBoxChanged(); + + void slotbuildAllPushButtonPressed(); + void slotexportSPECPushButtonPressed(); + void slotimportSPECPushButtonPressed(); + void slotsrcPackagePushButtonPressed(); + void slotAddFileButtonPressed(); + void slotRemoveFile(QListBoxItem *item); + +public: + bool getcustomProjectCheckBoxState(); + void setcustomProjectCheckBoxState(bool state); + bool getuploadCustomCheckBoxState(); + void setuploadCustomCheckBoxState(bool state); + + // Add accessors and mutators for the following + + // QCheckBox* bzipCheckBox; + bool getbzipCheckBoxState(); + void setbzipCheckBoxState(bool state); + // QCheckBox* appIconCheckBox; + bool getappIconCheckBoxState(); + void setappIconCheckBoxState(bool state); + // QCheckBox* genHTMLCheckBox; + bool getgenHTMLCheckBoxState(); + void setgenHTMLCheckBoxState(bool state); + // QCheckBox* useRPMInfoCheckBox; + bool getuseRPMInfoCheckBoxState(); + void setuseRPMInfoCheckBoxState(bool state); + // QCheckBox* uploadAppsKDEcomCheckBox; + bool getuploadAppsKDEcomCheckBoxState(); + void setuploadAppsKDEcomCheckBoxState(bool state); + // QCheckBox* uploadftpkdeorgCheckBox; + bool getuploadftpkdeorgCheckBoxState(); + void setuploadftpkdeorgCheckBoxState(bool state); + // QCheckBox* devPackageCheckBox; + bool getdevPackageCheckBoxState(); + void setdevPackageCheckBoxState(bool state); + // QCheckBox* docsPackageCheckBox; + bool getdocsPackageCheckBoxState(); + void setdocsPackageCheckBoxState(bool state); + // QLineEdit* archNameFormatLineEdit; + QString getarchNameFormatLineEditText(); + void setarchNameFormatLineEditText(QString text); + // QLineEdit* appNameLineEdit; + QString getappNameFormatLineEditText(); + void setappNameFormatLineEditText(QString text); + // QLineEdit* summaryLineEdit; + QString getsummaryLineEditText(); + void setsummaryLineEditText(QString text); + // QLineEdit* groupLineEdit; + QString getgroupLineEditText(); + void setgroupLineEditText(QString text); + // QLineEdit* releaseLineEdit; + QString getreleaseLineEditText(); + void setreleaseLineEditText(QString text); + // QLineEdit* VersionLineEdit; + QString getversionLineEditText(); + void setversionLineEditText(QString text); + // QLineEdit* VendorLineEdit; + QString getvendorLineEditText(); + void setvendorLineEditText(QString text); + // QLineEdit* LicenseLineEdit; + QString getlicenseLineEditText(); + void setlicenseLineEditText(QString text); + // QLineEdit* uploadURLLineEdit; + QString getuploadURLLineEditText(); + void setuploadURLLineEditText(QString text); + // QLineEdit* PackagerLineEdit; + QString getpackagerLineEditText(); + void setpackagerLineEditText(QString text); + // QComboBox* archComboBox; + QString getarchComboBoxText(); + int getarchComboBoxItem(); + void setarchComboBoxItem(int item); + // QListBox* uploadFileListBox; + QString getuploadFileListBoxText(); + int getuploadFileListBoxItem(); + void setuploadFileListBoxItem(int item); + // QListBox* srcDistFileListBox; + QString getsrcDistFileListBoxText(); + int getsrcDistFileListBoxItem(); + void setsrcDistFileListBoxItem(int item); + // QMultiLineEdit* projectDescriptionMultilineEdit; + QString getprojectDescriptionMultilineEditText(); + void setprojectDescriptionMultilineEditText(QString text); + + QString getprojectChangelogMultilineEditText(); + void setprojectChangelogMultilineEditText(QString text); + + QString getSourceName(); + +private: + void loadSettings(); + void storeSettings(); + void setPackageData(); + void getPackageData(); + + SpecSupport *m_spec; + DistpartPart *m_part; + QString dir; +}; + + +#endif diff --git a/parts/distpart/kdevdistpart.desktop b/parts/distpart/kdevdistpart.desktop new file mode 100644 index 00000000..8eaf44ee --- /dev/null +++ b/parts/distpart/kdevdistpart.desktop @@ -0,0 +1,70 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Aids in building and publishing the final project. Supports creation of RPM packages or source packages. +Comment[ca]=Ajuda en la construcció i publicació del projecte final. Suporta la creació de paquets RPM o paquets font. +Comment[da]=Hjælper til med at bygge og publicere det færdige projekt. Understøtter at oprette RPM-pakker og kildekodepakker. +Comment[de]=Unterstützt beim Erstellen und Ausliefern des fertigen Projekts. Derzeit werden RPM- und Quell-Pakete unterstützt. +Comment[el]=Βοηθά στην κατασκευή και δημοσίευση του τελικού έργου. Για την ώρα υποστηρίζεται μόνο η μορφή RPM. +Comment[es]=Ayuda en la construcción y publicación del proyecto final. Contempla la creación de paquetes RPM y de código fuente. +Comment[et]=Abi valmisprojekti ehitamisel ja avaldamisel. Toetatud on RPM-pakettide ja lähtekoodipakettide loomine. +Comment[fr]=Outil d'aide à la construction et à la publication du projet final. Prend en charge la création de paquetages RPM ou de paquetages de sources. +Comment[hu]=A projekt felépítésében és publikálásában segít. RPM és forráscsomagok készítését teszi lehetővé. +Comment[it]=Aiuta nella compilazione e pubblicazione del progetto finale. Supporta la creazione di pacchetti RPM o di pacchetti sorgenti. +Comment[ms]=Membantu dalam membina dan menerbitkan projek akhir. Menyokong penciptaan pakej RPM atau pakej sumber. +Comment[nds]=Ünnerstütten för't Opstellen un Apenmaken vun't fardige Projekt. Ünnerstütt dat Opstellen vun RPMs un Bornpaketen. +Comment[nl]=Helpt bij het bouwen en publiceren van het uiteindelijke project. Ondersteunt het aanmaken van RPM-pakketten of broncodepakketten. +Comment[pl]=Pomoc w budowaniu i publikowaniu projektu. Obsługuje tworzenie pakietów RPM i paczek ze źródłami. +Comment[pt]=Ajuda na construção e publicação do projecto final. Suporta a criação de pacotes RPM ou pacotes com código-fonte. +Comment[pt_BR]=Auxilia na compilação e publicação do projeto final. Suporta a criação de pacotes RPM ou pacotes fontes. +Comment[ru]=Помощник по сборке и распространению окончательных версий проекта. Поддерживает создание пакетов RPM или пакетов с исходным кодом. +Comment[sk]=Pomáha pri vytváraní a publikovaní finálneho projektu. Podporované sú RPM a zdrojové balíčky. +Comment[sr]=Помаже у грађењу и објављивању коначног пројекта. За сада је подржано стварање RPM и изворних пакета. +Comment[sr@Latn]=Pomaže u građenju i objavljivanju konačnog projekta. Za sada je podržano stvaranje RPM i izvornih paketa. +Comment[sv]=Hjälper till att bygga och publicera det färdiga projektet. Stöder att skapa RPM-paket och källkodspaket. +Comment[zh_TW]=協助建立與發布最終專案版本。支援建立 RPM 套件與 RPM 源碼套件。 +Name=KDevdistpart +Name[da]=KDevelop distpart +Name[de]=Unterstützung für Paketerstellung (KDevelop) +Name[hi]=के-डेव-डिस्टपार्ट +Name[nds]=Paketopstell-Ünnerstütten för't KDevelop +Name[sk]=KDev distribúcia +Name[sv]=KDevelop distributionsdel +Name[zh_TW]=KDevelop 發布元件 +GenericName=Final Packaging Support +GenericName[ca]=Suport per a l'empaquetat final +GenericName[da]=Endelig pakkestøtte +GenericName[de]=Unterstützung für Paketerstellung +GenericName[el]=Υποστήριξη τελικού πακέτου +GenericName[es]=Soporte para empaquetado final +GenericName[et]=Lõpp-pakendamise toetus +GenericName[eu]=Azken paketatze euskarria +GenericName[fa]=پشتیبانی بسته‌بندی نهایی +GenericName[fr]=Gestion du conditionnement final +GenericName[gl]=Soporte para empaquetado final +GenericName[hu]=Csomagelőkészítő +GenericName[it]=Supporto finale per la creazione di pacchetti +GenericName[ja]=最終パッケージ化サポート +GenericName[nds]=Ünnerstütten för't Paketopstellen +GenericName[ne]=अन्तिम प्याकेजिङ समर्थन +GenericName[nl]=Ondersteuning voor projectpublicatie +GenericName[pl]=Obsługa ostatecznego pakowania +GenericName[pt]=Suporte a Empacotamento Final +GenericName[pt_BR]=Suporte ao Empacotamento Final +GenericName[ru]=Сборка и распространение пакетов +GenericName[sk]=Podpora finálneho balíčkovania +GenericName[sl]=Podpora končnemu ustarjanju paketov +GenericName[sr]=Подршка за коначно паковање +GenericName[sr@Latn]=Podrška za konačno pakovanje +GenericName[sv]=Stöd för slutpaketering +GenericName[ta]=ஆதரவுள்ள கடைசி தொகுப்பு +GenericName[tg]=Ҷамъкунӣ ва ҷорӣ намудани пакетҳо +GenericName[tr]=Son Paketleme Desteği +GenericName[zh_CN]=最终打包支持 +GenericName[zh_TW]=最終包裝支援 +Icon=kdevelop +ServiceTypes=KDevelop/Plugin +X-KDE-Library=libkdevdistpart +X-KDevelop-Version=5 +X-KDevelop-Scope=Project +X-KDevelop-Properties=ProjectPackaging diff --git a/parts/distpart/kdevpart_distpart.rc b/parts/distpart/kdevpart_distpart.rc new file mode 100644 index 00000000..8b142d04 --- /dev/null +++ b/parts/distpart/kdevpart_distpart.rc @@ -0,0 +1,8 @@ + + + +

&Project + + + + diff --git a/parts/distpart/lsmsupport.cpp b/parts/distpart/lsmsupport.cpp new file mode 100644 index 00000000..84414f6a --- /dev/null +++ b/parts/distpart/lsmsupport.cpp @@ -0,0 +1,32 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "lsmsupport.h" + +LsmSupport::LsmSupport() : packageBase() { + +} + +LsmSupport::~LsmSupport() { +} + +QString LsmSupport::generatePackage( ) +{ + return ""; +} diff --git a/parts/distpart/lsmsupport.h b/parts/distpart/lsmsupport.h new file mode 100644 index 00000000..3f50c7ea --- /dev/null +++ b/parts/distpart/lsmsupport.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef __LSMSUPPORT_H__ +#define __LSMSUPPORT_H__ + +#include "packagebase.h" +#include "distpart_part.h" + +class LsmSupport : public packageBase +{ + +public: + LsmSupport(); + virtual ~LsmSupport(); +QString generatePackage( ); +}; + +#endif diff --git a/parts/distpart/packagebase.cpp b/parts/distpart/packagebase.cpp new file mode 100644 index 00000000..797c2613 --- /dev/null +++ b/parts/distpart/packagebase.cpp @@ -0,0 +1,117 @@ +#include "packagebase.h" + +packageBase::packageBase() { + +} + +packageBase::~packageBase() {} + +QString packageBase::getAppName() { + return AppName; +} + +QString packageBase::getAppVersion() { + return AppVersion; +} + +QString packageBase::getAppRevision() { + return AppRevision; +} + +QString packageBase::getAppGroup() { + return AppGroup; +} + +QString packageBase::getAppPackager() { + return AppPackager; +} + +QString packageBase::getAppURL() { + return AppURL; +} + +QString packageBase::getAppSummary() { + return AppSummary; +} + +QString packageBase::getAppVendor() { + return AppVendor; +} + +QString packageBase::getAppLicense() { + return AppLicense; +} + +QString packageBase::getAppArch() { + return AppArch; +} + +QString packageBase::getAppDescription() { + return AppDescription; +} + +QString packageBase::getAppChangelog() { + return AppChangelog; +} + +QString packageBase::getAppSource() { + return AppSource; +} + +QStringList packageBase::getAppFileList() { + return AppFileList; +} + +void packageBase::setAppName(const QString& name) { + AppName = name; +} + +void packageBase::setAppVersion(const QString& version){ + AppVersion = version; +} + +void packageBase::setAppRevision(const QString& revision){ + AppRevision = revision; +} + +void packageBase::setAppGroup(const QString& group){ + AppGroup = group; +} + +void packageBase::setAppPackager(const QString& packager){ + AppPackager = packager; +} + +void packageBase::setAppURL(const QString& url) +{ + AppURL = url; +} + +void packageBase::setAppSummary(const QString& summary){ + AppSummary = summary; +} + +void packageBase::setAppVendor(const QString& vendor){ + AppVendor = vendor; +} + +void packageBase::setAppLicense(const QString& licence){ + AppLicense = licence; +} + +void packageBase::setAppArch(const QString& arch){ + AppArch = arch; +} + +void packageBase::setAppDescription(const QString& description){ + AppDescription = description; +} + +void packageBase::setAppChangelog(const QString& changelog){ + AppChangelog = changelog; +} + +void packageBase::setAppFileList( const QStringList & list ) +{ + AppFileList = list; +} diff --git a/parts/distpart/packagebase.h b/parts/distpart/packagebase.h new file mode 100644 index 00000000..17148982 --- /dev/null +++ b/parts/distpart/packagebase.h @@ -0,0 +1,84 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef __PACKAGEBASE_H__ +#define __PACKAGEBASE_H__ + +#include +#include + +class packageBase +{ + +public: + packageBase(); + virtual ~packageBase(); + +// Generic accessors and mutators for child classes + virtual QString generatePackage( ) = 0 ; + //virtual bool loadFile(KURL theFile) = 0; + //virtual bool saveFile(KURL theFile) = 0; + + virtual QString getAppName(); + virtual QString getAppVersion(); + virtual QString getAppRevision(); + virtual QString getAppGroup(); + virtual QString getAppPackager(); + virtual QString getAppURL(); + virtual QString getAppSummary(); + virtual QString getAppVendor(); + virtual QString getAppLicense(); + virtual QString getAppArch(); + virtual QString getAppDescription(); + virtual QString getAppChangelog(); + virtual QString getAppSource(); + virtual QStringList getAppFileList(); + + virtual void setAppName(const QString&); + virtual void setAppVersion(const QString&); + virtual void setAppRevision(const QString&); + virtual void setAppGroup(const QString&); + virtual void setAppPackager(const QString&); + virtual void setAppURL(const QString&); + virtual void setAppSummary(const QString&); + virtual void setAppVendor(const QString&); + virtual void setAppLicense(const QString&); + virtual void setAppArch(const QString&); + virtual void setAppDescription(const QString&); + virtual void setAppChangelog(const QString&); + virtual void setAppFileList(const QStringList &list); + + private: + QString AppName; + QString AppVersion; + QString AppRevision; + QString AppGroup; + QString AppPackager; + QString AppURL; + QString AppSummary; + QString AppVendor; + QString AppLicense; + QString AppArch; + QString AppDescription; + QString AppChangelog; + QString AppSource; + QStringList AppFileList; +}; + +#endif diff --git a/parts/distpart/specsupport.cpp b/parts/distpart/specsupport.cpp new file mode 100644 index 00000000..b9ba6e1e --- /dev/null +++ b/parts/distpart/specsupport.cpp @@ -0,0 +1,315 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "specsupport.h" +#include "kdevproject.h" +#include "kdevmakefrontend.h" +#include "distpart_widget.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include + +/// \FIXME This is at least the fifth place in the kdevelop code something like this exists +QString QRegExp_escape(const QString& str ) +{ +#if QT_VERSION >= 0x030100 + return QRegExp::escape(str); +#else + // this block is copyrighted by Trolltech AS (GPL) + static const char meta[] = "$()*+.?[\\]^{|}"; + QString quoted = str; + int i = 0; + + while ( i < (int) quoted.length() ) { + if ( strchr(meta, quoted[i].latin1()) != 0 ) + quoted.insert( i++, "\\" ); + i++; + } + return quoted; +#endif +} + +SpecSupport::SpecSupport(DistpartPart *part) : packageBase(), m_part(part) { + dir = ""; + +// srcPackagePushButton = new QPushButton(i18n("Src Package"),area()); +// buildAllPushButton = new QPushButton(i18n("Src/Binary Packages"),area()); +// exportSPECPushButton = new QPushButton(i18n("Export SPEC File"),area()); +// importSPECPushButton = new QPushButton(i18n("Import SPEC File"),area()); +// +// +// +// connect(buildAllPushButton, SIGNAL(clicked()), +// this, SLOT(slotbuildAllPushButtonPressed())); +// connect(exportSPECPushButton, SIGNAL(clicked()), +// this, SLOT(slotexportSPECPushButtonPressed())); +// connect(importSPECPushButton, SIGNAL(clicked()), +// this, SLOT(slotimportSPECPushButtonPressed())); +// connect(srcPackagePushButton, SIGNAL(clicked()), +// this, SLOT(slotsrcPackagePushButtonPressed())); + + parseDotRpmmacros(); +} + +SpecSupport::~SpecSupport() { +} + +// QPushButton* buildAllPushButton; +void SpecSupport::slotbuildAllPushButtonPressed() { + QMap::Iterator it; + QFile file1(dir + "/" + getAppSource()); + QFile file2(*(map.find("_sourcedir")) + "/" + getAppSource()); + if (!file2.exists()) { + if (!file1.exists()) { + QMessageBox::critical(0 ,i18n("Error"),i18n("You need to create a source archive first.")); + return; + } + else + if (KDevMakeFrontend *makeFrontend = m_part->extension("KDevelop/MakeFrontend")) + makeFrontend->queueCommand(dir,"cd " + KProcess::quote(dir) + + " && cp " + KProcess::quote(getAppSource()) + " " + KProcess::quote(*(map.find("_sourcedir")))); + } + if (KDevMakeFrontend *makeFrontend = m_part->extension("KDevelop/MakeFrontend")) + makeFrontend->queueCommand(dir,"cd " + KProcess::quote((((it = map.find("_specdir")) != map.end()) ? (*it) : dir)) + + " && rpmbuild -ba " + m_part->project()->projectName() + ".spec"); +} + +// QPushButton* exportSPECPushButton; +void SpecSupport::slotexportSPECPushButtonPressed() { + QMap::Iterator it; + QString specname = ((it = map.find("_specdir")) != map.end()) ? (*it) : (m_part->project()->projectDirectory()); + specname += ("/" + m_part->project()->projectName() + ".spec"); + QFile file(specname); + + if(file.open(IO_WriteOnly)) { + QTextStream stream(&file); + stream << generatePackage(); + file.close(); + } else { + kdDebug() << "TODO : intercept write error in SpecSupport::slotexportSPECPushButtonPressed()"; + } +} + +QString SpecSupport::getInfo(QString s, QString motif) { + QRegExp re(motif + "[ \t]*([^ \t].*[^ \t])[ \t]*"); + if (re.exactMatch(s)) + return re.cap(1); + return QString::null; +} + +// QPushButton* importSPECPushButton; +void SpecSupport::slotimportSPECPushButtonPressed() { + QString fileName = KFileDialog::getOpenFileName(dir,"*.spec"); + if( fileName.isEmpty()) + return; + QFile file(fileName); + + if(file.open(IO_ReadOnly)) { + QTextStream stream(&file); + + while (!stream.atEnd()) { + QString s = stream.readLine(); + QString info; + if (!(info = getInfo(s,"Name:")).isEmpty()) + setAppName(info); + else if (!(info = getInfo(s,"Version:")).isEmpty()) + setAppVersion(info); + else if (!(info = getInfo(s,"Release:")).isEmpty()) + setAppRevision(info); + else if (!(info = getInfo(s,"Vendor:")).isEmpty()) + setAppVendor(info); + else if (!(info = getInfo(s,"Copyright:")).isEmpty()) + setAppLicense(info); + else if (!(info = getInfo(s,"Summary:")).isEmpty()) + setAppSummary(info); + else if (!(info = getInfo(s,"Group:")).isEmpty()) + setAppGroup(info); + else if (!(info = getInfo(s,"Packager:")).isEmpty()) + setAppPackager(info); + else if (s.startsWith("%description")) { + QString desc; + while (!stream.atEnd()) { + QString str = stream.readLine(); + if (str.startsWith("%")) break; + else desc += str + "\n"; + } + setAppDescription(desc); + } + else if (s.startsWith("%changelog")) { + QString change; + while (!stream.atEnd()) { + QString str = stream.readLine(); + if (str.startsWith("%")) break; + else change += str + "\n"; + } + setAppChangelog(change); + } + } + } +} + +void SpecSupport::slotAddFileButtonPressed(){ +QString filename = KFileDialog::getOpenFileName (); +} + +// QPushButton* srcPackagePushButton; +void SpecSupport::slotsrcPackagePushButtonPressed() { + QMap::Iterator it; + + QFile file1(dir + "/" + getAppSource()); + QFile file2(*(map.find("_sourcedir")) + "/" + getAppSource()); + if (!file2.exists()) { + if (!file1.exists()) { + QMessageBox::critical(0,i18n("Error"),i18n("You need to create a source archive first.")); + return; + } + else + if (KDevMakeFrontend *makeFrontend = m_part->extension("KDevelop/MakeFrontend")) + makeFrontend->queueCommand(dir,"cd " + KProcess::quote(dir) + + " && cp " + KProcess::quote(getAppSource()) + " " + KProcess::quote(*(map.find("_sourcedir")))); + } + if (KDevMakeFrontend *makeFrontend = m_part->extension("KDevelop/MakeFrontend")) + makeFrontend->queueCommand(dir,"cd " + KProcess::quote((((it = map.find("_specdir")) != map.end()) ? (*it) : dir)) + + " && rpmbuild -bs " + m_part->project()->projectName() + ".spec"); +} + +void SpecSupport::parseDotRpmmacros() { + QFile dotfile(QDir::homeDirPath() + "/.rpmmacros"); + + if (!dotfile.open(IO_ReadOnly)) { +// QErrorMessage * msg = new QErrorMessage(this); +// msg->message("It seems you don't have a ~/.rpmmacros\nYou may experience problems building packages.\n"); +// msg->exec(); + return; + } + QTextStream stream(&dotfile); + + // Perhaps will it appear as a necessity to parse the global rpm config file? + + // Pre defined macros : + map.insert("name",getAppName()); + + // .rpmmacros parsing : + while (!stream.atEnd()) { + QString s = stream.readLine(); + QRegExp re("%([^ \t]*)[ \t][ \t]*([^\t]*)$"); + if(re.exactMatch(s)) { + QRegExp subst("%\\{([^%]*)\\}"); + QString value = re.cap(2).stripWhiteSpace(); + + while(subst.search(value) != -1) { + value.replace(QRegExp("%\\{"+ QRegExp_escape( subst.cap(1) ) +"\\}"),*map.find(subst.cap(1))); + } + map.insert(re.cap(1),value); + } + } + dotfile.close(); + + // create directories if necessary : + createRpmDirectoryFromMacro("_topdir"); + createRpmDirectoryFromMacro("_tmppath"); + createRpmDirectoryFromMacro("_builddir"); + createRpmDirectoryFromMacro("_rpmdir"); + createRpmDirectoryFromMacro("_sourcedir"); + createRpmDirectoryFromMacro("_specdir"); + createRpmDirectoryFromMacro("_srcrpmdir"); +} + +bool SpecSupport::createRpmDirectoryFromMacro(const QString & name) { + QMap::Iterator it; + if((it = map.find(name)) != map.end()) { + QDir dir(*it); + if (!dir.exists()) return dir.mkdir(*it); + } + return false; +} + +QString SpecSupport::generatePackage( ) +{ + QString spec; + spec += "# This spec file was generated by KDevelop \n"; + spec += "# Please report any problem to KDevelop Team \n"; + spec += "# Thanks to Matthias Saou for his explanations on http://freshrpms.net/docs/fight.html\n\n"; + + spec += "Name: " + getAppName() + "\n"; + spec += "Version: " + getAppVersion() + "\n"; + spec += "Release: " + getAppRevision() + "\n"; + spec += "Vendor: " + getAppVendor() + "\n"; + spec += "Copyright: " + getAppLicense() + "\n"; + spec += "Summary: " + getAppSummary() + "\n"; + spec += "Group: " + getAppGroup() + "\n"; + spec += "Packager: " + getAppPackager() + "\n"; + spec += "BuildRoot: %{_tmppath}/%{name}-root \n"; + spec += "Source: " + getAppSource() + "\n"; + + spec += "\n"; + spec += "%description\n"; + spec += getAppDescription()+ "\n"; + + spec += "\n"; + spec += "%prep\n"; + spec += "%setup\n"; + spec += "CFLAGS=\"$RPM_OPT_FLAGS\" CXXFLAGS=\"$RPM_OPT_FLAGS\" ./configure \\ \n"; + spec += "--target=" + getAppArch() + "\n"; + spec += "--disable-debug --enable-debug=no \n"; + + spec += "\n"; + spec += "%build\n"; + spec += "%configure\n"; + spec += "make\n"; + + spec += "\n"; + spec += "%install\n"; + spec += "rm -rf %{buildroot}\n"; + spec += "%makeinstall\n"; + + spec += "\n"; + spec += "%clean\n"; + spec += "rm -rf %{buildroot}\n"; + + spec += "\n"; + spec += "%post -p /sbin/ldconfig\n"; + + spec += "%postun -p /sbin/ldconfig\n"; + + spec += "%files\n"; + spec += "%defattr(-, root, root)\n"; + spec += "%doc AUTHORS COPYING ChangeLog NEWS README TODO\n"; + spec += "%{_bindir}/*\n"; + spec += "%{_libdir}/*.so.*\n"; + spec += "%{_datadir}/%{name}\n"; + spec += "%{_mandir}/man8/*\n"; + + spec += "%changelog\n"; + spec += getAppChangelog() + "\n"; + + return spec; +} diff --git a/parts/distpart/specsupport.h b/parts/distpart/specsupport.h new file mode 100644 index 00000000..d64642e9 --- /dev/null +++ b/parts/distpart/specsupport.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef __SPECSUPPORT_H__ +#define __SPECSUPPORT_H__ + +#include +#include +#include "packagebase.h" +#include "distpart_part.h" +#include "distpart_widget.h" + +class SpecSupport : public packageBase { + +public: + SpecSupport(DistpartPart *part); + ~SpecSupport(); + +public: + QString generatePackage(); + void slotbuildAllPushButtonPressed(); + void slotexportSPECPushButtonPressed(); + void slotimportSPECPushButtonPressed(); + void slotsrcPackagePushButtonPressed(); + void slotAddFileButtonPressed(); + +private: + void parseDotRpmmacros(); + bool createRpmDirectoryFromMacro(const QString & name); + + QString getInfo(QString s, QString motif); + + QString dir; + DistpartPart *m_part; + QMap map; +}; + +#endif -- cgit v1.2.1