Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package parted for openSUSE:Factory checked 
in at 2022-05-20 17:50:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/parted (Old)
 and      /work/SRC/openSUSE:Factory/.parted.new.1538 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "parted"

Fri May 20 17:50:08 2022 rev:137 rq:977958 version:3.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/parted/parted.changes    2022-04-23 
00:25:11.799747714 +0200
+++ /work/SRC/openSUSE:Factory/.parted.new.1538/parted.changes  2022-05-20 
17:50:11.435197155 +0200
@@ -1,0 +2,7 @@
+Wed May 18 09:19:29 CEST 2022 - aschn...@suse.com
+
+- add new type command from upstream
+  added patches:
+  - type-command.patch
+
+-------------------------------------------------------------------

New:
----
  type-command.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ parted.spec ++++++
--- /var/tmp/diff_new_pack.TBN9hV/_old  2022-05-20 17:50:12.563198164 +0200
+++ /var/tmp/diff_new_pack.TBN9hV/_new  2022-05-20 17:50:12.567198167 +0200
@@ -64,6 +64,7 @@
 # bsc#1164260
 Patch37:        parted-print-max-partitions-for-yast.patch
 Patch38:        direct-handling-of-partition-type-id-and-uuid.patch
+Patch39:        type-command.patch
 # bsc#1164907
 Patch64:        parted-type-accept-hex.patch
 # Fatresize
@@ -162,6 +163,7 @@
 %patch36 -p1
 %patch37 -p1
 %patch38 -p1
+%patch39 -p1
 %patch64 -p1
 %patch100 -p1
 %patch101 -p1



++++++ type-command.patch ++++++
--- a/parted/parted.c   2022-05-18 09:11:33.731616339 +0200
+++ b/parted/parted.c   2022-05-18 09:16:40.517372633 +0200
@@ -187,6 +187,8 @@
 static const char* name_msg =         N_("NAME is any word you want\n");
 static const char* type_id_msg =      N_("TYPE_ID is a value between 0x01 and 
0xff\n");
 static const char* type_uuid_msg =    N_("TYPE_UUID is a non-null uuid\n");
+static const char* type_msg =         N_("TYPE_ID is a value between 0x01 and 
0xff, "
+               "TYPE_UUID is a UUID\n");
 
 static const char* copyright_msg = N_(
 "Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n"
@@ -1090,6 +1092,90 @@
         return 0;
 }
 
+static int
+do_type (PedDevice** dev, PedDisk** diskp)
+{
+        if (!*diskp)
+                *diskp = ped_disk_new (*dev);
+        if (!*diskp)
+                goto error;
+
+        bool has_type_id = ped_disk_type_check_feature ((*diskp)->type,
+                                                        
PED_DISK_TYPE_PARTITION_TYPE_ID);
+        bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type,
+                                                          
PED_DISK_TYPE_PARTITION_TYPE_UUID);
+
+        PED_ASSERT (!(has_type_id && has_type_uuid));
+
+        if (!has_type_id && !has_type_uuid) {
+                ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+                                     _("%s disk labels do not support 
partition type."),
+                                     (*diskp)->type->name);
+                goto error;
+        }
+
+        PedPartition* part = NULL;
+        if (!command_line_get_partition (_("Partition number?"), *diskp, 
&part))
+                goto error;
+
+        char* input = NULL;
+
+        if (has_type_id) {
+                uint8_t type_id = ped_partition_get_type_id (part);
+                static char buf[8];
+                snprintf(buf, 8, "0x%02x", type_id);
+
+                input = command_line_get_word (_("Partition type-id?"), buf, 
NULL, 0);
+                if (!input)
+                    goto error;
+
+                unsigned int tmp = strtol (input, (char**) NULL, 16);
+                if (tmp < 0x01 || tmp > 0xff) {
+                        ped_exception_throw (PED_EXCEPTION_ERROR, 
PED_EXCEPTION_CANCEL,
+                                             _("Invalid type-id."));
+                        goto error_free_input;
+                }
+
+                if (!ped_partition_set_type_id (part, tmp))
+                        goto error_free_input;
+        }
+
+        if (has_type_uuid) {
+                uint8_t* type_uuid = ped_partition_get_type_uuid (part);
+                static char buf[UUID_STR_LEN];
+                uuid_unparse_lower (type_uuid, buf);
+                free (type_uuid);
+
+                input = command_line_get_word (_("Partition type-uuid?"), buf, 
NULL, 0);
+                if (!input)
+                        goto error;
+
+                uuid_t tmp;
+                if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) {
+                        ped_exception_throw (PED_EXCEPTION_ERROR, 
PED_EXCEPTION_CANCEL,
+                                             _("Invalid type-uuid."));
+                        goto error_free_input;
+                }
+
+                if (!ped_partition_set_type_uuid (part, tmp))
+                        goto error_free_input;
+        }
+
+        free (input);
+
+        // Reset the fs_type based on the filesystem, if it exists
+        part->fs_type = ped_file_system_probe (&part->geom);
+
+        if (!ped_disk_commit (*diskp))
+                goto error;
+        return 1;
+
+error_free_input:
+        free (input);
+error:
+        return 0;
+}
+
 static char*
 partition_print_flags (PedPartition const *part)
 {
@@ -2581,6 +2667,14 @@
         str_list_create (_(number_msg), flag_msg, NULL), 1));
 
 command_register (commands, command_create (
+        str_list_create_unique ("type", _("type"), NULL),
+        do_type,
+        str_list_create (
+_("type NUMBER TYPE-ID or TYPE-UUID         type set TYPE-ID or TYPE-UUID of 
partition NUMBER"),
+NULL),
+        str_list_create (_(number_msg), _(type_msg), NULL), 1));
+
+command_register (commands, command_create (
         str_list_create_unique ("unit", _("unit"), NULL),
         do_unit,
         str_list_create (

Reply via email to