Use predictable and reproducible filenames (rhbz#2000138)

This commit is contained in:
Mattias Ellert 2021-09-13 16:43:50 +02:00
parent 79be305ff0
commit 5671b82de3
2 changed files with 117 additions and 1 deletions

View File

@ -10,7 +10,7 @@ Summary: A documentation system for C/C++
Name: doxygen
Epoch: 1
Version: 1.9.2
Release: 1%{?dist}
Release: 2%{?dist}
# No version is specified.
License: GPL+
@ -21,6 +21,7 @@ Source1: doxywizard.desktop
# these icons are part of doxygen and converted from doxywizard.ico
Source2: doxywizard-icons.tar.xz
# upstream patches
Patch0: predictable-and-reproducible-filenames.patch
BuildRequires: %{_bindir}/python3
BuildRequires: gcc-c++ gcc
@ -294,6 +295,9 @@ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
%endif
%changelog
* Sun Sep 12 2021 Mattias Ellert <mattias.ellert@physics.uu.se> - 1:1.9.2-2
- Use predictable and reproducible filenames (rhbz#2000138)
* Thu Aug 19 2021 Than Ngo <than@redhat.com> - 1:1.9.2-1
- rebase to 1.9.2

View File

@ -0,0 +1,112 @@
diff -ur doxygen-1.9.2.orig/src/dirdef.cpp doxygen-1.9.2/src/dirdef.cpp
--- doxygen-1.9.2.orig/src/dirdef.cpp 2021-08-17 19:10:43.000000000 +0200
+++ doxygen-1.9.2/src/dirdef.cpp 2021-09-12 21:25:51.878853938 +0200
@@ -47,7 +47,7 @@
virtual bool isLinkableInProject() const;
virtual bool isLinkable() const;
virtual QCString displayName(bool=TRUE) const { return m_dispName; }
- virtual const QCString &shortName() const { return m_shortName; }
+ virtual const QCString shortName() const { return m_shortName; }
virtual void addSubDir(DirDef *subdir);
virtual const FileList &getFiles() const { return m_fileList; }
virtual void addFile(const FileDef *fd);
@@ -66,6 +66,7 @@
virtual void setDiskName(const QCString &name) { m_diskName = name; }
virtual void sort();
virtual void setParent(DirDef *parent);
+ virtual void setDirCount(int count);
virtual void setLevel();
virtual void addUsesDependency(const DirDef *usedDir,const FileDef *srcFd,
const FileDef *dstFd,bool inherited);
@@ -92,7 +93,7 @@
QCString m_shortName;
QCString m_diskName;
FileList m_fileList; // list of files in the group
- int m_dirCount;
+ int m_dirCount = -1;
int m_level;
DirDef *m_parent;
UsedDirLinkedMap m_usedDirs;
@@ -107,8 +108,6 @@
//----------------------------------------------------------------------
// method implementation
-static int g_dirCount=0;
-
DirDefImpl::DirDefImpl(const QCString &path) : DefinitionMixin(path,1,1,path)
{
bool fullPathNames = Config_getBool(FULL_PATH_NAMES);
@@ -132,7 +131,6 @@
m_dispName = m_dispName.left(m_dispName.length()-1);
}
- m_dirCount = g_dirCount++;
m_level=-1;
m_parent=0;
}
@@ -163,6 +161,11 @@
m_parent=p;
}
+void DirDefImpl::setDirCount(int count)
+{
+ m_dirCount=count;
+}
+
void DirDefImpl::addFile(const FileDef *fd)
{
m_fileList.push_back(fd);
@@ -993,7 +996,6 @@
{
for (const auto &fd : *fn)
{
- //printf("buildDirectories %s\n",qPrint(fd->name()));
if (fd->getReference().isEmpty())
{
DirDef *dir;
@@ -1038,7 +1040,24 @@
std::sort(Doxygen::dirLinkedMap->begin(),
Doxygen::dirLinkedMap->end(),
[](const auto &d1,const auto &d2)
- { return qstricmp(d1->shortName(),d2->shortName()) < 0; });
+ {
+ QCString s1 = d1->shortName(), s2 = d2->shortName();
+ int i = qstricmp(s1,s2);
+ if (i==0) // if sort name are equal, sort on full path
+ {
+ QCString n1 = d1->name(), n2 = d2->name();
+ int n = qstricmp(n1,n2);
+ return n < 0;
+ }
+ return i < 0;
+ });
+
+ // set the directory count identifier
+ int dirCount=0;
+ for (const auto &dir : *Doxygen::dirLinkedMap)
+ {
+ dir->setDirCount(dirCount++);
+ }
computeCommonDirPrefix();
}
diff -ur doxygen-1.9.2.orig/src/dirdef.h doxygen-1.9.2/src/dirdef.h
--- doxygen-1.9.2.orig/src/dirdef.h 2021-05-12 20:51:20.000000000 +0200
+++ doxygen-1.9.2/src/dirdef.h 2021-09-12 21:25:42.394830066 +0200
@@ -95,7 +95,7 @@
virtual bool isLinkableInProject() const = 0;
virtual bool isLinkable() const = 0;
virtual QCString displayName(bool=TRUE) const = 0;
- virtual const QCString &shortName() const = 0;
+ virtual const QCString shortName() const = 0;
virtual void addSubDir(DirDef *subdir) = 0;
virtual const FileList &getFiles() const = 0;
virtual void addFile(const FileDef *fd) = 0;
@@ -115,6 +115,7 @@
virtual void writeTagFile(TextStream &t) = 0;
virtual void setDiskName(const QCString &name) = 0;
+ virtual void setDirCount(int count) = 0;
virtual void sort() = 0;
virtual void setParent(DirDef *parent) = 0;
virtual void setLevel() = 0;