Blame SOURCES/0001-win-reg-Fix-output-of-virt-win-reg-version.patch

c7c347
From 83de85e717ad525423b0eabe153b48ff8af90bd1 Mon Sep 17 00:00:00 2001
c7c347
From: "Richard W.M. Jones" <rjones@redhat.com>
c7c347
Date: Mon, 17 May 2021 15:18:04 +0100
c7c347
Subject: [PATCH] win-reg: Fix output of virt-win-reg --version
c7c347
c7c347
Before we split libguestfs and guestfs-tools the version of programs
c7c347
was exactly the same as the version of libguestfs.  This was
c7c347
convenient for virt-win-reg where it is difficult to encode the
c7c347
version into the script, because virt-win-reg could simply use the
c7c347
version from Sys::Guestfs (ie. libguestfs).  However after the split
c7c347
this no longer applies, so we must do the difficult thing.
c7c347
c7c347
After this change virt-win-reg will print both the version of
c7c347
guestfs-tools and the version of libguestfs, eg:
c7c347
c7c347
    $ virt-win-reg --version
c7c347
    virt-win-reg 1.47.1
c7c347
    libguestfs 1.45.5fedora=35,release=1.fc35,libvirt
c7c347
c7c347
Reported-by: Yongkui Guo
c7c347
Fixes: commit 4354a3126152a2748cc9097cba139b3908ccc342
c7c347
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1961160
c7c347
(cherry picked from commit 9e9eeeaf4c4b478eca82bf0d4c3e680a624d6d91)
c7c347
---
c7c347
 .gitignore                                |  1 +
c7c347
 configure.ac                              |  2 ++
c7c347
 po-docs/podfiles                          |  2 +-
c7c347
 po/POTFILES-pl                            |  2 +-
c7c347
 po/guestfs-tools.pot                      | 18 +++++++++---------
c7c347
 win-reg/Makefile.am                       |  6 ------
c7c347
 win-reg/{virt-win-reg => virt-win-reg.in} |  5 +++--
c7c347
 7 files changed, 17 insertions(+), 19 deletions(-)
c7c347
 rename win-reg/{virt-win-reg => virt-win-reg.in} (99%)
c7c347
c7c347
diff --git a/.gitignore b/.gitignore
c7c347
index 006042a8..6bc509fa 100644
c7c347
--- a/.gitignore
c7c347
+++ b/.gitignore
c7c347
@@ -163,3 +163,4 @@ Makefile.in
c7c347
 /test-data/phony-guests/windows-software
c7c347
 /test-data/phony-guests/windows-system
c7c347
 /website/*.html
c7c347
+/win-reg/virt-win-reg
c7c347
diff --git a/configure.ac b/configure.ac
c7c347
index 56cfef57..ef412670 100644
c7c347
--- a/configure.ac
c7c347
+++ b/configure.ac
c7c347
@@ -99,6 +99,8 @@ AC_CONFIG_FILES([podwrapper.pl],
c7c347
                 [chmod +x,-w podwrapper.pl])
c7c347
 AC_CONFIG_FILES([run],
c7c347
                 [chmod +x,-w run])
c7c347
+AC_CONFIG_FILES([win-reg/virt-win-reg],
c7c347
+                [chmod +x,-w win-reg/virt-win-reg])
c7c347
 
c7c347
 AC_CONFIG_FILES([Makefile
c7c347
                  align/Makefile
c7c347
diff --git a/po-docs/podfiles b/po-docs/podfiles
c7c347
index d7ef1389..6b0c481f 100644
c7c347
--- a/po-docs/podfiles
c7c347
+++ b/po-docs/podfiles
c7c347
@@ -26,4 +26,4 @@ sparsify/virt-sparsify.pod
c7c347
 sysprep/sysprep-extra-options.pod
c7c347
 sysprep/sysprep-operations.pod
c7c347
 sysprep/virt-sysprep.pod
c7c347
-win-reg/virt-win-reg
c7c347
+win-reg/virt-win-reg.in
c7c347
diff --git a/po/POTFILES-pl b/po/POTFILES-pl
c7c347
index 47d30fc8..c6520cea 100644
c7c347
--- a/po/POTFILES-pl
c7c347
+++ b/po/POTFILES-pl
c7c347
@@ -1 +1 @@
c7c347
-win-reg/virt-win-reg
c7c347
+win-reg/virt-win-reg.in
c7c347
diff --git a/po/guestfs-tools.pot b/po/guestfs-tools.pot
c7c347
index a3be1b95..d7e9a3a7 100644
c7c347
--- a/po/guestfs-tools.pot
c7c347
+++ b/po/guestfs-tools.pot
c7c347
@@ -9,7 +9,7 @@ msgstr ""
c7c347
 "Project-Id-Version: guestfs-tools 1.46.1\n"
c7c347
 "Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?"
c7c347
 "component=libguestfs&product=Virtualization+Tools\n"
c7c347
-"POT-Creation-Date: 2021-05-08 08:57+0100\n"
c7c347
+"POT-Creation-Date: 2021-05-17 15:25+0100\n"
c7c347
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
c7c347
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
c7c347
 "Language-Team: LANGUAGE <LL@li.org>\n"
c7c347
@@ -4213,11 +4213,11 @@ msgstr ""
c7c347
 msgid "%s: subprocess failed\n"
c7c347
 msgstr ""
c7c347
 
c7c347
-#: win-reg/virt-win-reg:260
c7c347
+#: win-reg/virt-win-reg.in:261
c7c347
 msgid "no libvirt domain name or disk image given\n"
c7c347
 msgstr ""
c7c347
 
c7c347
-#: win-reg/virt-win-reg:316
c7c347
+#: win-reg/virt-win-reg.in:317
c7c347
 #, perl-brace-format
c7c347
 msgid ""
c7c347
 "{prog}: No operating system could be detected inside this disk image.\n"
c7c347
@@ -4230,33 +4230,33 @@ msgid ""
c7c347
 "information about the disk image as possible.\n"
c7c347
 msgstr ""
c7c347
 
c7c347
-#: win-reg/virt-win-reg:320
c7c347
+#: win-reg/virt-win-reg.in:321
c7c347
 #, perl-brace-format
c7c347
 msgid "{prog}: multiboot operating systems are not supported.\n"
c7c347
 msgstr ""
c7c347
 
c7c347
-#: win-reg/virt-win-reg:342
c7c347
+#: win-reg/virt-win-reg.in:343
c7c347
 msgid ""
c7c347
 "expecting 1 or 2 more parameters, subkey path and optionally the value to "
c7c347
 "export\n"
c7c347
 msgstr ""
c7c347
 
c7c347
-#: win-reg/virt-win-reg:502
c7c347
+#: win-reg/virt-win-reg.in:503
c7c347
 #, perl-brace-format
c7c347
 msgid "virt-win-reg: {p}: cannot find user directory\n"
c7c347
 msgstr ""
c7c347
 
c7c347
-#: win-reg/virt-win-reg:507
c7c347
+#: win-reg/virt-win-reg.in:508
c7c347
 #, perl-brace-format
c7c347
 msgid "virt-win-reg: {p}: not a supported Windows Registry path\n"
c7c347
 msgstr ""
c7c347
 
c7c347
-#: win-reg/virt-win-reg:580
c7c347
+#: win-reg/virt-win-reg.in:581
c7c347
 #, perl-brace-format
c7c347
 msgid "virt-win-reg: {p}: could not download registry file: {err}\n"
c7c347
 msgstr ""
c7c347
 
c7c347
-#: win-reg/virt-win-reg:597
c7c347
+#: win-reg/virt-win-reg.in:598
c7c347
 #, perl-brace-format
c7c347
 msgid "virt-win-reg: {p}: could not upload registry file: {err}\n"
c7c347
 msgstr ""
c7c347
diff --git a/win-reg/Makefile.am b/win-reg/Makefile.am
c7c347
index 22a22db4..61ec066a 100644
c7c347
--- a/win-reg/Makefile.am
c7c347
+++ b/win-reg/Makefile.am
c7c347
@@ -17,8 +17,6 @@
c7c347
 
c7c347
 include $(top_srcdir)/subdir-rules.mk
c7c347
 
c7c347
-EXTRA_DIST = virt-win-reg
c7c347
-
c7c347
 bin_SCRIPTS = virt-win-reg
c7c347
 
c7c347
 # Manual pages and HTML files for the website.
c7c347
@@ -36,7 +34,3 @@ stamp-virt-win-reg.pod: virt-win-reg
c7c347
 	  --warning custom \
c7c347
 	  $<
c7c347
 	touch $@
c7c347
-
c7c347
-all-local:
c7c347
-	for f in virt-win-reg; do echo win-reg/$$f; done \
c7c347
-	    > $(top_srcdir)/po/POTFILES-pl
c7c347
diff --git a/win-reg/virt-win-reg b/win-reg/virt-win-reg.in
c7c347
similarity index 99%
c7c347
rename from win-reg/virt-win-reg
c7c347
rename to win-reg/virt-win-reg.in
c7c347
index 1a936c5d..6d9d0a28 100755
c7c347
--- a/win-reg/virt-win-reg
c7c347
+++ b/win-reg/virt-win-reg.in
c7c347
@@ -1,6 +1,6 @@
c7c347
 #!/usr/bin/env perl
c7c347
 # virt-win-reg
c7c347
-# Copyright (C) 2010 Red Hat Inc.
c7c347
+# Copyright (C) 2010-2021 Red Hat Inc.
c7c347
 #
c7c347
 # This program is free software; you can redistribute it and/or modify
c7c347
 # it under the terms of the GNU General Public License as published by
c7c347
@@ -234,9 +234,10 @@ my %opts = ("help|?" => \$help,
c7c347
 GetOptions (%opts) or pod2usage (2);
c7c347
 pod2usage (1) if $help;
c7c347
 if ($version) {
c7c347
+    print "virt-win-reg @PACKAGE_VERSION@\n";
c7c347
     my $g = Sys::Guestfs->new ();
c7c347
     my %h = $g->version ();
c7c347
-    print "virt-win-reg $h{major}.$h{minor}.$h{release}$h{extra}\n";
c7c347
+    print "libguestfs $h{major}.$h{minor}.$h{release}$h{extra}\n";
c7c347
     exit
c7c347
 }
c7c347
 
c7c347
-- 
c7c347
2.31.1
c7c347