]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- removed deprecated functions 1036/head
authorArvin Schnell <aschnell@suse.de>
Wed, 23 Jul 2025 12:59:36 +0000 (14:59 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 23 Jul 2025 12:59:36 +0000 (14:59 +0200)
12 files changed:
package/snapper.changes
snapper/Btrfs.cc
snapper/Btrfs.h
snapper/Filesystem.cc
snapper/Filesystem.h
snapper/Hooks.cc [deleted file]
snapper/Hooks.h [deleted file]
snapper/Makefile.am
snapper/Snapper.cc
snapper/Snapper.h
snapper/Snapshot.cc
snapper/Snapshot.h

index 2e0f0dd321966b255503cf4d2a2a968e82a48fe7..a9653565339babbf19276414932beee53b28fda8 100644 (file)
@@ -2,6 +2,7 @@
 Wed Jul 23 10:35:22 CEST 2025 - aschnell@suse.com
 
 - allow to send log to system logger (gh#openSUSE/snapper#1030)
+- removed deprecated functions
 
 -------------------------------------------------------------------
 Fri Jul 04 12:52:34 CEST 2025 - aschnell@suse.com
index 055f46a3099a0b197ddc1adab1ea5fc7c74e85c4..75f2295c143c76c2ac4c1904796a01d9e7daa06e 100644 (file)
@@ -1465,14 +1465,6 @@ namespace snapper
     }
 
 
-    void
-    Btrfs::setDefault(unsigned int num) const
-    {
-       Plugins::Report report;
-       setDefault(num, report);
-    }
-
-
     void
     Btrfs::setDefault(unsigned int num, Plugins::Report& report) const
     {
@@ -1552,13 +1544,6 @@ namespace snapper
     }
 
 
-    void
-    Btrfs::setDefault(unsigned int num) const
-    {
-       Filesystem::setDefault(num);
-    }
-
-
     void
     Btrfs::setDefault(unsigned int num, Plugins::Report& report) const
     {
index 944914328afe2fb828a739e629e7f9da942eb78b..d67d7015007adfd5da6d8643d9eda2304caaeecf 100644 (file)
@@ -87,7 +87,6 @@ namespace snapper
 
        virtual std::pair<bool, unsigned int> getDefault() const override;
 
-       virtual void setDefault(unsigned int num) const override;
        virtual void setDefault(unsigned int num, Plugins::Report& report) const override;
 
        virtual bool isActive(unsigned int num) const override;
index 5d807924322537b87c5cecdded27b2f1a9924c0a..7cb1bc04920a299e1e4bc8d90b17d1de255e6935 100644 (file)
@@ -191,14 +191,6 @@ namespace snapper
     }
 
 
-    void
-    Filesystem::setDefault(unsigned int num) const
-    {
-       SN_THROW(UnsupportedException());
-       __builtin_unreachable();
-    }
-
-
     void
     Filesystem::setDefault(unsigned int num, Plugins::Report& report) const
     {
index 83e200b05d0e50d8ea42f695f7b14e3950fcad79..c587a35d2a14ad3628264b9398cabbeaa6d2b75b 100644 (file)
 #include "snapper/Plugins.h"
 
 
-#ifndef SN_DEPRECATED
-#define SN_DEPRECATED __attribute__((deprecated))
-#endif
-
-
 namespace snapper
 {
     using std::string;
@@ -100,7 +95,6 @@ namespace snapper
         */
        virtual std::pair<bool, unsigned int> getDefault() const;
 
-       virtual void setDefault(unsigned int num) const SN_DEPRECATED;
        virtual void setDefault(unsigned int num, Plugins::Report& report) const;
 
        virtual std::pair<bool, unsigned int> getActive() const;
diff --git a/snapper/Hooks.cc b/snapper/Hooks.cc
deleted file mode 100644 (file)
index 1a64d0e..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) [2011-2015] Novell, Inc.
- * Copyright (c) [2022-2023] SUSE LLC
- *
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, contact Novell, Inc.
- *
- * To contact Novell about this file by physical or electronic mail, you may
- * find current contact information at www.novell.com.
- */
-
-
-// TODO obsolete, remove with next ABI break
-
-
-#include "config.h"
-
-#include "snapper/FileUtils.h"
-#include "snapper/Hooks.h"
-#include "snapper/SystemCmd.h"
-#include "snapper/SnapperDefines.h"
-
-
-namespace snapper
-{
-    using namespace std;
-
-
-    static bool
-    plugins_filter_entries(unsigned char type, const char* name)
-    {
-       // must start with digit
-       return *name >= '0' && *name <= '9';
-    }
-
-
-    void
-    Hooks::run_scripts(const vector<string>& args)
-    {
-       try
-       {
-           SDir dir(PLUGINS_DIR);
-
-           vector<string> scripts = dir.entries(plugins_filter_entries);
-           std::sort(scripts.begin(), scripts.end());
-           for (const string& script : scripts)
-           {
-               SystemCmd::Args cmd_args = { dir.fullname(script) };
-               cmd_args << args;
-               SystemCmd cmd(cmd_args);
-           }
-       }
-       catch (const Exception& e)
-       {
-           SN_CAUGHT(e);
-       }
-    }
-
-
-    // Actions without -pre/-post are legacy and deprecated (2022-12-22).
-
-
-    void
-    Hooks::create_config(Stage stage, const string& subvolume, const Filesystem* filesystem)
-    {
-       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(Stage stage, const string& subvolume, const Filesystem* filesystem)
-    {
-       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(Stage stage, const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot)
-    {
-       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(Stage stage, const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot)
-    {
-       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(Stage stage, const string& subvolume, const Filesystem* filesystem, const Snapshot& snapshot)
-    {
-       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(Stage stage, const string& subvolume, const Filesystem* filesystem, unsigned int 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;
-       }
-    }
-
-
-    void
-    Hooks::grub(const string& subvolume, const Filesystem* filesystem, const char* option)
-    {
-#ifdef ENABLE_ROLLBACK
-
-#define GRUB_SCRIPT "/usr/lib/snapper/plugins/grub"
-
-       if (subvolume == "/" && filesystem->fstype() == "btrfs" && access(GRUB_SCRIPT, X_OK) == 0)
-       {
-           SystemCmd cmd({ GRUB_SCRIPT, option });
-       }
-#endif
-    }
-
-
-    void
-    Hooks::rollback(const string& old_root, const string& new_root)
-    {
-#ifdef ENABLE_ROLLBACK
-
-#define ROLLBACK_SCRIPT "/usr/lib/snapper/plugins/rollback"
-
-       // Fate#319108
-       if (access(ROLLBACK_SCRIPT, X_OK) == 0)
-       {
-           SystemCmd cmd({ ROLLBACK_SCRIPT, old_root, new_root });
-       }
-#endif
-    }
-
-
-    void
-    Hooks::rollback(Stage stage, const string& subvolume, const Filesystem* filesystem, unsigned int old_num,
-                   unsigned int 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 --git a/snapper/Hooks.h b/snapper/Hooks.h
deleted file mode 100644 (file)
index 269cbec..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) [2011-2015] Novell, Inc.
- * Copyright (c) 2022 SUSE LLC
- *
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, contact Novell, Inc.
- *
- * To contact Novell about this file by physical or electronic mail, you may
- * find current contact information at www.novell.com.
- */
-
-
-// TODO obsolete, remove with next ABI break
-
-
-#ifndef SNAPPER_HOOKS_H
-#define SNAPPER_HOOKS_H
-
-
-#include "snapper/Snapper.h"
-#include "snapper/Filesystem.h"
-
-
-namespace snapper
-{
-    using namespace std;
-
-
-    class Hooks
-    {
-    public:
-
-       enum class Stage { PRE_ACTION, POST_ACTION };
-
-       static void create_config(Stage stage, const string& subvolume, const Filesystem* filesystem) SN_DEPRECATED;
-       static void delete_config(Stage stage, const string& subvolume, const Filesystem* filesystem) SN_DEPRECATED;
-
-       static void create_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem,
-                                   const Snapshot& snapshot) SN_DEPRECATED;
-       static void modify_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem,
-                                   const Snapshot& snapshot) SN_DEPRECATED;
-       static void delete_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem,
-                                   const Snapshot& snapshot) SN_DEPRECATED;
-
-       static void set_default_snapshot(Stage stage, const string& subvolume, const Filesystem* filesystem,
-                                        unsigned int num) SN_DEPRECATED;
-
-       static void rollback(const string& old_root, const string& new_root) SN_DEPRECATED;
-
-       static void rollback(Stage stage, const string& subvolume, const Filesystem* filesystem, unsigned int old_num,
-                            unsigned int new_num) SN_DEPRECATED;
-
-    private:
-
-       static void grub(const string& subvolume, const Filesystem* filesystem,
-                        const char* option);
-
-       static void run_scripts(const vector<string>& args);
-
-    };
-
-}
-
-
-#endif
index 5c86052e13647909cf1df01ce9a91d0793f1fe32..6941061f31b559c621a8374244267fa1f1ab2fa0 100644 (file)
@@ -27,7 +27,6 @@ libsnapper_la_SOURCES =                                       \
        Acls.cc                 Acls.h                  \
        Plugins.cc              Plugins.h               \
        PluginsImpl.cc          PluginsImpl.h           \
-       Hooks.cc                Hooks.h                 \
        Systemctl.cc            Systemctl.h             \
        Exception.cc            Exception.h             \
        SnapperTmpl.h                                   \
index 7c54cc33b6758c38ca17dc456fa1d51c22990b23..2a9e35e2ab8840206792ea5464c99d4eeeff78d0 100644 (file)
@@ -233,62 +233,6 @@ namespace snapper
     }
 
 
-    Snapshots::iterator
-    Snapper::createSingleSnapshot(const SCD& scd)
-    {
-       Plugins::Report report;
-       return createSingleSnapshot(scd, report);
-    }
-
-
-    Snapshots::iterator
-    Snapper::createSingleSnapshot(Snapshots::const_iterator parent, const SCD& scd)
-    {
-       Plugins::Report report;
-       return createSingleSnapshot(parent, scd, report);
-    }
-
-
-    Snapshots::iterator
-    Snapper::createSingleSnapshotOfDefault(const SCD& scd)
-    {
-       Plugins::Report report;
-       return createSingleSnapshotOfDefault(scd, report);
-    }
-
-
-    Snapshots::iterator
-    Snapper::createPreSnapshot(const SCD& scd)
-    {
-       Plugins::Report report;
-       return createPreSnapshot(scd, report);
-    }
-
-
-    Snapshots::iterator
-    Snapper::createPostSnapshot(Snapshots::const_iterator pre, const SCD& scd)
-    {
-       Plugins::Report report;
-       return createPostSnapshot(pre, scd, report);
-    }
-
-
-    void
-    Snapper::modifySnapshot(Snapshots::iterator snapshot, const SMD& smd)
-    {
-       Plugins::Report report;
-       modifySnapshot(snapshot, smd, report);
-    }
-
-
-    void
-    Snapper::deleteSnapshot(Snapshots::iterator snapshot)
-    {
-       Plugins::Report report;
-       deleteSnapshot(snapshot, report);
-    }
-
-
     Snapshots::iterator
     Snapper::createSingleSnapshot(const SCD& scd, Plugins::Report& report)
     {
@@ -387,16 +331,6 @@ namespace snapper
     }
 
 
-    void
-    Snapper::createConfig(const string& config_name, const string& root_prefix,
-                         const string& subvolume, const string& fstype,
-                         const string& template_name)
-    {
-       Plugins::Report report;
-       createConfig(config_name, root_prefix, subvolume, fstype, template_name, report);
-    }
-
-
     void
     Snapper::createConfig(const string& config_name, const string& root_prefix,
                          const string& subvolume, const string& fstype,
@@ -532,14 +466,6 @@ namespace snapper
     }
 
 
-    void
-    Snapper::deleteConfig(const string& config_name, const string& root_prefix)
-    {
-       Plugins::Report report;
-       deleteConfig(config_name, root_prefix, report);
-    }
-
-
     void
     Snapper::deleteConfig(const string& config_name, const string& root_prefix, Plugins::Report& report)
     {
index 0f09673cfad0dd0130b86b9f2787e1eb5536d263..a43f8aaaa7a53b969d4287ab61481262bab6f810 100644 (file)
@@ -141,16 +141,6 @@ namespace snapper
 
        Snapshots::const_iterator getSnapshotCurrent() const;
 
-       Snapshots::iterator createSingleSnapshot(const SCD& scd) SN_DEPRECATED;
-       Snapshots::iterator createSingleSnapshot(Snapshots::const_iterator parent, const SCD& scd) SN_DEPRECATED;
-       Snapshots::iterator createSingleSnapshotOfDefault(const SCD& scd) SN_DEPRECATED;
-       Snapshots::iterator createPreSnapshot(const SCD& scd) SN_DEPRECATED;
-       Snapshots::iterator createPostSnapshot(Snapshots::const_iterator pre, const SCD& scd) SN_DEPRECATED;
-
-       void modifySnapshot(Snapshots::iterator snapshot, const SMD& smd) SN_DEPRECATED;
-
-       void deleteSnapshot(Snapshots::iterator snapshot) SN_DEPRECATED;
-
        Snapshots::iterator createSingleSnapshot(const SCD& scd, Plugins::Report& report);
        Snapshots::iterator createSingleSnapshot(Snapshots::const_iterator parent, const SCD& scd,
                                                 Plugins::Report& report);
@@ -168,11 +158,6 @@ namespace snapper
        static ConfigInfo getConfig(const string& config_name, const string& root_prefix);
        static list<ConfigInfo> getConfigs(const string& root_prefix);
 
-       static void createConfig(const string& config_name, const string& root_prefix,
-                                const string& subvolume, const string& fstype,
-                                const string& template_name) SN_DEPRECATED;
-       static void deleteConfig(const string& config_name, const string& root_prefix) SN_DEPRECATED;
-
        static void createConfig(const string& config_name, const string& root_prefix,
                                 const string& subvolume, const string& fstype,
                                 const string& template_name, Plugins::Report& report);
index efee43a0fdc8a5947a613ba6f092996826c5255a..6acbe1c9911d9f9d52e7d5a7d5a03faad641ebe6 100644 (file)
@@ -158,14 +158,6 @@ namespace snapper
     }
 
 
-    void
-    Snapshot::setDefault() const
-    {
-       Plugins::Report report;
-       setDefault(report);
-    }
-
-
     void
     Snapshot::setDefault(Plugins::Report& report) const
     {
index 287a29f8e6856454dd14356bdd7a00b7bcf7c7d5..2a1d138841078cbd43322219b5d6375dad1cb83d 100644 (file)
 #include "snapper/Plugins.h"
 
 
-#ifndef SN_DEPRECATED
-#define SN_DEPRECATED __attribute__((deprecated))
-#endif
-
-
 namespace snapper
 {
     using std::string;
@@ -126,11 +121,6 @@ namespace snapper
         */
        bool isDefault() const;
 
-       /**
-        * Change default snapshot (will be activated on next boot time).
-        */
-       void setDefault() const SN_DEPRECATED;
-
        /**
         * Change default snapshot (will be activated on next boot time).
         */