Skip to content

Commit

Permalink
Update to Nix 2.19
Browse files Browse the repository at this point in the history
Flake lock file updates:

• Updated input 'nix':
    'https://api.flakehub.com/f/pinned/NixOS/nix/2.17.0/018a1daf-2c87-7730-8fc0-4885c5d8eff7/source.tar.gz?narHash=sha256-QMYAkdtU%2Bg9HlZKtoJ%2BAI6TbWzzovKGnPZJHfZdclc8%3D'
  → 'https://api.flakehub.com/f/pinned/NixOS/nix/2.19.2/018c1be0-1b88-7682-b3bf-948ec82d0a0b/source.tar.gz?narHash=sha256-iA8DqS%2BW2fWTfR%2BnNJSvMHqQ%2B4NpYMRT3b%2B2zS6JTvE%3D' (2023-11-27)
• Updated input 'nix/nixpkgs':
    'github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b' (2023-07-03)
  → 'github:NixOS/nixpkgs/9eb24edd6a0027fed010ccfe300a9734d029983c' (2023-11-01)
  • Loading branch information
edolstra committed Jan 12, 2024
1 parent b0cea64 commit 9861d09
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ dwarffs: dwarffs.o
g++ -g $^ -o $@ -lfuse -pthread -lnixutil -lnixmain -lnixstore

%.o: %.cc
g++ -c -g -std=c++17 -Wall -Os $< -o $@
g++ -c -g -std=c++20 -Wall -Os $< -o $@
24 changes: 13 additions & 11 deletions dwarffs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
#include <cstring>
#include <regex>

#include "util.hh"
#include "logging.hh"
#include "shared.hh"
#include "filetransfer.hh"
#include "archive.hh"
#include "compression.hh"
#include "fs-accessor.hh"
#include "nar-accessor.hh"
#include "sync.hh"
#include "environment-variables.hh"
#include "users.hh"

#include <sys/types.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -206,31 +208,31 @@ std::shared_ptr<DebugFile> haveDebugFileUncached(const std::string & buildId, bo

auto accessor = makeNarAccessor(std::move(res.data));

std::function<void(const Path &)> doPath;
std::function<void(const CanonPath &)> doPath;

std::regex debugFileRegex("^/lib/debug/\\.build-id/[0-9a-f]{2}/[0-9a-f]{38}\\.debug$");
std::string debugFilePrefix = "/lib/debug/.build-id/";

doPath = [&](const Path & curPath) {
auto st = accessor->stat(curPath);
doPath = [&](const CanonPath & curPath) {
auto st = accessor->lstat(curPath);

if (st.type == FSAccessor::Type::tDirectory) {
for (auto & name : accessor->readDirectory(curPath))
doPath(curPath + "/" + name);
if (st.type == SourceAccessor::Type::tDirectory) {
for (auto & [name, type] : accessor->readDirectory(curPath))
doPath(curPath + name);
}

else if (st.type == FSAccessor::Type::tRegular && std::regex_match(curPath, debugFileRegex)) {
else if (st.type == SourceAccessor::Type::tRegular && std::regex_match(curPath.abs(), debugFileRegex)) {
std::string buildId2 =
std::string(curPath, debugFilePrefix.size(), 2) +
std::string(curPath, debugFilePrefix.size() + 3, 38);
curPath.abs().substr(debugFilePrefix.size(), 2) +
curPath.abs().substr(debugFilePrefix.size() + 3, 38);

debug("got ELF debug info file for %s from NAR at '%s'", buildId2, uri);

writeFile(cacheDir + "/" + buildId2, accessor->readFile(curPath));
}
};

doPath("");
doPath(CanonPath::root);

/* Check if we actually got the debug info file we
want. */
Expand Down
19 changes: 10 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
description = "A filesystem that fetches DWARF debug info from the Internet on demand";

inputs.nix.url = "https://flakehub.com/f/NixOS/nix/2.17.0.tar.gz";
inputs.nix.url = "https://flakehub.com/f/NixOS/nix/2.19.0.tar.gz";
inputs.nixpkgs.follows = "nix/nixpkgs";

outputs = { self, nix, nixpkgs }:
Expand Down

0 comments on commit 9861d09

Please sign in to comment.