commit:     39f5d9ced3065c61e00feab102aee122055e5b21
Author:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 19:03:49 2022 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Sat Apr  2 18:34:41 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39f5d9ce

sys-block/partimage: update EAPI 6 -> 8

Also migrating to GLEP-81,
fixing compilation with clang
and correcting license.

Closes: https://github.com/gentoo/gentoo/pull/24780
Closes: https://bugs.gentoo.org/732102
Closes: https://bugs.gentoo.org/781494

Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 .../partimage/files/partimage-0.6.9-clang.patch    | 181 +++++++++++++++++++++
 .../files/partimage-0.6.9-zlib-1.2.5.2-r1.patch    |  33 ++++
 sys-block/partimage/partimage-0.6.9-r3.ebuild      | 141 ++++++++++++++++
 3 files changed, 355 insertions(+)

diff --git a/sys-block/partimage/files/partimage-0.6.9-clang.patch 
b/sys-block/partimage/files/partimage-0.6.9-clang.patch
new file mode 100644
index 000000000000..b6df8868d16e
--- /dev/null
+++ b/sys-block/partimage/files/partimage-0.6.9-clang.patch
@@ -0,0 +1,181 @@
+--- a/src/client/gui_text.cpp
++++ b/src/client/gui_text.cpp
+@@ -341,7 +341,7 @@
+   m_labelSplit = newtLabel(1, 12, i18n("Image split mode"));
+   m_radioSplitAuto = newtRadiobutton(1, 13, i18n("Automatic split (when no 
space left)"), !options.qwSplitSize, NULL);
+   m_radioSplitSize = newtRadiobutton(1, 14, i18n("Into files whose size 
is:............"), !!options.qwSplitSize, m_radioSplitAuto);
+-  SNPRINTF(szTemp, "%"PRIu64"", (!!options.qwSplitSize) ? 
(options.qwSplitSize/1024/1024) : 2048);
++  SNPRINTF(szTemp, "%" PRIu64 "", (!!options.qwSplitSize) ? 
(options.qwSplitSize/1024/1024) : 2048);
+   m_editSplitSize = newtEntry(43, 14, szTemp, 8, NULL, 0);
+   m_labelSplitSizeKB = newtLabel(52, 14, i18n("MiB"));
+   m_checkSplitWait = newtCheckbox(1, 15, i18n("Wait after each volume 
change"), (!!options.bSplitWait ? 'X' : ' '), " X", NULL);
+@@ -462,7 +462,7 @@
+   SNPRINTF(szTemp, i18n("Partition to save:...........%s"), szDevice);
+   m_labelPartition = newtLabel(1, 0, szTemp);
+   
+-  SNPRINTF(szTemp, i18n("Size of the Partition:.......%s = %"PRIu64" bytes"), 
formatSize(qwPartSize, szTemp2), qwPartSize);
++  SNPRINTF(szTemp, i18n("Size of the Partition:.......%s = %" PRIu64 " 
bytes"), formatSize(qwPartSize, szTemp2), qwPartSize);
+   m_labelPartitionSize = newtLabel(1, 1, szTemp);
+   
+   SNPRINTF(szTemp, i18n("Image file to create:........%s"), szImageFile);
+@@ -610,7 +610,7 @@
+       newtLabelSetText(m_labelImageFileSize, szTemp);
+     }
+   
+-  SNPRINTF (szTemp, i18n("Available space for image:...%s = %"PRIu64" 
bytes"), formatSize(qwFreeSpace, szTemp2), qwFreeSpace);
++  SNPRINTF (szTemp, i18n("Available space for image:...%s = %" PRIu64 " 
bytes"), formatSize(qwFreeSpace, szTemp2), qwFreeSpace);
+   newtLabelSetText(m_labelFreeSpace, szTemp);
+ 
+   //option -B gui=no
+@@ -734,7 +734,7 @@
+   SNPRINTF(szTemp, i18n("Partition to restore:.............%s"), szDevice);
+   m_labelPartition = newtLabel(1, 0, szTemp);
+   
+-  SNPRINTF(szTemp, i18n("Size of partition to restore:.....%s = %"PRIu64" 
bytes"), formatSize(qwCurPartSize, szTemp2), qwCurPartSize);
++  SNPRINTF(szTemp, i18n("Size of partition to restore:.....%s = %" PRIu64 " 
bytes"), formatSize(qwCurPartSize, szTemp2), qwCurPartSize);
+   m_labelPartitionSize = newtLabel(1, 1, szTemp);
+   
+   SNPRINTF(szTemp, i18n("Image file to use:................%s"), szImageFile);
+@@ -751,7 +751,7 @@
+   SNPRINTF(szTemp, i18n("Image created on:.................%s\n"), 
asctime_portable(&dateCreate));
+   m_labelDate = newtLabel(1, 6, szTemp);
+ 
+-  SNPRINTF(szTemp, i18n("Size of the original partition:...%s = %"PRIu64" 
bytes"), formatSize(qwOrigPartSize, szTemp2), qwOrigPartSize);
++  SNPRINTF(szTemp, i18n("Size of the original partition:...%s = %" PRIu64 " 
bytes"), formatSize(qwOrigPartSize, szTemp2), qwOrigPartSize);
+   m_labelOriginalPartitionSize = newtLabel(1, 7, szTemp);
+ 
+   // stats
+--- a/src/client/imginfo.cpp
++++ b/src/client/imginfo.cpp
+@@ -111,7 +111,7 @@
+ {
+   snprintf(szText, nMaxTextLen, i18n("-------------------- MBR %.3d 
-------------------\n"
+                                    "Device:................%s\n"
+-                                   "Device blocks count:...%"PRIu64"\n"
++                                   "Device blocks count:...%" PRIu64 "\n"
+                                    "Device model:..........%s\n\n"),
+          i, mbr->szDevice, mbr->qwBlocksCount, mbr->szDescModel);
+ }
+@@ -153,7 +153,7 @@
+   snprintf(szText, nMaxTextLen, i18n("Volume number:.........%u\n"
+                                    "Volume size:...........%s\n"
+                                    "Compression level: ....%d -> %s\n"
+-                                   
"Identificator:.........%"PRIu64"=%"PRIX64"\n\n"),
++                                   "Identificator:.........%" PRIu64 "=%" 
PRIX64 "\n\n"),
+          head->dwVolumeNumber, formatSize(qwImageSize, cTemp), dwCompression, 
+          szCompression, head->qwIdentificator, head->qwIdentificator);
+ }
+--- a/src/client/main.cpp
++++ b/src/client/main.cpp
+@@ -301,7 +301,7 @@
+         case 'V': // split image into multiple files
+         
+           options.qwSplitSize = (QWORD)atol(optarg) * 1024 * 1024;
+-          fprintf (stderr, i18n("Volume size: %"PRIu64" bytes (%ld MiB)\n"),
++          fprintf (stderr, i18n("Volume size: %" PRIu64 " bytes (%ld MiB)\n"),
+                    options.qwSplitSize, atol(optarg));
+           break;
+         
+--- a/src/client/misc.cpp
++++ b/src/client/misc.cpp
+@@ -211,7 +211,7 @@
+         image.closeReading(true);
+           throw excep;
+       }
+-      SNPRINTF(szTemp, "%.3u: %s [%"PRIu64" blocks]", i, 
mbrOriginal[i].szDevice, mbrOriginal[i].qwBlocksCount);
++      SNPRINTF(szTemp, "%.3u: %s [%" PRIu64 " blocks]", i, 
mbrOriginal[i].szDevice, mbrOriginal[i].qwBlocksCount);
+       if (options->bBatchMode == false)
+       optGui.addMbr(szTemp, i);
+       
+--- a/src/client/fs/fs_base.cpp
++++ b/src/client/fs/fs_base.cpp
+@@ -730,10 +730,10 @@
+ 
+   if (bShowBlocksInfo)
+     {
+-      SNPRINTF(szBlocksInfo, i18n("Block size:...................%"PRIu64" 
bytes\n"
+-                                "Total blocks count:...........%"PRIu64"\n"
+-                                "Used blocks count:............%"PRIu64"\n"
+-                                "Free blocks count:............%"PRIu64"\n"),
++      SNPRINTF(szBlocksInfo, i18n("Block size:...................%" PRIu64 " 
bytes\n"
++                                "Total blocks count:...........%" PRIu64 "\n"
++                                "Used blocks count:............%" PRIu64 "\n"
++                                "Free blocks count:............%" PRIu64 
"\n"),
+              m_header.qwBlockSize, 
+              m_header.qwBlocksCount,
+              m_header.qwUsedBlocks,
+@@ -745,7 +745,7 @@
+     }
+  
+   snprintf(szDest, nMaxLen, i18n("%s" // Blocks infos
+-                               "Space usage:..................%"PRIu64" %%\n"
++                               "Space usage:..................%" PRIu64 " 
%%\n"
+                                "Used space:...................%s\n"
+                                "Free space:...................%s\n"
+                                "Bitmap size:..................%s\n"
+--- a/src/client/fs/fs_hfs.cpp
++++ b/src/client/fs/fs_hfs.cpp
+@@ -142,10 +142,10 @@
+   getStdInfos(szText, sizeof(szText), true);
+   
+   SNPRINTF(szFullText, i18n("%s" // standard infos
+-                          "Allocation Group count:.......%"PRIu64"\n"
++                          "Allocation Group count:.......%" PRIu64 "\n"
+                           "Blocks per Allocation Group:..%u\n"
+                           "Allocation Group size:........%s\n"
+-                          "First allocation block:.......%"PRIu64"\n"),
++                          "First allocation block:.......%" PRIu64 "\n"),
+          szText, m_info.qwAllocCount, m_info.dwBlocksPerAlloc,
+          formatSize(m_info.dwAllocSize,szTemp1), m_info.qwFirstAllocBlock);
+     
+--- a/src/client/fs/fs_ntfs.cpp
++++ b/src/client/fs/fs_ntfs.cpp
+@@ -312,7 +312,7 @@
+                           "Bytes per sector:.............%u\n"
+                           "Sectors per cluster:..........%u\n"
+                           "File record size:.............%u\n"
+-                          "LCN of MFT Data attrib:.......%"PRIu64"\n"),
++                          "LCN of MFT Data attrib:.......%" PRIu64 "\n"),
+          szText, m_info.nBytesPerSector, m_info.cSectorsPerCluster, 
+          m_info.dwFileRecordSize, m_info.qwLCNOfMftDataAttrib);
+     
+@@ -730,7 +730,7 @@
+   QWORD i;
+   
+   for (i=0L; i < m_qwClustersCount; i++)
+-    fprintf(stderr, "cluster[%llu] = %"PRIu64"\n", (long long unsigned int)i, 
m_qwOffset[i]);
++    fprintf(stderr, "cluster[%llu] = %" PRIu64 "\n", (long long unsigned 
int)i, m_qwOffset[i]);
+   
+ }
+ 
+--- a/src/client/fs/fs_ufs.cpp
++++ b/src/client/fs/fs_ufs.cpp
+@@ -217,7 +217,7 @@
+                           "Cylinder group size:..........%s\n"
+                           "Basic blocks per CG:..........%u\n"
+                           "Basic block size:.............%u\n"
+-                          "Data frags count:.............%"PRIu64"\n"),
++                          "Data frags count:.............%" PRIu64 "\n"),
+          szText, m_info.dwCylinderGroupsCount, 
+          
formatSize(m_info.dwCylinderGroupSize*m_info.dwBasicBlockSize,szTemp1),
+          m_info.dwCylinderGroupSize, m_info.dwBasicBlockSize, 
m_info.qwDataFrags);
+--- a/src/shared/common.cpp
++++ b/src/shared/common.cpp
+@@ -272,7 +272,7 @@
+   
+   if (qwSize < llKiloB) // In Bytes
+     {
+-      snprintf(szText, nMaxLen, i18n("%"PRId64" bytes"), qwSize);
++      snprintf(szText, nMaxLen, i18n("%" PRId64 " bytes"), qwSize);
+     }
+   else if (qwSize < llMegaB) // In KiloBytes
+     {
+@@ -311,7 +311,7 @@
+ 
+   if (qwSize < llKiloB) // In Bytes
+     {
+-      snprintf(szText, nMaxLen, i18n("%"PRId64" Bytes"), qwSize);
++      snprintf(szText, nMaxLen, i18n("%" PRId64 " Bytes"), qwSize);
+     }
+   else if (qwSize < llMegaB) // In KiloBytes
+     {

diff --git a/sys-block/partimage/files/partimage-0.6.9-zlib-1.2.5.2-r1.patch 
b/sys-block/partimage/files/partimage-0.6.9-zlib-1.2.5.2-r1.patch
new file mode 100644
index 000000000000..05150e131e36
--- /dev/null
+++ b/sys-block/partimage/files/partimage-0.6.9-zlib-1.2.5.2-r1.patch
@@ -0,0 +1,33 @@
+http://bugs.gentoo.org/405323
+
+--- a/src/client/imagefile.cpp
++++ b/src/client/imagefile.cpp
+@@ -783,7 +783,7 @@
+   else if (m_options.dwCompression == COMPRESS_GZIP) // Gzip compression
+     {
+       showDebug(1, "open gzip\n");
+-      m_gzImageFile = (gzFile *) gzdopen(m_nFdImage, "wb"); //"wb1h");
++      m_gzImageFile = gzdopen(m_nFdImage, "wb"); //"wb1h");
+       if (m_gzImageFile == NULL)
+       {
+         showDebug(1, "error:%d %s\n", errno, strerror(errno));
+@@ -1098,7 +1098,7 @@
+     }
+   else if (m_options.dwCompression == COMPRESS_GZIP) // Gzip compression
+     {
+-      m_gzImageFile = (gzFile *) gzdopen(m_nFdImage, "rb");
++      m_gzImageFile = gzdopen(m_nFdImage, "rb");
+       if (m_gzImageFile == NULL)
+         THROW(ERR_ERRNO, errno);
+       else
+--- a/src/client/imagefile.h
++++ b/src/client/imagefile.h
+@@ -41,7 +41,7 @@
+   COptions m_options;
+ 
+   FILE *m_fImageFile;
+-  gzFile *m_gzImageFile;
++  gzFile m_gzImageFile;
+   BZFILE *m_bzImageFile;
+ 
+   int m_nFdImage;

diff --git a/sys-block/partimage/partimage-0.6.9-r3.ebuild 
b/sys-block/partimage/partimage-0.6.9-r3.ebuild
new file mode 100644
index 000000000000..acd0d0f68be4
--- /dev/null
+++ b/sys-block/partimage/partimage-0.6.9-r3.ebuild
@@ -0,0 +1,141 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools flag-o-matic pam
+
+DESCRIPTION="Console-based application to efficiently save raw partition data 
to image file"
+HOMEPAGE="https://www.partimage.org/";
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~sparc ~x86"
+IUSE="nls nologin pam ssl static"
+REQUIRED_USE="static? ( !pam )"
+
+COMMON_DEPEND="
+       acct-group/partimag
+       acct-user/partimag
+"
+LIBS_DEPEND="
+       app-arch/bzip2
+       >=dev-libs/newt-0.52
+       >=sys-libs/slang-2
+       sys-libs/zlib:=
+       !nologin? ( virtual/libcrypt:= )
+       ssl? ( dev-libs/openssl:0= )
+"
+PAM_DEPEND="pam? ( sys-libs/pam )"
+RDEPEND="
+       ${COMMON_DEPEND}
+       ${PAM_DEPEND}
+       !static? ( ${LIBS_DEPEND} )
+"
+DEPEND="
+       ${PAM_DEPEND}
+       ${LIBS_DEPEND}
+"
+BDEPEND="
+       ${COMMON_DEPEND}
+       nls? ( sys-devel/gettext )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.6.9-zlib-1.2.5.2-r1.patch #405323
+       "${FILESDIR}"/${PN}-0.6.9-minor-typo.patch #580290
+       "${FILESDIR}"/${PN}-0.6.9-openssl-1.1-compatibility.patch
+       "${FILESDIR}"/${PN}-0.6.9-missing-includes.patch
+       "${FILESDIR}"/${PN}-0.6.9-clang.patch
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       # XXX: Do we still need these?
+       filter-flags -fno-exceptions
+       use ppc && append-flags -fsigned-char
+
+       local myeconfargs=(
+               $(use_enable nls)
+               $(usex nologin '--disable-login' '')
+               $(use_enable pam)
+               $(use_enable ssl)
+               $(use_enable static all-static)
+               --with-log-dir="${EPREFIX}"/var/log/partimage
+       )
+
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+
+       keepdir /var/lib/partimage
+       keepdir /var/log/partimage
+
+       newinitd "${FILESDIR}"/partimaged.init.2 partimaged
+       newconfd "${FILESDIR}"/partimaged.conf partimaged
+
+       if use pam; then
+               newpamd "${FILESDIR}"/partimaged.pam.2 partimaged
+       fi
+
+       if use ssl; then
+               insinto /etc/partimaged
+               doins "${FILESDIR}"/servercert.cnf
+       fi
+
+       fowners partimag:root /etc/partimaged/partimagedusers
+}
+
+pkg_config() {
+       if use ssl; then
+               local confdir="${EROOT}"/etc/partimaged
+               local privkey="${confdir}"/partimaged.key
+               local cnf="${confdir}"/servercert.cnf
+               local csr="${confdir}"/partimaged.csr
+               local cert="${confdir}"/partimaged.cert
+
+               ewarn "Please customize /etc/partimaged/servercert.cnf before 
you continue!"
+               ewarn "Press Ctrl-C to break now for it, or press enter to 
continue."
+               read
+               if [ ! -f "${privkey}" ]; then
+                       einfo "Generating unencrypted private key: ${privkey}"
+                       openssl genrsa -out "${privkey}" 2048 || die
+               else
+                       einfo "Private key already exists: ${privkey}"
+               fi
+               if [ ! -f "${csr}" ]; then
+                       einfo "Generating certificate request: ${csr}"
+                       openssl req -new -x509 -outform PEM -out "${csr}" -key 
"${privkey}" -config "${cnf}" || die
+               else
+                       einfo "Certificate request already exists: ${csr}"
+               fi
+               if [ ! -f "${cert}" ]; then
+                       einfo "Generating self-signed certificate: ${cert}"
+                       openssl x509 -in "${csr}" -out "${cert}" -signkey 
"${privkey}" || die
+               else
+                       einfo "Self-signed certifcate already exists: ${cert}"
+               fi
+               einfo "Setting permissions"
+               chmod 600 "${privkey}" || die
+               chown partimag:root "${privkey}" || die
+               chmod 644 "${cert}" "${csr}" || die
+               chown root:root "${cert}" "${csr}" || die
+               einfo "Done"
+       else
+               einfo "SSL is disabled, not building certificates"
+       fi
+}
+
+pkg_postinst() {
+       if use ssl; then
+               einfo "To create the required SSL certificates, please do:"
+               einfo "emerge --config =${PF}"
+       fi
+}

Reply via email to