diff --git a/.clang-format b/.clang-format
index c893e7c..b90b55e 100644
--- a/.clang-format
+++ b/.clang-format
@@ -33,7 +33,7 @@ ColumnLimit: '0'
CompactNamespaces: 'false'
Language: Cpp
PointerAlignment: Left
-SortIncludes: 'false'
+SortIncludes: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeInheritanceColon: 'false'
SpaceBeforeParens: ControlStatements
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4b24abc..74c28cf 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,18 +1,12 @@
-# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
-# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: Build
on: [push, pull_request]
env:
- # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
- BUILD_TYPE: Release
+ BUILD_TYPE: release
jobs:
build:
- # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
- # You can convert this to a matrix build if you need cross-platform coverage.
- # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
@@ -25,16 +19,14 @@ jobs:
- name: "Install dependencies"
run: |
sudo apt -y update
- sudo apt -y install libgtk-3-dev libalpm-dev libarchive-dev libcurl4-openssl-dev libgpgme-dev
+ sudo apt -y install meson libgtk-3-dev libalpm-dev libarchive-dev libcurl4-openssl-dev libgpgme-dev
- - name: Configure CMake
- # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
- # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
- run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
+ - name: Configure
+ run: meson setup build -Dtracy_enable=false -Dbuildtype=${{env.BUILD_TYPE}}
- name: Build
# Build your program with the given configuration
- run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
+ run: meson compile -C build
- name: Set Build number
shell: bash
@@ -49,8 +41,10 @@ jobs:
run: |
mkdir artifacts
cp build/pepv artifacts/
- cp pepv.ui artifacts/
- cp pepv.png artifacts/
+ cp data/pepv.ui artifacts/
+ cp data/pepv.desktop artifacts/
+ cp data/icons/pepv.png artifacts/
+ cp data/icons/sizes/* artifacts/
- name: Upload artifacts
diff --git a/.gitignore b/.gitignore
index 2ae69bc..49d1ebc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,9 @@
.vscode
.idea
+subprojects/*/
+subprojects/.wraplock
+subprojects/*/**
compile_commands.json
build/
.cache
@@ -9,4 +12,4 @@ build/
*.gui~
*.gui#
*.ui~
-*.ui#
\ No newline at end of file
+*.ui#
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index a458404..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "external/tracy"]
- path = external/tracy
- url = https://github.com/wolfpld/tracy.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 7039d99..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-cmake_minimum_required(VERSION 3.10.0)
-
-set(CMAKE_CXX_STANDARD 20)
-
-project(pepv VERSION 0.1.0 LANGUAGES C CXX)
-
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
-
-if(CMAKE_BUILD_TYPE STREQUAL "Release")
- file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/pepv.ui" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-endif()
-
-message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
-
-option(TRACY_ENABLE "" ON)
-option(TRACY_ON_DEMAND "" ON)
-add_subdirectory(external/tracy)
-
-find_package(PkgConfig REQUIRED)
-pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
-
-include_directories(${GTK3_INCLUDE_DIRS})
-link_directories(${GTK3_LIBRARY_DIRS})
-
-# Add other flags to the compiler
-add_definitions(${GTK3_CFLAGS_OTHER})
-
-# libalpm
-find_package(PkgConfig REQUIRED)
-pkg_check_modules(ALPM REQUIRED libalpm)
-
-set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
-
-add_executable(pepv src/main.cpp src/pkgs.cpp src/utils.cpp src/events.cpp)
-
-
-if(CMAKE_BUILD_TYPE STREQUAL "Release")
- include(CheckIPOSupported)
- check_ipo_supported(RESULT supported OUTPUT error)
-
- if(supported)
- message(STATUS "IPO / LTO enabled")
- set_property(TARGET pepv PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
- else()
- message(STATUS "IPO / LTO not supported: <${error}>")
- endif()
-endif()
-
-target_link_libraries(pepv PRIVATE ${GTK3_LIBRARIES} Tracy::TracyClient ${ALPM_LIBRARIES})
diff --git a/README.md b/README.md
index ee963f9..1aeda7b 100644
--- a/README.md
+++ b/README.md
@@ -17,30 +17,39 @@
* No installing packages
* No updating packages
* Only support for `core`, `extra` and `multilib` repositories
+ * Also supports viewing AUR/locally built packages
## Why?
* Because i want this program only to work as a viewer, everything regarding actually messing with your system should be in your own hands with you knowing what you are doing instead of me deciding what packages stay and go blindly
+# Installing
+* AUR: https://aur.archlinux.org/packages/pepv-git
+
+
# Building
+## Requirements
+* Meson (1.1 or higher)
+* git
+## Instructions
* git clone this repository
-* Open a terminal in the directory of the repo and run the next commands
-* `mkdir build && cd build`
-* `cmake ..`
-* `cmake --build . --config Release`
-* pepv needs the files `pepv.ui` and `pepv.png` to be somewhere it can find them together, list of paths is in order
- * `../pepv.ui` Only in debug build for debug purposes
- * `pepv.ui`
+* Open a terminal in the directory of the repo and run the next commands for a release build
+* `meson setup build -Dtracy_enable=false -Dbuildtype=release`
+* `meson compile -C build`
+* `meson install -C build --skip-subprojects` To install locally using built binary, this also includes:
+ * Desktop entry
+ * Icons
+ * README.md in doc
+ * UI file
+* pepv will also look for `pepv.ui` in other paths, list of paths is in order
+ * `../data/pepv.ui` Only in debug build for debug purposes
+ * `PREFIX "/" DATADIR "/pepv/pepv.ui"` (PREFIX and DATADIR may be set by meson options for packaging purposes)
* `/usr/share/pepv/pepv.ui`
+ * `/usr/local/share/pepv/pepv.ui`
* `/app/share/pepv/pepv.ui`
* `/app/share/runtime/share/pepv/pepv.ui`
* `/run/host/user-share/pepv/pepv.ui`
* `/run/host/share/pepv/pepv.ui`
-* If you want you can also resize the logo to multiple resolutions and put the images in `usr/share/icons/hicolor/SIZExSIZE/apps/pepv.png` so GTK chooses the correct resolution automatically
-
-# I dont know how to code but i want to use this program.
+# I dont know how to code but i want to use this program in a distro that doesnt have AUR.
* Follow the instructions above, you dont need to understand them
-* If you are scared of basic computer usage then you can wait for someone to package this program in your arch-based distro and i may add it in this readme
-
-# Installing
-* AUR: https://aur.archlinux.org/packages/pepv-git
+* If you are scared of basic computer usage then you can wait for someone to package this program in your distro and i may add it in this README or you can just open a new issue to ask for help
diff --git a/pepv.png b/data/icons/pepv.png
similarity index 100%
rename from pepv.png
rename to data/icons/pepv.png
diff --git a/data/icons/sizes/pepv-1024.png b/data/icons/sizes/pepv-1024.png
new file mode 100644
index 0000000..308d345
Binary files /dev/null and b/data/icons/sizes/pepv-1024.png differ
diff --git a/data/icons/sizes/pepv-128.png b/data/icons/sizes/pepv-128.png
new file mode 100644
index 0000000..5e1e8f0
Binary files /dev/null and b/data/icons/sizes/pepv-128.png differ
diff --git a/data/icons/sizes/pepv-16.png b/data/icons/sizes/pepv-16.png
new file mode 100644
index 0000000..79e680e
Binary files /dev/null and b/data/icons/sizes/pepv-16.png differ
diff --git a/data/icons/sizes/pepv-22.png b/data/icons/sizes/pepv-22.png
new file mode 100644
index 0000000..57e1ff3
Binary files /dev/null and b/data/icons/sizes/pepv-22.png differ
diff --git a/data/icons/sizes/pepv-24.png b/data/icons/sizes/pepv-24.png
new file mode 100644
index 0000000..f549ee5
Binary files /dev/null and b/data/icons/sizes/pepv-24.png differ
diff --git a/data/icons/sizes/pepv-256.png b/data/icons/sizes/pepv-256.png
new file mode 100644
index 0000000..df60ab0
Binary files /dev/null and b/data/icons/sizes/pepv-256.png differ
diff --git a/data/icons/sizes/pepv-32.png b/data/icons/sizes/pepv-32.png
new file mode 100644
index 0000000..2982f91
Binary files /dev/null and b/data/icons/sizes/pepv-32.png differ
diff --git a/data/icons/sizes/pepv-36.png b/data/icons/sizes/pepv-36.png
new file mode 100644
index 0000000..01a00cc
Binary files /dev/null and b/data/icons/sizes/pepv-36.png differ
diff --git a/data/icons/sizes/pepv-48.png b/data/icons/sizes/pepv-48.png
new file mode 100644
index 0000000..987c998
Binary files /dev/null and b/data/icons/sizes/pepv-48.png differ
diff --git a/data/icons/sizes/pepv-512.png b/data/icons/sizes/pepv-512.png
new file mode 100644
index 0000000..6cd0b73
Binary files /dev/null and b/data/icons/sizes/pepv-512.png differ
diff --git a/data/icons/sizes/pepv-64.png b/data/icons/sizes/pepv-64.png
new file mode 100644
index 0000000..7d671f5
Binary files /dev/null and b/data/icons/sizes/pepv-64.png differ
diff --git a/data/icons/sizes/pepv-72.png b/data/icons/sizes/pepv-72.png
new file mode 100644
index 0000000..8deecfd
Binary files /dev/null and b/data/icons/sizes/pepv-72.png differ
diff --git a/data/icons/sizes/pepv-96.png b/data/icons/sizes/pepv-96.png
new file mode 100644
index 0000000..04762eb
Binary files /dev/null and b/data/icons/sizes/pepv-96.png differ
diff --git a/data/pepv.desktop b/data/pepv.desktop
new file mode 100644
index 0000000..bd91eeb
--- /dev/null
+++ b/data/pepv.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Categories=System;
+Name=pepv
+Icon=pepv
+Exec=pepv
+Terminal=false
diff --git a/pepv.ui b/data/pepv.ui
similarity index 97%
rename from pepv.ui
rename to data/pepv.ui
index 3870ae1..dfcad5d 100644
--- a/pepv.ui
+++ b/data/pepv.ui
@@ -28,6 +28,8 @@
+
+
diff --git a/external/tracy b/external/tracy
deleted file mode 160000
index c556831..0000000
--- a/external/tracy
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit c556831ddc6fe26d2fce01c14c97205a9dad46d5
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..73b2f01
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,68 @@
+project(
+ 'pepv',
+ 'c',
+ 'cpp',
+ default_options: ['c_std=c18', 'cpp_std=c++20'],
+ meson_version: '>=1.1',
+)
+
+# TODO: Add versioning
+
+if get_option('buildtype') == 'debug'
+ add_project_arguments('-DDEBUG', language: 'cpp')
+endif
+
+threads = dependency('threads')
+gtk = dependency('gtk+-3.0')
+libalpm = dependency('libalpm')
+tracy = dependency('tracy')
+
+message('prefix: ' + get_option('prefix'))
+message('datadir: ' + get_option('datadir'))
+message('buildtype: ' + get_option('buildtype'))
+
+if get_option('tracy_enable') and get_option('buildtype') != 'debugoptimized'
+ warning('Profiling builds should set -- buildtype = debugoptimized')
+endif
+
+executable(
+ 'pepv',
+ ['src/events.cpp', 'src/main.cpp', 'src/pkgs.cpp', 'src/utils.cpp'],
+ dependencies: [threads, gtk, libalpm, tracy],
+ export_dynamic: true, # GTK needs this
+ cpp_args: [
+ '-DPROJECTNAME="' + meson.project_name() + '"',
+ '-DPREFIX="' + get_option('prefix') + '"',
+ '-DDATADIR="' + get_option('datadir') + '"',
+ '-Werror',
+ ],
+ install: true,
+)
+
+install_data('data/pepv.ui')
+
+install_data(
+ 'data/pepv.desktop',
+ install_dir: get_option('prefix') / get_option('datadir') / 'applications',
+)
+
+install_data(
+ 'README.md',
+ install_dir: get_option('prefix') / get_option('datadir') / 'doc' / meson.project_name(),
+)
+
+install_data(
+ 'LICENSE',
+ rename: 'COPYING',
+ install_dir: get_option('prefix') / get_option('datadir') / 'licenses' / meson.project_name(),
+)
+
+# TODO: better install dir for this to make desktop and gtk icons work on debug builds/uninstalled tests
+foreach size : [16, 22, 24, 32, 36, 48, 64, 72, 96, 128, 256, 512, 1024]
+ install_data(
+ 'data/icons/sizes/pepv-@0@.png'.format(size),
+ install_dir: get_option('prefix') / get_option('datadir') / 'icons/hicolor/@0@x@0@/apps/'.format(size),
+ rename: meson.project_name() + '.png',
+ install_mode: 'rw-r--r--',
+ )
+endforeach
diff --git a/meson.options b/meson.options
new file mode 100644
index 0000000..ca1d5b6
--- /dev/null
+++ b/meson.options
@@ -0,0 +1 @@
+option('tracy_enable', type: 'boolean', value: true, description: 'Enable profiling')
diff --git a/src/events.cpp b/src/events.cpp
index 020782f..7e7ee8d 100644
--- a/src/events.cpp
+++ b/src/events.cpp
@@ -3,16 +3,20 @@
#include "pkgs.hpp"
#include "utils.hpp"
+#include
#include
+#include
#include
std::string selected;
void updatePkgInfo() {
- ZoneScopedN("updatePkgInfo");
+ ZoneNamedN(___tracy_updatePkgInfo, "updatePkgInfo", true);
+#ifdef TRACY_ENABLE
const std::string tracyArgs = "Package: " + selected;
- ___tracy_scoped_zone.Text(tracyArgs.c_str(), tracyArgs.size());
+ ___tracy_updatePkgInfo.Text(tracyArgs.c_str(), tracyArgs.size());
+#endif
static auto gPkgInfo = GTK_TEXT_VIEW(gtk_builder_get_object(builder, "pkgInfo"));
static auto infoBuffer = gtk_text_view_get_buffer(gPkgInfo);
@@ -41,8 +45,8 @@ void updatePkgInfo() {
infoss << "Build date: " << bdss.c_str() << std::endl;
}
if (pkg.installDate.has_value()) {
- auto idss = formattedTimestamp(pkg.installDate.value());
- infoss << "Install date: " << idss.c_str() << std::endl;
+ auto installDatess = formattedTimestamp(pkg.installDate.value());
+ infoss << "Install date: " << installDatess.c_str() << std::endl;
}
if (pkg.packager.has_value())
infoss << "Packager: " << pkg.packager.value() << std::endl;
@@ -101,9 +105,11 @@ void updatePkgInfo() {
}
void updatePkgFiles() {
- ZoneScopedN("updatePkgFiles");
+ ZoneNamedN(___tracy_updatePkgFiles, "updatePkgFiles", true);
+#ifdef TRACY_ENABLE
const std::string tracyArgs = "Package: " + selected;
- ___tracy_scoped_zone.Text(tracyArgs.c_str(), tracyArgs.size());
+ ___tracy_updatePkgFiles.Text(tracyArgs.c_str(), tracyArgs.size());
+#endif
static auto gPkgFiles = GTK_TEXT_VIEW(gtk_builder_get_object(builder, "pkgFiles"));
static auto filesBuffer = gtk_text_view_get_buffer(gPkgFiles);
@@ -114,9 +120,11 @@ void updatePkgFiles() {
}
void updatePkgBackupFiles() {
- ZoneScopedN("updatePkgBackupFiles");
+ ZoneNamedN(___tracy_updatePkgBackupFiles, "updatePkgBackupFiles", true);
+#ifdef TRACY_ENABLE
const std::string tracyArgs = "Package: " + selected;
- ___tracy_scoped_zone.Text(tracyArgs.c_str(), tracyArgs.size());
+ ___tracy_updatePkgBackupFiles.Text(tracyArgs.c_str(), tracyArgs.size());
+#endif
static auto gPkgBackup = GTK_TREE_STORE(gtk_builder_get_object(builder, "backupFilesStore"));
gtk_tree_store_clear(gPkgBackup);
@@ -132,7 +140,7 @@ void updatePkgBackupFiles() {
bool populationIsHappening = false;
void populatePkgList() {
- ZoneScopedN("populatePkgList");
+ ZoneNamedN(___tracy_populatePkgList, "populatePkgList", true);
static const auto selection = GTK_TREE_SELECTION(gtk_builder_get_object(builder, "select"));
static const auto treeStore = GTK_TREE_STORE(gtk_builder_get_object(builder, "treeStore"));
@@ -169,6 +177,7 @@ void populatePkgList() {
GtkTreeIter iter;
+ assert(populationIsHappening == false); // This triggering means population ran twice, so performance is lost
populationIsHappening = true;
gtk_tree_selection_unselect_all(selection);
@@ -184,8 +193,10 @@ void populatePkgList() {
for (auto& e : names) {
ZoneNamedN(_tracy_zone_populate_package, "populate package", true);
+#ifdef TRACY_ENABLE
const std::string tracyArgs = "Package: " + e;
_tracy_zone_populate_package.Text(tracyArgs.c_str(), tracyArgs.size());
+#endif
const auto pkgDescRes = p->getDescriptionForPackage(e);
if (!pkgDescRes.first) {
std::cout << "Couldnt get description for pkg: " << e << std::endl;
@@ -233,6 +244,7 @@ void populatePkgList() {
COL_LIST_SIZE, pkg.size.value_or(0),
COL_LIST_FILES, files,
COL_LIST_REPO, repo.data(),
+ COL_LIST_REQBY, pkg.requiredBy.size(),
-1);
shownCount++;
shownSize += pkg.size.value_or(0);
@@ -266,7 +278,7 @@ void populatePkgList() {
extern "C" {
void on_reload_button_clicked(GtkButton* b) {
- ZoneScopedN("on_reload_button_clicked");
+ ZoneNamedN(___tracy_on_reload_button_clicked, "on_reload_button_clicked", true);
p->uninit();
p->init();
@@ -275,7 +287,7 @@ void on_reload_button_clicked(GtkButton* b) {
}
void on_select_changed(GtkWidget* c) {
- ZoneScopedN("on_select_changed");
+ ZoneNamedN(___tracy_on_select_changed, "on_select_changed", true);
if (populationIsHappening) return; // Even when there is nothing selected this function will still be called, dont want that
gchar* value;
GtkTreeIter iter;
@@ -298,7 +310,7 @@ void on_select_changed(GtkWidget* c) {
}
void on_applyFilters_clicked(GtkButton* c) {
- ZoneScopedN("on_applyFilters_clicked");
+ ZoneNamedN(___tracy_on_applyFilters_clicked, "on_applyFilters_clicked", true);
populatePkgList();
}
}
diff --git a/src/events.hpp b/src/events.hpp
index c58326c..633f765 100644
--- a/src/events.hpp
+++ b/src/events.hpp
@@ -1,5 +1,6 @@
#pragma once
#include "pkgs.hpp"
+
#include
extern GtkBuilder* builder;
diff --git a/src/main.cpp b/src/main.cpp
index ccd111e..d728350 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,40 +1,43 @@
-#include "pkgs.hpp"
#include "events.hpp"
+#include "pkgs.hpp"
+#include
+#include
#include
#include
-GtkBuilder* builder;
+GtkBuilder* builder = 0;
Pkgs* p;
int main(int argc, char** argv) {
ZoneScoped;
- p = new Pkgs();
-
gtk_init(&argc, &argv);
constexpr const std::array uiPaths = {
-#ifndef NDEBUG
- "../pepv.ui",
+#ifdef DEBUG
+ "../data/" PROJECTNAME ".ui",
+ "./data/" PROJECTNAME ".ui",
#endif
- "pepv.ui",
- "/usr/share/pepv/pepv.ui",
- "/app/share/pepv/pepv.ui",
- "/app/share/runtime/share/pepv/pepv.ui",
- "/run/host/user-share/pepv/pepv.ui",
- "/run/host/share/pepv/pepv.ui",
+ PREFIX "/" DATADIR "/" PROJECTNAME "/" PROJECTNAME ".ui",
+ "/usr/share/" PROJECTNAME "/" PROJECTNAME ".ui",
+ "/usr/local/share/" PROJECTNAME "/" PROJECTNAME ".ui",
+ "/app/share/" PROJECTNAME "/" PROJECTNAME ".ui",
+ "/app/share/runtime/share/" PROJECTNAME "/" PROJECTNAME ".ui",
+ "/run/host/user-share/" PROJECTNAME "/" PROJECTNAME ".ui",
+ "/run/host/share/" PROJECTNAME "/" PROJECTNAME ".ui",
};
for (auto& f : uiPaths) {
if (fs::exists(f)) {
-#ifndef NDEBUG
+#ifdef DEBUG
std::cout << "Using UI file: " << f << std::endl;
#endif
builder = gtk_builder_new_from_file(f);
break;
}
}
+
if (!builder) {
std::cerr << "UI file not found. Exiting" << std::endl;
return 1;
@@ -46,6 +49,7 @@ int main(int argc, char** argv) {
gtk_builder_connect_signals(builder, NULL);
+ p = new Pkgs();
p->init();
populatePkgList();
diff --git a/src/pkgs.cpp b/src/pkgs.cpp
index 7e00280..46279fe 100644
--- a/src/pkgs.cpp
+++ b/src/pkgs.cpp
@@ -1,12 +1,14 @@
#include "pkgs.hpp"
#include
+#include
#include
+#include
+#include
#include
#include
-#include
#include
void Pkgs::init() {
@@ -35,8 +37,7 @@ void Pkgs::initDescriptions() {
{
ZoneNamedN(___tracy_pkg_pacman, "Initialize alpm and dbs", true);
- alpm_errno_t alpmErr = ALPM_ERR_OK;
- auto handle = alpm_initialize("/", "/var/lib/pacman/", nullptr);
+ auto handle = alpm_initialize("/", "/var/lib/pacman/", nullptr);
for (auto [repoId, repoName] : Repositories) {
alpm_db_t* db = alpm_register_syncdb(handle, repoName.data(), ALPM_DB_USAGE_SEARCH);
@@ -49,8 +50,10 @@ void Pkgs::initDescriptions() {
ZoneNamedN(___tracy_pkg_paths, "get package paths", true);
for (const auto& entry : fs::directory_iterator(this->dbPath)) {
ZoneNamedN(___tracy_pkg_path, "get package path", true);
+#ifdef TRACY_ENABLE
const auto tracyArgs = "Path: " + entry.path().string();
___tracy_pkg_path.Text(tracyArgs.c_str(), tracyArgs.length());
+#endif
if (!entry.is_directory()) continue;
auto entryPath = entry.path();
@@ -64,8 +67,10 @@ void Pkgs::initDescriptions() {
ZoneNamedN(___tracy_get_descs, "get package descriptions", true);
for (const auto& path : tempPkgsPaths) {
ZoneNamedN(___tracy_get_descs_pkg, "get package description", true);
+#ifdef TRACY_ENABLE
const auto tracyArgs = "Path: " + path.string();
___tracy_get_descs_pkg.Text(tracyArgs.c_str(), tracyArgs.length());
+#endif
auto currentSection = SECTION_DESC_NONE;
const auto descPath = this->dbPath / path / "desc";
@@ -187,8 +192,10 @@ void Pkgs::initDescriptions() {
{
ZoneNamedN(___tracy_get_pkg_repo, "get package repository", true);
+#ifdef TRACY_ENABLE
const auto tracyArgs = "pkg: " + pkg.name;
___tracy_get_pkg_repo.Text(tracyArgs.c_str(), tracyArgs.length());
+#endif
for (auto [repoId, db] : repos) {
auto pkgFound = alpm_db_get_pkg(db, pkg.name.c_str());
if (pkgFound) {
@@ -207,8 +214,10 @@ void Pkgs::initDescriptions() {
ZoneNamedN(___tracy_fill_deps, "Fill package required by", true);
for (auto& pkg : descriptions) {
ZoneNamedN(___tracy_get_req_by_pkg, "Complete packages that depend on", true);
+#ifdef TRACY_ENABLE
const auto tracyArgs = "Pkg: " + pkg.first;
___tracy_get_req_by_pkg.Text(tracyArgs.c_str(), tracyArgs.length());
+#endif
for (auto& dep : pkg.second.depends) {
if (descriptions.contains(dep))
descriptions.at(dep).requiredBy.insert(pkg.first);
@@ -227,8 +236,10 @@ void Pkgs::initFiles() {
for (const auto& [name, path] : pkgPaths) {
ZoneNamedN(___tracy_get_files_pkg, "get package files", true);
+#ifdef TRACY_ENABLE
const auto tracyArgs = "Name: " + name;
___tracy_get_files_pkg.Text(tracyArgs.c_str(), tracyArgs.length());
+#endif
auto currentSection = SECTION_FILES_NONE;
const auto filesPath = this->dbPath / path / "files";
@@ -289,8 +300,10 @@ const std::set Pkgs::getPackagesNames() {
const std::pair Pkgs::getDescriptionForPackage(const std::string& pkg) {
ZoneScopedN("Pkgs::getDescriptionForPackage");
+#ifdef TRACY_ENABLE
const std::string tracyArgs = "Pkg: " + pkg;
___tracy_scoped_zone.Text(tracyArgs.c_str(), tracyArgs.length());
+#endif
if (!inited) return {false, {}};
if (descriptions.contains(pkg))
return {true, descriptions.at(pkg)};
@@ -299,8 +312,10 @@ const std::pair Pkgs::getDescriptionForPackage(const s
}
const std::set Pkgs::getFilesForPackage(const std::string& pkg) {
ZoneScopedN("Pkgs::getFilesForPackage");
+#ifdef TRACY_ENABLE
const std::string tracyArgs = "Pkg: " + pkg;
___tracy_scoped_zone.Text(tracyArgs.c_str(), tracyArgs.length());
+#endif
if (!inited) return {};
if (files.contains(pkg))
return files.at(pkg);
@@ -310,8 +325,10 @@ const std::set Pkgs::getFilesForPackage(const std::string& pkg) {
const std::map Pkgs::getBackupFilesForPackage(const std::string& pkg) {
ZoneScopedN("Pkgs::getBackupFilesForPackage()");
+#ifdef TRACY_ENABLE
const std::string tracyArgs = "Pkg: " + pkg;
___tracy_scoped_zone.Text(tracyArgs.c_str(), tracyArgs.length());
+#endif
if (!inited) return {};
if (backupFiles.contains(pkg))
return backupFiles.at(pkg);
diff --git a/src/pkgs.hpp b/src/pkgs.hpp
index f802a8d..5939dc6 100644
--- a/src/pkgs.hpp
+++ b/src/pkgs.hpp
@@ -1,9 +1,9 @@
#pragma once
+#include
#include