Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package snapper for openSUSE:Factory checked in at 2023-01-10 14:59:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/snapper (Old) and /work/SRC/openSUSE:Factory/.snapper.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "snapper" Tue Jan 10 14:59:11 2023 rev:145 rq:1057018 version:0.10.4 Changes: -------- --- /work/SRC/openSUSE:Factory/snapper/snapper.changes 2022-12-24 14:51:59.919529070 +0100 +++ /work/SRC/openSUSE:Factory/.snapper.new.32243/snapper.changes 2023-01-10 14:59:24.589077707 +0100 @@ -1,0 +2,11 @@ +Tue Dec 27 13:20:38 UTC 2022 - Ludwig Nussel <lnus...@suse.com> + +- Replace transitional %usrmerged macro with regular version check + (boo#1206798) + +------------------------------------------------------------------- +Thu Dec 22 09:03:33 CET 2022 - aschn...@suse.com + +- call generic plugins before and after the action + +------------------------------------------------------------------- Old: ---- snapper-Debian_9.0.dsc snapper-xUbuntu_17.04.dsc snapper-xUbuntu_17.10.dsc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ snapper.spec ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:26.969090447 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:26.977090489 +0100 @@ -22,7 +22,7 @@ %endif # Location for PAM module -%if 0%{?usrmerged} +%if 0%{?suse_version} >= 1550 %define pam_security_dir %{_libdir}/security %else %define pam_security_dir /%{_lib}/security ++++++ debian.tar.gz ++++++ ++++++ snapper-0.10.4.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/LIBVERSION new/snapper-0.10.4/LIBVERSION --- old/snapper-0.10.4/LIBVERSION 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/LIBVERSION 2023-01-04 15:44:48.000000000 +0100 @@ -1 +1 @@ -6.1.0 +6.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/Makefile.am new/snapper-0.10.4/Makefile.am --- old/snapper-0.10.4/Makefile.am 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/Makefile.am 2023-01-04 15:44:48.000000000 +0100 @@ -2,7 +2,7 @@ # Makefile.am for snapper # -SUBDIRS = snapper examples dbus server client scripts pam data doc po \ +SUBDIRS = snapper dbus server client scripts pam data doc po examples \ testsuite testsuite-real testsuite-cmp zypp-plugin AUTOMAKE_OPTIONS = foreign dist-bzip2 no-dist-gzip diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/Makefile.in new/snapper-0.10.4/Makefile.in --- old/snapper-0.10.4/Makefile.in 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/Makefile.in 2023-01-04 15:44:48.000000000 +0100 @@ -400,7 +400,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = snapper examples dbus server client scripts pam data doc po \ +SUBDIRS = snapper dbus server client scripts pam data doc po examples \ testsuite testsuite-real testsuite-cmp zypp-plugin AUTOMAKE_OPTIONS = foreign dist-bzip2 no-dist-gzip diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/client/cmd-rollback.cc new/snapper-0.10.4/client/cmd-rollback.cc --- old/snapper-0.10.4/client/cmd-rollback.cc 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/client/cmd-rollback.cc 2023-01-04 15:44:48.000000000 +0100 @@ -247,7 +247,8 @@ Hooks::rollback(filesystem->snapshotDir(snapshot1->getNum()), filesystem->snapshotDir(snapshot2->getNum())); - Hooks::rollback(subvolume, filesystem, snapshot1->getNum(), snapshot2->getNum()); + Hooks::rollback(Hooks::Stage::POST_ACTION, subvolume, filesystem, snapshot1->getNum(), + snapshot2->getNum()); if (print_number) cout << snapshot2->getNum() << endl; @@ -292,7 +293,8 @@ Hooks::rollback(filesystem->snapshotDir(previous_default->getNum()), filesystem->snapshotDir(snapshot->getNum())); - Hooks::rollback(subvolume, filesystem, previous_default->getNum(), snapshot->getNum()); + Hooks::rollback(Hooks::Stage::POST_ACTION, subvolume, filesystem, previous_default->getNum(), + snapshot->getNum()); } break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/client/installation-helper.cc new/snapper-0.10.4/client/installation-helper.cc --- old/snapper-0.10.4/client/installation-helper.cc 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/client/installation-helper.cc 2023-01-04 15:44:48.000000000 +0100 @@ -214,7 +214,7 @@ cout << "running external programs" << endl; - Hooks::create_config("/", &btrfs); + Hooks::create_config(Hooks::Stage::POST_ACTION, "/", &btrfs); cout << "done" << endl; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/doc/snapper.xml.in new/snapper-0.10.4/doc/snapper.xml.in --- old/snapper-0.10.4/doc/snapper.xml.in 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/doc/snapper.xml.in 2023-01-04 15:44:48.000000000 +0100 @@ -2,13 +2,13 @@ <refentry id='snapper8' xmlns:xlink="http://www.w3.org/1999/xlink"> <refentryinfo> - <date>2022-06-02</date> + <date>2022-12-22</date> </refentryinfo> <refmeta> <refentrytitle>snapper</refentrytitle> <manvolnum>8</manvolnum> - <refmiscinfo class='date'>2022-06-02</refmiscinfo> + <refmiscinfo class='date'>2022-12-22</refmiscinfo> <refmiscinfo class='version'>@VERSION@</refmiscinfo> <refmiscinfo class='manual'>Filesystem Snapshot Management</refmiscinfo> </refmeta> @@ -848,45 +848,81 @@ following actions are defined:</para> <variablelist> <varlistentry> - <term><option>create-config <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term> + <term><option>create-config-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term> <listitem> - <para>Executed when a new config gets created</para> + <para>Executed before a new config is created</para> </listitem> </varlistentry> <varlistentry> - <term><option>delete-config <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term> + <term><option>create-config-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term> <listitem> - <para>Executed when a config gets deleted</para> + <para>Executed after a new config was created</para> </listitem> </varlistentry> <varlistentry> - <term><option>create-snapshot <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> + <term><option>delete-config-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term> <listitem> - <para>Executed when a new snapshot gets created</para> + <para>Executed before a config is deleted</para> </listitem> </varlistentry> <varlistentry> - <term><option>delete-snapshot <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> + <term><option>delete-config-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term> <listitem> - <para>Executed when a snapshot is removed</para> + <para>Executed after a config was deleted</para> </listitem> </varlistentry> <varlistentry> - <term><option>modify-snapshot <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> + <term><option>create-snapshot-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> <listitem> - <para>Executed when a snapshot gets modified</para> + <para>Executed before a new snapshot is created</para> </listitem> </varlistentry> <varlistentry> - <term><option>set-default-snapshot <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> + <term><option>create-snapshot-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> <listitem> - <para>Executed when the default snapshot gets changed</para> + <para>Executed after a new snapshot was created</para> </listitem> </varlistentry> <varlistentry> - <term><option>rollback <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>old-snapshot-number</replaceable> <replaceable>new-snapshot-number</replaceable></option></term> + <term><option>modify-snapshot-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> <listitem> - <para>Executed when a rollback is done</para> + <para>Executed before a snapshot is modified</para> + </listitem> + </varlistentry> + <varlistentry> + <term><option>modify-snapshot-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> + <listitem> + <para>Executed after a snapshot was modified</para> + </listitem> + </varlistentry> + <varlistentry> + <term><option>delete-snapshot-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> + <listitem> + <para>Executed before a snapshot is removed</para> + </listitem> + </varlistentry> + <varlistentry> + <term><option>delete-snapshot-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> + <listitem> + <para>Executed after a snapshot was removed</para> + </listitem> + </varlistentry> + <varlistentry> + <term><option>set-default-snapshot-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> + <listitem> + <para>Executed before the default snapshot is changed</para> + </listitem> + </varlistentry> + <varlistentry> + <term><option>set-default-snapshot-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term> + <listitem> + <para>Executed after the default snapshot was changed</para> + </listitem> + </varlistentry> + <varlistentry> + <term><option>rollback-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>old-snapshot-number</replaceable> <replaceable>new-snapshot-number</replaceable></option></term> + <listitem> + <para>Executed after a rollback was done</para> </listitem> </varlistentry> </variablelist> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/snapper/Btrfs.cc new/snapper-0.10.4/snapper/Btrfs.cc --- old/snapper-0.10.4/snapper/Btrfs.cc 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/snapper/Btrfs.cc 2023-01-04 15:44:48.000000000 +0100 @@ -681,10 +681,6 @@ bool dumper(int fd); -#if BOOST_VERSION < 104100 - bool dumper_ret; -#endif - void do_send(u64 parent_root_id, const vector<u64>& clone_sources); }; @@ -1267,19 +1263,11 @@ { y2err("btrfs_read_and_process_send_stream failed " << r); -#if BOOST_VERSION < 104100 - dumper_ret = false; -#endif - return false; } if (r) { -#if BOOST_VERSION < 104100 - dumper_ret = true; -#endif - return true; } @@ -1311,8 +1299,6 @@ io_send.parent_root = parent_root_id; io_send.flags = BTRFS_SEND_FLAG_NO_FILE_DATA; -#if BOOST_VERSION >= 104100 - boost::packaged_task<bool> pt(boost::bind(&StreamProcessor::dumper, this, pipefd[0])); boost::unique_future<bool> uf = pt.get_future(); @@ -1334,42 +1320,6 @@ { SN_THROW(BtrfsSendReceiveException()); } - -#else - - boost::thread dumper_thread(boost::bind(&StreamProcessor::dumper, this, pipefd[0])); - - fd0_closer.reset(); - - int r2 = ioctl(dir2.fd(), BTRFS_IOC_SEND, &io_send); - if (r2 < 0) - { - y2err("send ioctl failed errno:" << errno << " (" << stringerror(errno) << ")"); - } - - fd1_closer.close(); - - dumper_thread.join(); - - if (r2 < 0 || !dumper_ret) - { - SN_THROW(BtrfsSendReceiveException()); - } - -#endif - } - - - static bool - is_subvolume_ro(const SDir& dir) - { - u64 flags; - if (ioctl(dir.fd(), BTRFS_IOC_SUBVOL_GETFLAGS, &flags) < 0) - { - SN_THROW(IOErrorException("ioctl BTRFS_IOC_SUBVOL_GETFLAGS failed")); - } - - return flags & BTRFS_SUBVOL_RDONLY; } @@ -1378,7 +1328,7 @@ { y2mil("dir1:'" << dir1.fullname() << "' dir2:'" << dir2.fullname() << "'"); - if (!is_subvolume_ro(dir1) || !is_subvolume_ro(dir2)) + if (!is_subvolume_read_only(dir1.fd()) || !is_subvolume_read_only(dir2.fd())) { y2err("not read-only snapshots"); SN_THROW(BtrfsSendReceiveException()); @@ -1518,6 +1468,8 @@ { try { + Hooks::set_default_snapshot(Hooks::Stage::PRE_ACTION, subvolume, this, num); + SDir general_dir = openGeneralDir(); if (num == 0) @@ -1533,7 +1485,7 @@ set_default_id(general_dir.fd(), id); } - Hooks::set_default_snapshot(subvolume, this, num); + Hooks::set_default_snapshot(Hooks::Stage::POST_ACTION, subvolume, this, num); } catch (const runtime_error& e) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/snapper/Hooks.cc new/snapper-0.10.4/snapper/Hooks.cc --- old/snapper-0.10.4/snapper/Hooks.cc 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/snapper/Hooks.cc 2023-01-04 15:44:48.000000000 +0100 @@ -66,50 +66,113 @@ } + // Actions without -pre/-post are legacy and deprecated (2022-12-22). + + void - Hooks::create_config(const string& subvolume, const Filesystem* filesystem) + Hooks::create_config(Stage stage, const string& subvolume, const Filesystem* filesystem) { - grub(subvolume, filesystem, "--enable"); - run_scripts({ "create-config", subvolume, filesystem->fstype() }); + switch (stage) + { + case Stage::PRE_ACTION: + run_scripts({ "create-config-pre", subvolume, filesystem->fstype() }); + break; + + case Stage::POST_ACTION: + grub(subvolume, filesystem, "--enable"); + run_scripts({ "create-config", subvolume, filesystem->fstype() }); + run_scripts({ "create-config-post", subvolume, filesystem->fstype() }); + break; + } } void - Hooks::delete_config(const string& subvolume, const Filesystem* filesystem) + Hooks::delete_config(Stage stage, const string& subvolume, const Filesystem* filesystem) { - grub(subvolume, filesystem, "--disable"); - run_scripts({ "delete-config", subvolume, filesystem->fstype() }); + switch (stage) + { + case Stage::PRE_ACTION: + grub(subvolume, filesystem, "--disable"); + run_scripts({ "delete-config-pre", subvolume, filesystem->fstype() }); + run_scripts({ "delete-config", subvolume, filesystem->fstype() }); + break; + + case Stage::POST_ACTION: + run_scripts({ "delete-config-post", subvolume, filesystem->fstype() }); + break; + } } void - Hooks::create_snapshot(const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot) + Hooks::create_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot) { - grub(subvolume, filesystem, "--refresh"); - run_scripts({ "create-snapshot", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + switch (stage) + { + case Stage::PRE_ACTION: + run_scripts({ "create-snapshot-pre", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + break; + + case Stage::POST_ACTION: + grub(subvolume, filesystem, "--refresh"); + run_scripts({ "create-snapshot", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + run_scripts({ "create-snapshot-post", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + break; + } } void - Hooks::modify_snapshot(const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot) + Hooks::modify_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot) { - grub(subvolume, filesystem, "--refresh"); - run_scripts({ "modify-snapshot", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + switch (stage) + { + case Stage::PRE_ACTION: + run_scripts({ "modify-snapshot-pre", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + break; + + case Stage::POST_ACTION: + grub(subvolume, filesystem, "--refresh"); + run_scripts({ "modify-snapshot", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + run_scripts({ "modify-snapshot-post", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + break; + } } void - Hooks::delete_snapshot(const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot) + Hooks::delete_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot) { - grub(subvolume, filesystem, "--refresh"); - run_scripts({ "delete-snapshot", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + switch (stage) + { + case Stage::PRE_ACTION: + run_scripts({ "delete-snapshot-pre", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + break; + + case Stage::POST_ACTION: + grub(subvolume, filesystem, "--refresh"); + run_scripts({ "delete-snapshot", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + run_scripts({ "delete-snapshot-post", subvolume, filesystem->fstype(), std::to_string(snapshot.getNum()) }); + break; + } } void - Hooks::set_default_snapshot(const string& subvolume, const Filesystem* filesystem, unsigned int num) + Hooks::set_default_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem, unsigned int num) { - run_scripts({ "set-default-snapshot", subvolume, filesystem->fstype(), std::to_string(num) }); + switch (stage) + { + case Stage::PRE_ACTION: + run_scripts({ "set-default-snapshot-pre", subvolume, filesystem->fstype(), std::to_string(num) }); + break; + + case Stage::POST_ACTION: + run_scripts({ "set-default-snapshot", subvolume, filesystem->fstype(), std::to_string(num) }); + run_scripts({ "set-default-snapshot-post", subvolume, filesystem->fstype(), std::to_string(num) }); + break; + } } @@ -145,9 +208,31 @@ void - Hooks::rollback(const string& subvolume, const Filesystem* filesystem, unsigned int old_num, unsigned int new_num) + Hooks::rollback(const string& subvolume, const Filesystem* filesystem, unsigned int old_num, + unsigned int new_num) + { + rollback(Stage::POST_ACTION, subvolume, filesystem, old_num, new_num); + } + + + void + Hooks::rollback(Stage stage, const string& subvolume, const Filesystem* filesystem, unsigned int old_num, + unsigned int new_num) { - run_scripts({ "rollback", subvolume, filesystem->fstype(), std::to_string(old_num), std::to_string(new_num) }); + switch (stage) + { + case Stage::PRE_ACTION: + run_scripts({ "rollback-pre", subvolume, filesystem->fstype(), std::to_string(old_num), + std::to_string(new_num) }); + break; + + case Stage::POST_ACTION: + run_scripts({ "rollback", subvolume, filesystem->fstype(), std::to_string(old_num), + std::to_string(new_num) }); + run_scripts({ "rollback-post", subvolume, filesystem->fstype(), std::to_string(old_num), + std::to_string(new_num) }); + break; + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/snapper/Hooks.h new/snapper-0.10.4/snapper/Hooks.h --- old/snapper-0.10.4/snapper/Hooks.h 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/snapper/Hooks.h 2023-01-04 15:44:48.000000000 +0100 @@ -38,17 +38,27 @@ { public: - static void create_config(const string& subvolume, const Filesystem* filesystem); - static void delete_config(const string& subvolume, const Filesystem* filesystem); + enum class Stage { PRE_ACTION, POST_ACTION }; - static void create_snapshot(const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot); - static void modify_snapshot(const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot); - static void delete_snapshot(const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot); + static void create_config(Stage stage, const string& subvolume, const Filesystem* filesystem); + static void delete_config(Stage stage, const string& subvolume, const Filesystem* filesystem); - static void set_default_snapshot(const string& subvolume, const Filesystem* filesystem, unsigned int num); + static void create_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem, + const Snapshot& snapshot); + static void modify_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem, + const Snapshot& snapshot); + static void delete_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem, + const Snapshot& snapshot); + + static void set_default_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem, + unsigned int num); static void rollback(const string& old_root, const string& new_root); - static void rollback(const string& subvolume, const Filesystem* filesystem, unsigned int old_num, unsigned int new_num); + + static void rollback(const string& subvolume, const Filesystem* filesystem, unsigned int old_num, + unsigned int new_num) __attribute__((deprecated)); + static void rollback(Stage stage, const string& subvolume, const Filesystem* filesystem, unsigned int old_num, + unsigned int new_num); private: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/snapper/Snapper.cc new/snapper-0.10.4/snapper/Snapper.cc --- old/snapper-0.10.4/snapper/Snapper.cc 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/snapper/Snapper.cc 2023-01-04 15:44:48.000000000 +0100 @@ -390,6 +390,8 @@ SN_THROW(CreateConfigFailedException(e.what())); } + Hooks::create_config(Hooks::Stage::PRE_ACTION, subvolume, filesystem.get()); + try { SysconfigFile sysconfig(SYSCONFIG_FILE); @@ -452,7 +454,7 @@ SN_RETHROW(e); } - Hooks::create_config(subvolume, filesystem.get()); + Hooks::create_config(Hooks::Stage::POST_ACTION, subvolume, filesystem.get()); } @@ -464,7 +466,7 @@ unique_ptr<Snapper> snapper(new Snapper(config_name, root_prefix)); - Hooks::delete_config(snapper->subvolumeDir(), snapper->getFilesystem()); + Hooks::delete_config(Hooks::Stage::PRE_ACTION, snapper->subvolumeDir(), snapper->getFilesystem()); Snapshots& snapshots = snapper->getSnapshots(); @@ -524,6 +526,8 @@ SN_THROW(DeleteConfigFailedException("modifying sysconfig-file failed")); } + + Hooks::delete_config(Hooks::Stage::POST_ACTION, snapper->subvolumeDir(), snapper->getFilesystem()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/snapper/Snapshot.cc new/snapper-0.10.4/snapper/Snapshot.cc --- old/snapper-0.10.4/snapper/Snapshot.cc 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/snapper/Snapshot.cc 2023-01-04 15:44:48.000000000 +0100 @@ -701,6 +701,9 @@ // parent == end indicates the btrfs default subvolume. Unclean, but // adding a special snapshot like current needs too many API changes. + Hooks::create_snapshot(Hooks::Stage::PRE_ACTION, snapper->subvolumeDir(), snapper->getFilesystem(), + snapshot); + try { if (parent != end()) @@ -733,7 +736,8 @@ SN_RETHROW(e); } - Hooks::create_snapshot(snapper->subvolumeDir(), snapper->getFilesystem(), snapshot); + Hooks::create_snapshot(Hooks::Stage::POST_ACTION, snapper->subvolumeDir(), snapper->getFilesystem(), + snapshot); return entries.insert(entries.end(), snapshot); } @@ -747,13 +751,17 @@ checkUserdata(smd.userdata); + Hooks::modify_snapshot(Hooks::Stage::PRE_ACTION, snapper->subvolumeDir(), snapper->getFilesystem(), + *snapshot); + snapshot->description = smd.description; snapshot->cleanup = smd.cleanup; snapshot->userdata = smd.userdata; snapshot->writeInfo(); - Hooks::modify_snapshot(snapper->subvolumeDir(), snapper->getFilesystem(), *snapshot); + Hooks::modify_snapshot(Hooks::Stage::POST_ACTION, snapper->subvolumeDir(), snapper->getFilesystem(), + *snapshot); } @@ -764,6 +772,9 @@ snapshot->isActive()) SN_THROW(IllegalSnapshotException()); + Hooks::delete_snapshot(Hooks::Stage::PRE_ACTION, snapper->subvolumeDir(), snapper->getFilesystem(), + *snapshot); + snapshot->deleteFilesystemSnapshot(); SDir info_dir = snapshot->openInfoDir(); @@ -792,7 +803,8 @@ SDir infos_dir = snapper->openInfosDir(); infos_dir.unlink(decString(snapshot->getNum()), AT_REMOVEDIR); - Hooks::delete_snapshot(snapper->subvolumeDir(), snapper->getFilesystem(), *snapshot); + Hooks::delete_snapshot(Hooks::Stage::POST_ACTION, snapper->subvolumeDir(), snapper->getFilesystem(), + *snapshot); entries.erase(snapshot); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/snapper/Version.h new/snapper-0.10.4/snapper/Version.h --- old/snapper-0.10.4/snapper/Version.h 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/snapper/Version.h 2023-01-04 15:44:48.000000000 +0100 @@ -25,7 +25,7 @@ #define LIBSNAPPER_MAJOR="6" -#define LIBSNAPPER_MINOR="1" +#define LIBSNAPPER_MINOR="2" #define LIBSNAPPER_PATCHLEVEL="0" #define LIBSNAPPER_VERSION ( LIBSNAPPER_MAJOR * 10000 + \\ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/snapper.spec.in new/snapper-0.10.4/snapper.spec.in --- old/snapper-0.10.4/snapper.spec.in 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/snapper.spec.in 2023-01-04 15:44:48.000000000 +0100 @@ -22,7 +22,7 @@ %endif # Location for PAM module -%if 0%{?usrmerged} +%if 0%{?suse_version} >= 1550 %define pam_security_dir %{_libdir}/security %else %define pam_security_dir /%{_lib}/security diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.10.4/zypp-plugin/snapper-zypp-plugin.cc new/snapper-0.10.4/zypp-plugin/snapper-zypp-plugin.cc --- old/snapper-0.10.4/zypp-plugin/snapper-zypp-plugin.cc 2022-12-16 08:37:50.000000000 +0100 +++ new/snapper-0.10.4/zypp-plugin/snapper-zypp-plugin.cc 2023-01-04 15:44:48.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019-2021] SUSE LLC + * Copyright (c) [2019-2023] SUSE LLC * * All Rights Reserved. * @@ -19,20 +19,16 @@ * find current contact information at www.suse.com. */ -// getenv #include <stdlib.h> -// getppid #include <sys/types.h> #include <unistd.h> -// split -#include <boost/algorithm/string.hpp> - #include <iostream> #include <map> #include <set> #include <string> #include <regex> +#include <boost/algorithm/string.hpp> using namespace std; @@ -301,14 +297,39 @@ } +class JsonTokener +{ +public: + + JsonTokener() + : p(json_tokener_new()) + { + if (!p) + throw runtime_error("out of memory"); + } + + ~JsonTokener() + { + json_tokener_free(p); + } + + json_tokener* get() { return p; } + +private: + + json_tokener* p; + +}; + + set<string> SnapperZyppPlugin::get_solvables(const Message& msg, Phase phase) { set<string> result; - json_tokener * tok = json_tokener_new(); - json_object * zypp = json_tokener_parse_ex(tok, msg.body.c_str(), msg.body.size()); - json_tokener_error jerr = json_tokener_get_error(tok); + JsonTokener tokener; + json_object* zypp = json_tokener_parse_ex(tokener.get(), msg.body.c_str(), msg.body.size()); + json_tokener_error jerr = json_tokener_get_error(tokener.get()); if (jerr != json_tokener_success) { cerr << "ERROR:" << "parsing zypp JSON failed: " << json_tokener_error_desc(jerr) << endl; ++++++ snapper-Debian_10.0.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.681094258 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.685094279 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-Debian_11.0.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.705094386 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.709094408 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-Debian_Unstable.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.729094514 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.733094536 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_18.04.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.777094771 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.781094793 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_18.10.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.801094900 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.805094922 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_19.04.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.825095029 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.825095029 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_19.10.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.877095307 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.881095328 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_20.04.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.905095457 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.909095478 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_20.10.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.929095585 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.933095606 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_21.04.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.953095714 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.957095735 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_21.10.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:27.981095863 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:27.985095885 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_22.04.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:28.009096014 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:28.013096035 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2 ++++++ snapper-xUbuntu_22.10.dsc ++++++ --- /var/tmp/diff_new_pack.i9tore/_old 2023-01-10 14:59:28.033096142 +0100 +++ /var/tmp/diff_new_pack.i9tore/_new 2023-01-10 14:59:28.037096163 +0100 @@ -11,5 +11,5 @@ # 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz # Files: -798dacf713b483f2f2e55125bf8cd544 669560 snapper-0.10.4.tar.bz2 +746d03d606b9273e46b0361dcbbb83ce 669404 snapper-0.10.4.tar.bz2