commit fdupes for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fdupes for openSUSE:Factory checked in at 2022-10-10 18:46:45 Comparing /work/SRC/openSUSE:Factory/fdupes (Old) and /work/SRC/openSUSE:Factory/.fdupes.new.2275 (New) Package is "fdupes" Mon Oct 10 18:46:45 2022 rev:33 rq:1008378 version:2.2.1 Changes: --- /work/SRC/openSUSE:Factory/fdupes/fdupes.changes2022-05-04 15:10:11.584101375 +0200 +++ /work/SRC/openSUSE:Factory/.fdupes.new.2275/fdupes.changes 2022-10-10 18:47:13.603213461 +0200 @@ -1,0 +2,11 @@ +Sun Oct 2 16:21:27 UTC 2022 - Andrea Manzini + +- update to 2.2.1: + * Fix bug in code meant to skip over the current log file when --log option is given. + * Updates to copyright notices in source code. + * Add --deferconfirmation option. + * Check that files marked as duplicates haven't changed during program execution before deleting them. + * Update documentation to indicate units for SIZE in command-line options. + * Move some configuration settings to configure.ac file. + +--- Old: fdupes-2.1.2.tar.gz New: fdupes-2.2.1.tar.gz Other differences: -- ++ fdupes.spec ++ --- /var/tmp/diff_new_pack.jhfmCo/_old 2022-10-10 18:47:14.099214539 +0200 +++ /var/tmp/diff_new_pack.jhfmCo/_new 2022-10-10 18:47:14.103214548 +0200 @@ -19,7 +19,7 @@ %{?!_rpmmacrodir:%define _rpmmacrodir /usr/lib/rpm/macros.d} Name: fdupes -Version:2.1.2 +Version:2.2.1 Release:0 Summary:Tool to identify or delete duplicate files License:MIT ++ fdupes-2.1.2.tar.gz -> fdupes-2.2.1.tar.gz ++ 3287 lines of diff (skipped)
commit fdupes for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fdupes for openSUSE:Factory checked in at 2022-05-04 15:10:10 Comparing /work/SRC/openSUSE:Factory/fdupes (Old) and /work/SRC/openSUSE:Factory/.fdupes.new.1538 (New) Package is "fdupes" Wed May 4 15:10:10 2022 rev:32 rq:970071 version:2.1.2 Changes: --- /work/SRC/openSUSE:Factory/fdupes/fdupes.changes2022-03-17 17:01:21.905679238 +0100 +++ /work/SRC/openSUSE:Factory/.fdupes.new.1538/fdupes.changes 2022-05-04 15:10:11.584101375 +0200 @@ -1,0 +2,12 @@ +Fri Apr 1 19:50:32 UTC 2022 - Stefan Br??ns + +- Fixes for the new wrapper: + * Order duplicates by name, to get a reproducible file set +(boo#1197484). + * Remove redundant order parameter from fdupes invocation. + * Modernize code, significantly reduce allocations. + * Exit immediately when mandatory parameters are missing. + * Remove obsolete buildroot parameter + * Add some tests for the wrapper + +--- Other differences: -- ++ fdupes.spec ++ --- /var/tmp/diff_new_pack.tGlN1C/_old 2022-05-04 15:10:13.404103613 +0200 +++ /var/tmp/diff_new_pack.tGlN1C/_new 2022-05-04 15:10:13.412103623 +0200 @@ -53,6 +53,26 @@ ./%{name} --recurse testdir ./%{name} --size testdir +# Check wrapper +PATH=`pwd`:$PATH +(cd testdir; md5sum ./* ./*/* > ../testdir.md5 || true) +for operation in '-n' '-s' ' '; do + cp -R testdir "testdir${operation}" + ./fdupes_wrapper ${operation} "testdir${operation}" + (cd "testdir${operation}"; md5sum --check ../testdir.md5) +done +# Check order does not depend on creation order - x should be target +mkdir testdir_order +for t in "a b x" "x a b" "a x b"; do + pushd testdir_order + for f in $t ; do cp ../testdir.md5 $f; done + ../fdupes_wrapper -s ./ + test -h ./a + test -h ./b + rm * + popd +done + %files %doc CHANGES %{_bindir}/%{name} ++ fdupes_wrapper.cpp ++ --- /var/tmp/diff_new_pack.tGlN1C/_old 2022-05-04 15:10:13.460103682 +0200 +++ /var/tmp/diff_new_pack.tGlN1C/_new 2022-05-04 15:10:13.464103687 +0200 @@ -4,19 +4,16 @@ * * Copyright 2022 Jiri Slaby * 2022 Stephan Kulow + * 2022 Stefan Br??ns * * SPDX-License-Identifier: MIT */ #include -#include #include -#include -#include #include #include #include -#include #include #include #include @@ -24,8 +21,22 @@ using namespace std; -typedef std::map> dups_map; -typedef std::pair nlink_pair; +struct file_entry +{ +ino_t inode; +nlink_t link_count; +string path; + +file_entry(ino_t i, nlink_t n, string&& p) +: inode(i), link_count(n), path(move(p)) {} +}; +using dup_set = vector; + +enum class Operation { +Symlink, +Hardlink, +DryRun, +}; vector split_paths(const string& path) { @@ -42,7 +53,7 @@ return paths; } -string merge_paths(vector paths) +string merge_paths(const vector& paths) { string path; for (const auto& s : paths) { @@ -79,33 +90,18 @@ return merge_paths(paths); } -bool cmp_nlink(const nlink_pair& a, const nlink_pair& b) -{ -return a.second > b.second; -} - -void sort_by_count(const dups_map& in, std::vector& out) -{ -out.clear(); -std::list nlinks; -for (auto it = in.cbegin(); it != in.cend(); ++it) { -nlinks.push_back(std::make_pair(it->first, it->second.size())); -} -nlinks.sort(cmp_nlink); -for (auto it = nlinks.cbegin(); it != nlinks.cend(); ++it) { -out.push_back(it->first); -} -} - -void link_file(const std::string& file, const std::string& target, bool symlink) +void link_file(const std::string& file, const std::string& target, Operation op) { std::cout << "Linking " << file << " -> " << target << std::endl; +if (op == Operation::DryRun) +return; + if (unlink(file.c_str())) { std::cerr << "Removing '" << file << "' failed." << std::endl; exit(1); } int ret; -if (symlink) { +if (op == Operation::Symlink) { ret = ::symlink(target.c_str(), file.c_str()); } else { ret = link(target.c_str(), file.c_str()); @@ -116,44 +112,65 @@ } } -std::string target_for_link(string target, const std::string , bool symlink) +std::string target_for_link(string target, const std::string , Operation op) { -if (!symlink) // hardlinks don't care +if (op == Operation::Hardlink) // hardlinks don't care return target; - + return relative(file, target); } -void handle_dups(const dups_map& dups, const std::string& buildroot, bool symlink) +void handle_dups(dup_set& dups, Operation op) { -// all are hardlinks to the same data -if
commit fdupes for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fdupes for openSUSE:Factory checked in at 2022-03-17 17:01:14 Comparing /work/SRC/openSUSE:Factory/fdupes (Old) and /work/SRC/openSUSE:Factory/.fdupes.new.25692 (New) Package is "fdupes" Thu Mar 17 17:01:14 2022 rev:31 rq:961812 version:2.1.2 Changes: --- /work/SRC/openSUSE:Factory/fdupes/fdupes.changes2020-08-23 09:18:35.826599271 +0200 +++ /work/SRC/openSUSE:Factory/.fdupes.new.25692/fdupes.changes 2022-03-17 17:01:21.905679238 +0100 @@ -1,0 +2,21 @@ +Tue Mar 15 07:41:35 UTC 2022 - Stephan Kulow + +- A more correct approach to creating symlinks (old bug actually): + Do not link the files as given by fdupes, but turn them into + relative links (it works by chance if given a buildroot, but + fails if running on a subdirectory) +- Support multiple directories given (as glob to the macro) + +--- +Mon Mar 14 13:44:54 UTC 2022 - Stephan Kulow + +- Handle symlinks (-s argument) correctly + +--- +Sat Mar 12 08:17:37 UTC 2022 - Stephan Kulow + +- Simplify macros.fdupes with a call to a C++ program that does + the same within a fraction of a second what the shell loop did + in many seconds (bsc#1195709) + +--- New: fdupes_wrapper.cpp Other differences: -- ++ fdupes.spec ++ --- /var/tmp/diff_new_pack.K5gcgh/_old 2022-03-17 17:01:22.377679598 +0100 +++ /var/tmp/diff_new_pack.K5gcgh/_new 2022-03-17 17:01:22.377679598 +0100 @@ -1,7 +1,7 @@ # # spec file for package fdupes # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,9 +12,10 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # + %{?!_rpmmacrodir:%define _rpmmacrodir /usr/lib/rpm/macros.d} Name: fdupes @@ -23,9 +24,11 @@ Summary:Tool to identify or delete duplicate files License:MIT Group: Productivity/Archiving/Compression -Url:https://github.com/adrianlopezroche/fdupes +URL:https://github.com/adrianlopezroche/fdupes Source0: https://github.com/adrianlopezroche/fdupes/releases/download/v%{version}/fdupes-%{version}.tar.gz Source1:macros.fdupes +Source2:fdupes_wrapper.cpp +BuildRequires: gcc-c++ %description FDUPES is a program for identifying or deleting duplicate files @@ -37,10 +40,12 @@ %build %configure --without-ncurses %make_build +g++ $RPM_OPT_FLAGS %{S:2} -o fdupes_wrapper %install %make_install install -D -m644 %{SOURCE1} %{buildroot}%{_rpmmacrodir}/macros.%{name} +install -D -m755 fdupes_wrapper %{buildroot}/usr/lib/rpm/fdupes_wrapper %check ./%{name} testdir @@ -53,5 +58,6 @@ %{_bindir}/%{name} %{_mandir}/man1/%{name}.1* %{_rpmmacrodir}/macros.%{name} +/usr/lib/rpm/fdupes_wrapper %changelog ++ fdupes_wrapper.cpp ++ /* * A little helper to wrap around fdupes and create hard/soft links of the * dups found. Used in openSUSE rpm. * * Copyright 2022 Jiri Slaby * 2022 Stephan Kulow * * SPDX-License-Identifier: MIT */ #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef std::map> dups_map; typedef std::pair nlink_pair; vector split_paths(const string& path) { string token; vector paths; stringstream ss(path); while (getline(ss, token, '/')) { if (token == "..") { paths.pop_back(); } else if (token != "." || ss.eof()) { paths.push_back(token); } } return paths; } string merge_paths(vector paths) { string path; for (const auto& s : paths) { if (s.empty()) continue; if (!path.empty()) path += "/"; path += s; } return path; } string relative(const string& p1, const string& p2) { vector paths1 = split_paths(p1); paths1.pop_back(); vector paths2 = split_paths(p2); vector paths; vector::const_iterator it1 = paths1.begin(); vector::const_iterator it2 = paths2.begin(); // first remove the common parts while (it1 != paths1.end() && *it1 == *it2) { it1++; it2++;