[fritzing] Release fritzing 0.7.11b-2, with patch to handle missing parts database.
Ed Marshall
logic at fedoraproject.org
Wed Jan 9 00:24:00 UTC 2013
commit 615a098c59a467144c7378a1328f5147ec658d1e
Author: Ed Marshall <esm at logic.net>
Date: Tue Jan 8 16:00:25 2013 -0800
Release fritzing 0.7.11b-2, with patch to handle missing parts database.
fritzing-fix-missing-parts.patch | 169 ++++++++++++++++++++++++++++++++++++++
fritzing.spec | 8 ++-
2 files changed, 176 insertions(+), 1 deletions(-)
---
diff --git a/fritzing-fix-missing-parts.patch b/fritzing-fix-missing-parts.patch
new file mode 100644
index 0000000..8644425
--- /dev/null
+++ b/fritzing-fix-missing-parts.patch
@@ -0,0 +1,169 @@
+diff -urp fritzing-0.7.11b.source.orig/src/fapplication.cpp fritzing-0.7.11b.source/src/fapplication.cpp
+--- fritzing-0.7.11b.source.orig/src/fapplication.cpp 2013-01-08 15:46:38.486181385 -0800
++++ fritzing-0.7.11b.source/src/fapplication.cpp 2013-01-08 15:46:51.075754184 -0800
+@@ -669,19 +669,27 @@ ReferenceModel * FApplication::loadRefer
+ ItemBase::setReferenceModel(m_referenceModel);
+ connect(m_referenceModel, SIGNAL(loadedPart(int, int)), this, SLOT(loadedPart(int, int)));
+
+- bool ok = m_referenceModel->loadAll(databaseName, fullLoad); // loads local parts, resource parts, and any other parts in files not in the db--these part override db parts with the same moduleID
++ bool dbExists = false;
++ QDir * dir = FolderUtils::getApplicationSubFolder("parts");
++ QString dbPath;
++ if (dir) {
++ dbPath = dir->absoluteFilePath("parts.db");
++ QFileInfo info(dbPath);
++ dbExists = info.exists();
++ }
++
++ bool ok = m_referenceModel->loadAll(databaseName, fullLoad, dbExists); // loads local parts, resource parts, and any other parts in files not in the db--these part override db parts with the same moduleID
+ if (ok && databaseName.isEmpty()) {
+- QDir * dir = FolderUtils::getApplicationSubFolder("parts");
+ if (dir == NULL) {
+ }
+ else {
+ QFile file(dir->absoluteFilePath("parts.db"));
+ if (file.exists()) {
+- m_referenceModel->loadFromDB(dir->absoluteFilePath("parts.db"));
++ m_referenceModel->loadFromDB(dbPath);
+ }
+- delete dir;
+ }
+ }
++ delete dir;
+
+ return m_referenceModel;
+ }
+diff -urp fritzing-0.7.11b.source.orig/src/model/palettemodel.cpp fritzing-0.7.11b.source/src/model/palettemodel.cpp
+--- fritzing-0.7.11b.source.orig/src/model/palettemodel.cpp 2013-01-08 15:46:38.464523757 -0800
++++ fritzing-0.7.11b.source/src/model/palettemodel.cpp 2013-01-08 15:46:51.074671296 -0800
+@@ -87,7 +87,7 @@ PaletteModel::PaletteModel(bool makeRoot
+ m_fullLoad = false;
+
+ if (doInit) {
+- initParts();
++ initParts(false);
+ }
+ }
+
+@@ -98,7 +98,7 @@ PaletteModel::~PaletteModel()
+ }
+ }
+
+-void PaletteModel::initParts() {
++void PaletteModel::initParts(bool dbExists) {
+ QDir * dir = FolderUtils::getApplicationSubFolder("parts");
+ if (dir == NULL) {
+ QMessageBox::information(NULL, QObject::tr("Fritzing"),
+@@ -109,7 +109,7 @@ void PaletteModel::initParts() {
+ FritzingContribPath = dir->absoluteFilePath("contrib");
+ delete dir;
+
+- loadParts();
++ loadParts(dbExists);
+ if (m_root == NULL) {
+ QMessageBox::information(NULL, QObject::tr("Fritzing"),
+ QObject::tr("No parts found.") );
+@@ -137,7 +137,7 @@ bool PaletteModel::containsModelPart(con
+ return m_partHash.contains(moduleID);
+ }
+
+-void PaletteModel::loadParts() {
++void PaletteModel::loadParts(bool dbExists) {
+ QStringList nameFilters;
+ nameFilters << "*" + FritzingPartExtension;
+
+@@ -170,7 +170,7 @@ void PaletteModel::loadParts() {
+ countParts(dir2, nameFilters, totalPartCount);
+
+ QDir dir3(":/resources/parts");
+- if (m_fullLoad) {
++ if (m_fullLoad || !dbExists) {
+ countParts(dir3, nameFilters, totalPartCount);
+ }
+
+@@ -182,7 +182,7 @@ void PaletteModel::loadParts() {
+
+ loadPartsAux(dir2, nameFilters, loadingPart, totalPartCount);
+
+- if (m_fullLoad) {
++ if (m_fullLoad || !dbExists) {
+ // otherwise these will already be in the database
+ loadPartsAux(dir3, nameFilters, loadingPart, totalPartCount);
+ }
+diff -urp fritzing-0.7.11b.source.orig/src/model/palettemodel.h fritzing-0.7.11b.source/src/model/palettemodel.h
+--- fritzing-0.7.11b.source.orig/src/model/palettemodel.h 2013-01-08 15:46:38.464523757 -0800
++++ fritzing-0.7.11b.source/src/model/palettemodel.h 2013-01-08 15:46:51.074671296 -0800
+@@ -72,8 +72,8 @@ signals:
+ void addSearchMaximum(int);
+
+ protected:
+- virtual void initParts();
+- void loadParts();
++ virtual void initParts(bool dbExists);
++ void loadParts(bool dbExists);
+ void loadPartsAux(QDir & dir, QStringList & nameFilters, int & loadedPart, int totalParts);
+ void countParts(QDir & dir, QStringList & nameFilters, int & partCount);
+ void search(ModelPart * modelPart, const QStringList & searchStrings, QList<ModelPart *> & modelParts, bool allowObsolete);
+diff -urp fritzing-0.7.11b.source.orig/src/referencemodel/referencemodel.h fritzing-0.7.11b.source/src/referencemodel/referencemodel.h
+--- fritzing-0.7.11b.source.orig/src/referencemodel/referencemodel.h 2013-01-08 15:46:38.461275112 -0800
++++ fritzing-0.7.11b.source/src/referencemodel/referencemodel.h 2013-01-08 15:46:51.074671296 -0800
+@@ -33,7 +33,7 @@ $Date: 2012-09-26 15:45:37 +0200 (Wed, 2
+ class ReferenceModel : public PaletteModel {
+ Q_OBJECT
+ public:
+- virtual bool loadAll(const QString & databaseName, bool fullLoad) = 0;
++ virtual bool loadAll(const QString & databaseName, bool fullLoad, bool dbExists) = 0;
+ virtual bool loadFromDB(const QString & databaseName) = 0;
+ virtual ModelPart *loadPart(const QString & path, bool update) = 0;
+ virtual ModelPart *reloadPart(const QString & path, const QString & moduleID) = 0;
+diff -urp fritzing-0.7.11b.source.orig/src/referencemodel/sqlitereferencemodel.cpp fritzing-0.7.11b.source/src/referencemodel/sqlitereferencemodel.cpp
+--- fritzing-0.7.11b.source.orig/src/referencemodel/sqlitereferencemodel.cpp 2013-01-08 15:46:38.461275112 -0800
++++ fritzing-0.7.11b.source/src/referencemodel/sqlitereferencemodel.cpp 2013-01-08 15:46:51.074671296 -0800
+@@ -102,12 +102,12 @@ SqliteReferenceModel::SqliteReferenceMod
+ m_lastWasExactMatch = true;
+ }
+
+-bool SqliteReferenceModel::loadAll(const QString & databaseName, bool fullLoad)
++bool SqliteReferenceModel::loadAll(const QString & databaseName, bool fullLoad, bool dbExists)
+ {
+ FailurePartMessages.clear();
+ FailurePropertyMessages.clear();
+ m_fullLoad = fullLoad;
+- initParts();
++ initParts(dbExists);
+
+ int tries = 0;
+ m_keepGoing = true;
+@@ -474,9 +474,9 @@ SqliteReferenceModel::~SqliteReferenceMo
+ deleteConnection();
+ }
+
+-void SqliteReferenceModel::initParts() {
++void SqliteReferenceModel::initParts(bool dbExists) {
+ m_init = true;
+- PaletteModel::initParts();
++ PaletteModel::initParts(dbExists);
+ m_init = false;
+ }
+
+diff -urp fritzing-0.7.11b.source.orig/src/referencemodel/sqlitereferencemodel.h fritzing-0.7.11b.source/src/referencemodel/sqlitereferencemodel.h
+--- fritzing-0.7.11b.source.orig/src/referencemodel/sqlitereferencemodel.h 2013-01-08 15:46:38.461275112 -0800
++++ fritzing-0.7.11b.source/src/referencemodel/sqlitereferencemodel.h 2013-01-08 15:46:51.074671296 -0800
+@@ -41,7 +41,7 @@ class SqliteReferenceModel : public Refe
+ SqliteReferenceModel();
+ ~SqliteReferenceModel();
+
+- bool loadAll(const QString & databaseName, bool fullLoad);
++ bool loadAll(const QString & databaseName, bool fullLoad, bool dbExists);
+ bool loadFromDB(const QString & databaseName);
+ ModelPart *loadPart(const QString & path, bool update);
+ ModelPart *reloadPart(const QString & path, const QString & moduleID);
+@@ -64,7 +64,7 @@ class SqliteReferenceModel : public Refe
+ bool lastWasExactMatch();
+
+ protected:
+- void initParts();
++ void initParts(bool dbExists);
+ void killParts();
+
+ protected:
diff --git a/fritzing.spec b/fritzing.spec
index bd0ab55..cf143bb 100644
--- a/fritzing.spec
+++ b/fritzing.spec
@@ -1,6 +1,6 @@
Name: fritzing
Version: 0.7.11b
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Electronic Design Automation software; from prototype to product
Group: Applications/Engineering
@@ -15,6 +15,8 @@ Patch0: fritzing-use-external-libs.patch
Patch1: fritzing-disable-autoupdate.patch
# Build bug with relative paths in the panelizer.
Patch2: fritzing-panelizer-relative-include.patch
+# Backport of part of r6773 from upstream, to fix startup problems with missing parts.db.
+Patch3: fritzing-fix-missing-parts.patch
BuildRequires: qt4-devel qt-webkit-devel desktop-file-utils boost-devel quazip-devel minizip-devel
Requires: electronics-menu
@@ -40,6 +42,7 @@ sed -i 's/\r//' LICENSE.CC-BY-SA
%patch0 -p1 -b .ext-libs
%patch1 -p1 -b .disable-updates
%patch2 -p1 -b .panelizer-relative-include
+%patch3 -p1 -b .fix-missing-parts
%build
CXXFLAGS="%{optflags}"
@@ -69,6 +72,9 @@ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
%{_mandir}/man?/*
%changelog
+* Tue Jan 8 2013 Ed Marshall <esm at logic.net> - 0.7.11b-2
+- Backport upstream patch for gracefully handling missing parts database.
+
* Mon Jan 7 2013 Ed Marshall <esm at logic.net> - 0.7.11b-1
- Updated to 0.7.11b release.
More information about the scm-commits
mailing list