Hello community,

here is the log from the commit of package UEFITool for openSUSE:Factory 
checked in at 2019-12-21 12:33:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/UEFITool (Old)
 and      /work/SRC/openSUSE:Factory/.UEFITool.new.6675 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "UEFITool"

Sat Dec 21 12:33:20 2019 rev:6 rq:758501 version:20191103

Changes:
--------
--- /work/SRC/openSUSE:Factory/UEFITool/UEFITool.changes        2019-10-23 
15:54:37.310939214 +0200
+++ /work/SRC/openSUSE:Factory/.UEFITool.new.6675/UEFITool.changes      
2019-12-21 12:34:06.327440961 +0100
@@ -1,0 +2,8 @@
+Fri Dec 20 12:30:47 UTC 2019 - [email protected]
+
+- Update to version 20191103:
+  * Fix C++03 compatibility
+  * Backport rebuild logic
+  * Support applying patches from terminal, closes #186
+
+-------------------------------------------------------------------

Old:
----
  UEFITool-20181230.tar.xz

New:
----
  UEFITool-20191103.tar.xz

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

Other differences:
------------------
++++++ UEFITool.spec ++++++
--- /var/tmp/diff_new_pack.C5Q4g7/_old  2019-12-21 12:34:07.315441431 +0100
+++ /var/tmp/diff_new_pack.C5Q4g7/_new  2019-12-21 12:34:07.319441432 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package UEFITool
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           UEFITool
-Version:        20181230
+Version:        20191103
 Release:        0
 Summary:        Tools to inspect and work on UEFI BIOSes
 License:        BSD-2-Clause

++++++ UEFITool-20181230.tar.xz -> UEFITool-20191103.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20181230/UEFIPatch/uefipatch.cpp 
new/UEFITool-20191103/UEFIPatch/uefipatch.cpp
--- old/UEFITool-20181230/UEFIPatch/uefipatch.cpp       2018-12-30 
16:37:27.000000000 +0100
+++ new/UEFITool-20191103/UEFIPatch/uefipatch.cpp       2019-11-03 
15:25:07.000000000 +0100
@@ -121,6 +121,86 @@
     return ERR_SUCCESS;
 }
 
+UINT8 UEFIPatch::patchFromArg(const QString & path, const QString & patch, 
const QString & outputPath)
+{
+    QFileInfo fileInfo = QFileInfo(path);
+
+    if (!fileInfo.exists())
+        return ERR_FILE_OPEN;
+
+    QFile inputFile;
+    inputFile.setFileName(path);
+
+    if (!inputFile.open(QFile::ReadOnly))
+        return ERR_FILE_READ;
+
+    QByteArray buffer = inputFile.readAll();
+    inputFile.close();
+
+    UINT8 result = ffsEngine->parseImageFile(buffer);
+    if (result)
+        return result;
+
+    if (patch != NULL && !patch.isEmpty()) {
+        QByteArray line = patch.toUtf8();
+
+        QList<QByteArray> list = line.split(' ');
+        if (list.count() < 3)
+            return ERR_INVALID_PARAMETER;
+
+        QUuid uuid = QUuid(list.at(0));
+        QByteArray guid = QByteArray::fromRawData((const char*)&uuid.data1, 
sizeof(EFI_GUID));
+        bool converted;
+        UINT8 sectionType = (UINT8)list.at(1).toUShort(&converted, 16);
+        if (!converted)
+            return ERR_INVALID_PARAMETER;
+
+        QVector<PatchData> patches;
+
+        for (int i = 2; i < list.count(); i++) {
+            QList<QByteArray> patchList = list.at(i).split(':');
+            PatchData patch;
+            patch.type = *(UINT8*)patchList.at(0).constData();
+            if (patch.type == PATCH_TYPE_PATTERN) {
+                patch.offset = 0xFFFFFFFF;
+                patch.hexFindPattern = patchList.at(1);
+                patch.hexReplacePattern = patchList.at(2);
+                patches.append(patch);
+            }
+            else if (patch.type == PATCH_TYPE_OFFSET) {
+                patch.offset = patchList.at(1).toUInt(NULL, 16);
+                patch.hexReplacePattern = patchList.at(2);
+                patches.append(patch);
+            }
+            else {
+                // Ignore unknown patch type
+                continue;
+            }
+        }
+        result = patchFile(model->index(0, 0), guid, sectionType, patches);
+        if (result && result != ERR_NOTHING_TO_PATCH)
+            return result;
+    }
+
+    QByteArray reconstructed;
+    result = ffsEngine->reconstructImageFile(reconstructed);
+    if (result)
+        return result;
+    if (reconstructed == buffer)
+        return ERR_NOTHING_TO_PATCH;
+
+    QFile outputFile;
+    outputFile.setFileName(outputPath);
+    if (!outputFile.open(QFile::WriteOnly))
+        return ERR_FILE_WRITE;
+
+    outputFile.resize(0);
+    outputFile.write(reconstructed);
+    outputFile.close();
+
+    return ERR_SUCCESS;
+}
+
 UINT8 UEFIPatch::patchFile(const QModelIndex & index, const QByteArray & 
fileGuid, const UINT8 sectionType, const QVector<PatchData> & patches)
 {
   
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20181230/UEFIPatch/uefipatch.h 
new/UEFITool-20191103/UEFIPatch/uefipatch.h
--- old/UEFITool-20181230/UEFIPatch/uefipatch.h 2018-12-30 16:37:27.000000000 
+0100
+++ new/UEFITool-20191103/UEFIPatch/uefipatch.h 2019-11-03 15:25:07.000000000 
+0100
@@ -34,6 +34,7 @@
     ~UEFIPatch();
 
     UINT8 patchFromFile(const QString & path, const QString & patches, const 
QString & outputPath);
+    UINT8 patchFromArg(const QString & path, const QString & patch, const 
QString & outputPath);
 private:
     UINT8 patchFile(const QModelIndex & index, const QByteArray & fileGuid, 
const UINT8 sectionType, const QVector<PatchData> & patches);
     FfsEngine* ffsEngine;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20181230/UEFIPatch/uefipatch_main.cpp 
new/UEFITool-20191103/UEFIPatch/uefipatch_main.cpp
--- old/UEFITool-20181230/UEFIPatch/uefipatch_main.cpp  2018-12-30 
16:37:27.000000000 +0100
+++ new/UEFITool-20191103/UEFIPatch/uefipatch_main.cpp  2019-11-03 
15:25:07.000000000 +0100
@@ -33,7 +33,8 @@
 
     if (argumentsCount < 2) {
         std::cout << "UEFIPatch " PROGRAM_VERSION " - UEFI image file patching 
utility" << std::endl << std::endl <<
-            "Usage: UEFIPatch image_file [patches.txt] [-o output]" << 
std::endl << std::endl <<
+            "Usage: UEFIPatch image_file [patches.txt] [-o output]" << 
std::endl <<
+            "Usage: UEFIPatch image_file [-p \"Guid SectionType Patch\"] [-o 
output]" << std::endl << std::endl <<
             "Patches will be read from patches.txt file by default\n";
         return ERR_SUCCESS;
     }
@@ -41,8 +42,13 @@
     QString inputPath = a.arguments().at(1);
     QString patches = "patches.txt";
     QString outputPath = inputPath + ".patched";
+    int patchFrom = PATCH_FROM_FILE;
     for (UINT32 i = 2; i < argumentsCount; i++) {
-        if ((args.at(i) == "-o" || args.at(i) == "--output") && i + 1 < 
argumentsCount) {
+        if ((args.at(i) == "-p" || args.at(i) == "--patch") && i + 1 < 
argumentsCount) {
+            patchFrom = PATCH_FROM_ARG;
+            patches = args.at(i+1);
+            i++;
+        } else if ((args.at(i) == "-o" || args.at(i) == "--output") && i + 1 < 
argumentsCount) {
             outputPath = args.at(i+1);
             i++;
         } else if (patches == "patches.txt") {
@@ -53,7 +59,11 @@
     }
 
     if (result == ERR_SUCCESS) {
-        result = w.patchFromFile(inputPath, patches, outputPath);
+        if (patchFrom == PATCH_FROM_FILE) {
+            result = w.patchFromFile(inputPath, patches, outputPath);
+        } else if (patchFrom == PATCH_FROM_ARG) {
+            result = w.patchFromArg(inputPath, patches, outputPath);
+        }
     }
 
     switch (result) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20181230/basetypes.h 
new/UEFITool-20191103/basetypes.h
--- old/UEFITool-20181230/basetypes.h   2018-12-30 16:37:27.000000000 +0100
+++ new/UEFITool-20191103/basetypes.h   2019-11-03 15:25:07.000000000 +0100
@@ -127,6 +127,10 @@
 #define PATCH_MODE_HEADER     0
 #define PATCH_MODE_BODY       1
 
+// Patch from
+#define PATCH_FROM_FILE       0
+#define PATCH_FROM_ARG        1
+
 // Patch types
 #define PATCH_TYPE_OFFSET    'O'
 #define PATCH_TYPE_PATTERN   'P'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20181230/ffsengine.cpp 
new/UEFITool-20191103/ffsengine.cpp
--- old/UEFITool-20181230/ffsengine.cpp 2018-12-30 16:37:27.000000000 +0100
+++ new/UEFITool-20191103/ffsengine.cpp 2019-11-03 15:25:07.000000000 +0100
@@ -3032,7 +3032,7 @@
     UINT8 result;
 
     // No action
-    if (model->action(index) == Actions::NoAction) {
+    if (model->action(index) == Actions::NoAction || model->action(index) == 
Actions::DoNotRebuild) {
         reconstructed = model->header(index).append(model->body(index));
         return ERR_SUCCESS;
     }
@@ -3219,7 +3219,7 @@
     UINT8 result;
 
     // No action
-    if (model->action(index) == Actions::NoAction) {
+    if (model->action(index) == Actions::NoAction || model->action(index) == 
Actions::DoNotRebuild) {
         reconstructed = model->header(index).append(model->body(index));
         return ERR_SUCCESS;
     }
@@ -3276,7 +3276,7 @@
         return ERR_SUCCESS;
 
     // No action
-    if (model->action(index) == Actions::NoAction) {
+    if (model->action(index) == Actions::NoAction || model->action(index) == 
Actions::DoNotRebuild) {
         reconstructed = model->body(index);
         return ERR_SUCCESS;
     }
@@ -3321,7 +3321,7 @@
     UINT8 result;
 
     // No action
-    if (model->action(index) == Actions::NoAction) {
+    if (model->action(index) == Actions::NoAction || model->action(index) == 
Actions::DoNotRebuild) {
         reconstructed = model->header(index).append(model->body(index));
         return ERR_SUCCESS;
     }
@@ -3691,7 +3691,7 @@
     UINT8 result;
 
     // No action
-    if (model->action(index) == Actions::NoAction) {
+    if (model->action(index) == Actions::NoAction || model->action(index) == 
Actions::DoNotRebuild) {
         reconstructed = model->header(index).append(model->body(index));
         const EFI_FFS_FILE_HEADER* fileHeader = (const 
EFI_FFS_FILE_HEADER*)model->header(index).constData();
         // Append tail, if needed
@@ -3881,7 +3881,7 @@
     UINT8 result;
 
     // No action
-    if (model->action(index) == Actions::NoAction) {
+    if (model->action(index) == Actions::NoAction || model->action(index) == 
Actions::DoNotRebuild) {
         reconstructed = model->header(index).append(model->body(index));
         return ERR_SUCCESS;
     }

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.C5Q4g7/_old  2019-12-21 12:34:07.427441484 +0100
+++ /var/tmp/diff_new_pack.C5Q4g7/_new  2019-12-21 12:34:07.431441486 +0100
@@ -1,4 +1,4 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/LongSoft/UEFITool.git</param>
-              <param 
name="changesrevision">4bee991c949b458739ffa96b88dbc589192c7689</param></service></servicedata>
\ No newline at end of file
+              <param 
name="changesrevision">f9b174f78b0ba6ff8eab9e77a2b120a1b6a2584b</param></service></servicedata>
\ No newline at end of file


Reply via email to