Gentoo Archives: gentoo-commits

From: Conrad Kostecki <conikost@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-block/partimage/, sys-block/partimage/files/
Date: Sat, 02 Apr 2022 18:36:53
Message-Id: 1648924481.39f5d9ced3065c61e00feab102aee122055e5b21.conikost@gentoo
1 commit: 39f5d9ced3065c61e00feab102aee122055e5b21
2 Author: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
3 AuthorDate: Sun Mar 27 19:03:49 2022 +0000
4 Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 2 18:34:41 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39f5d9ce
7
8 sys-block/partimage: update EAPI 6 -> 8
9
10 Also migrating to GLEP-81,
11 fixing compilation with clang
12 and correcting license.
13
14 Closes: https://github.com/gentoo/gentoo/pull/24780
15 Closes: https://bugs.gentoo.org/732102
16 Closes: https://bugs.gentoo.org/781494
17
18 Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
19
20 .../partimage/files/partimage-0.6.9-clang.patch | 181 +++++++++++++++++++++
21 .../files/partimage-0.6.9-zlib-1.2.5.2-r1.patch | 33 ++++
22 sys-block/partimage/partimage-0.6.9-r3.ebuild | 141 ++++++++++++++++
23 3 files changed, 355 insertions(+)
24
25 diff --git a/sys-block/partimage/files/partimage-0.6.9-clang.patch b/sys-block/partimage/files/partimage-0.6.9-clang.patch
26 new file mode 100644
27 index 000000000000..b6df8868d16e
28 --- /dev/null
29 +++ b/sys-block/partimage/files/partimage-0.6.9-clang.patch
30 @@ -0,0 +1,181 @@
31 +--- a/src/client/gui_text.cpp
32 ++++ b/src/client/gui_text.cpp
33 +@@ -341,7 +341,7 @@
34 + m_labelSplit = newtLabel(1, 12, i18n("Image split mode"));
35 + m_radioSplitAuto = newtRadiobutton(1, 13, i18n("Automatic split (when no space left)"), !options.qwSplitSize, NULL);
36 + m_radioSplitSize = newtRadiobutton(1, 14, i18n("Into files whose size is:............"), !!options.qwSplitSize, m_radioSplitAuto);
37 +- SNPRINTF(szTemp, "%"PRIu64"", (!!options.qwSplitSize) ? (options.qwSplitSize/1024/1024) : 2048);
38 ++ SNPRINTF(szTemp, "%" PRIu64 "", (!!options.qwSplitSize) ? (options.qwSplitSize/1024/1024) : 2048);
39 + m_editSplitSize = newtEntry(43, 14, szTemp, 8, NULL, 0);
40 + m_labelSplitSizeKB = newtLabel(52, 14, i18n("MiB"));
41 + m_checkSplitWait = newtCheckbox(1, 15, i18n("Wait after each volume change"), (!!options.bSplitWait ? 'X' : ' '), " X", NULL);
42 +@@ -462,7 +462,7 @@
43 + SNPRINTF(szTemp, i18n("Partition to save:...........%s"), szDevice);
44 + m_labelPartition = newtLabel(1, 0, szTemp);
45 +
46 +- SNPRINTF(szTemp, i18n("Size of the Partition:.......%s = %"PRIu64" bytes"), formatSize(qwPartSize, szTemp2), qwPartSize);
47 ++ SNPRINTF(szTemp, i18n("Size of the Partition:.......%s = %" PRIu64 " bytes"), formatSize(qwPartSize, szTemp2), qwPartSize);
48 + m_labelPartitionSize = newtLabel(1, 1, szTemp);
49 +
50 + SNPRINTF(szTemp, i18n("Image file to create:........%s"), szImageFile);
51 +@@ -610,7 +610,7 @@
52 + newtLabelSetText(m_labelImageFileSize, szTemp);
53 + }
54 +
55 +- SNPRINTF (szTemp, i18n("Available space for image:...%s = %"PRIu64" bytes"), formatSize(qwFreeSpace, szTemp2), qwFreeSpace);
56 ++ SNPRINTF (szTemp, i18n("Available space for image:...%s = %" PRIu64 " bytes"), formatSize(qwFreeSpace, szTemp2), qwFreeSpace);
57 + newtLabelSetText(m_labelFreeSpace, szTemp);
58 +
59 + //option -B gui=no
60 +@@ -734,7 +734,7 @@
61 + SNPRINTF(szTemp, i18n("Partition to restore:.............%s"), szDevice);
62 + m_labelPartition = newtLabel(1, 0, szTemp);
63 +
64 +- SNPRINTF(szTemp, i18n("Size of partition to restore:.....%s = %"PRIu64" bytes"), formatSize(qwCurPartSize, szTemp2), qwCurPartSize);
65 ++ SNPRINTF(szTemp, i18n("Size of partition to restore:.....%s = %" PRIu64 " bytes"), formatSize(qwCurPartSize, szTemp2), qwCurPartSize);
66 + m_labelPartitionSize = newtLabel(1, 1, szTemp);
67 +
68 + SNPRINTF(szTemp, i18n("Image file to use:................%s"), szImageFile);
69 +@@ -751,7 +751,7 @@
70 + SNPRINTF(szTemp, i18n("Image created on:.................%s\n"), asctime_portable(&dateCreate));
71 + m_labelDate = newtLabel(1, 6, szTemp);
72 +
73 +- SNPRINTF(szTemp, i18n("Size of the original partition:...%s = %"PRIu64" bytes"), formatSize(qwOrigPartSize, szTemp2), qwOrigPartSize);
74 ++ SNPRINTF(szTemp, i18n("Size of the original partition:...%s = %" PRIu64 " bytes"), formatSize(qwOrigPartSize, szTemp2), qwOrigPartSize);
75 + m_labelOriginalPartitionSize = newtLabel(1, 7, szTemp);
76 +
77 + // stats
78 +--- a/src/client/imginfo.cpp
79 ++++ b/src/client/imginfo.cpp
80 +@@ -111,7 +111,7 @@
81 + {
82 + snprintf(szText, nMaxTextLen, i18n("-------------------- MBR %.3d -------------------\n"
83 + "Device:................%s\n"
84 +- "Device blocks count:...%"PRIu64"\n"
85 ++ "Device blocks count:...%" PRIu64 "\n"
86 + "Device model:..........%s\n\n"),
87 + i, mbr->szDevice, mbr->qwBlocksCount, mbr->szDescModel);
88 + }
89 +@@ -153,7 +153,7 @@
90 + snprintf(szText, nMaxTextLen, i18n("Volume number:.........%u\n"
91 + "Volume size:...........%s\n"
92 + "Compression level: ....%d -> %s\n"
93 +- "Identificator:.........%"PRIu64"=%"PRIX64"\n\n"),
94 ++ "Identificator:.........%" PRIu64 "=%" PRIX64 "\n\n"),
95 + head->dwVolumeNumber, formatSize(qwImageSize, cTemp), dwCompression,
96 + szCompression, head->qwIdentificator, head->qwIdentificator);
97 + }
98 +--- a/src/client/main.cpp
99 ++++ b/src/client/main.cpp
100 +@@ -301,7 +301,7 @@
101 + case 'V': // split image into multiple files
102 +
103 + options.qwSplitSize = (QWORD)atol(optarg) * 1024 * 1024;
104 +- fprintf (stderr, i18n("Volume size: %"PRIu64" bytes (%ld MiB)\n"),
105 ++ fprintf (stderr, i18n("Volume size: %" PRIu64 " bytes (%ld MiB)\n"),
106 + options.qwSplitSize, atol(optarg));
107 + break;
108 +
109 +--- a/src/client/misc.cpp
110 ++++ b/src/client/misc.cpp
111 +@@ -211,7 +211,7 @@
112 + image.closeReading(true);
113 + throw excep;
114 + }
115 +- SNPRINTF(szTemp, "%.3u: %s [%"PRIu64" blocks]", i, mbrOriginal[i].szDevice, mbrOriginal[i].qwBlocksCount);
116 ++ SNPRINTF(szTemp, "%.3u: %s [%" PRIu64 " blocks]", i, mbrOriginal[i].szDevice, mbrOriginal[i].qwBlocksCount);
117 + if (options->bBatchMode == false)
118 + optGui.addMbr(szTemp, i);
119 +
120 +--- a/src/client/fs/fs_base.cpp
121 ++++ b/src/client/fs/fs_base.cpp
122 +@@ -730,10 +730,10 @@
123 +
124 + if (bShowBlocksInfo)
125 + {
126 +- SNPRINTF(szBlocksInfo, i18n("Block size:...................%"PRIu64" bytes\n"
127 +- "Total blocks count:...........%"PRIu64"\n"
128 +- "Used blocks count:............%"PRIu64"\n"
129 +- "Free blocks count:............%"PRIu64"\n"),
130 ++ SNPRINTF(szBlocksInfo, i18n("Block size:...................%" PRIu64 " bytes\n"
131 ++ "Total blocks count:...........%" PRIu64 "\n"
132 ++ "Used blocks count:............%" PRIu64 "\n"
133 ++ "Free blocks count:............%" PRIu64 "\n"),
134 + m_header.qwBlockSize,
135 + m_header.qwBlocksCount,
136 + m_header.qwUsedBlocks,
137 +@@ -745,7 +745,7 @@
138 + }
139 +
140 + snprintf(szDest, nMaxLen, i18n("%s" // Blocks infos
141 +- "Space usage:..................%"PRIu64" %%\n"
142 ++ "Space usage:..................%" PRIu64 " %%\n"
143 + "Used space:...................%s\n"
144 + "Free space:...................%s\n"
145 + "Bitmap size:..................%s\n"
146 +--- a/src/client/fs/fs_hfs.cpp
147 ++++ b/src/client/fs/fs_hfs.cpp
148 +@@ -142,10 +142,10 @@
149 + getStdInfos(szText, sizeof(szText), true);
150 +
151 + SNPRINTF(szFullText, i18n("%s" // standard infos
152 +- "Allocation Group count:.......%"PRIu64"\n"
153 ++ "Allocation Group count:.......%" PRIu64 "\n"
154 + "Blocks per Allocation Group:..%u\n"
155 + "Allocation Group size:........%s\n"
156 +- "First allocation block:.......%"PRIu64"\n"),
157 ++ "First allocation block:.......%" PRIu64 "\n"),
158 + szText, m_info.qwAllocCount, m_info.dwBlocksPerAlloc,
159 + formatSize(m_info.dwAllocSize,szTemp1), m_info.qwFirstAllocBlock);
160 +
161 +--- a/src/client/fs/fs_ntfs.cpp
162 ++++ b/src/client/fs/fs_ntfs.cpp
163 +@@ -312,7 +312,7 @@
164 + "Bytes per sector:.............%u\n"
165 + "Sectors per cluster:..........%u\n"
166 + "File record size:.............%u\n"
167 +- "LCN of MFT Data attrib:.......%"PRIu64"\n"),
168 ++ "LCN of MFT Data attrib:.......%" PRIu64 "\n"),
169 + szText, m_info.nBytesPerSector, m_info.cSectorsPerCluster,
170 + m_info.dwFileRecordSize, m_info.qwLCNOfMftDataAttrib);
171 +
172 +@@ -730,7 +730,7 @@
173 + QWORD i;
174 +
175 + for (i=0L; i < m_qwClustersCount; i++)
176 +- fprintf(stderr, "cluster[%llu] = %"PRIu64"\n", (long long unsigned int)i, m_qwOffset[i]);
177 ++ fprintf(stderr, "cluster[%llu] = %" PRIu64 "\n", (long long unsigned int)i, m_qwOffset[i]);
178 +
179 + }
180 +
181 +--- a/src/client/fs/fs_ufs.cpp
182 ++++ b/src/client/fs/fs_ufs.cpp
183 +@@ -217,7 +217,7 @@
184 + "Cylinder group size:..........%s\n"
185 + "Basic blocks per CG:..........%u\n"
186 + "Basic block size:.............%u\n"
187 +- "Data frags count:.............%"PRIu64"\n"),
188 ++ "Data frags count:.............%" PRIu64 "\n"),
189 + szText, m_info.dwCylinderGroupsCount,
190 + formatSize(m_info.dwCylinderGroupSize*m_info.dwBasicBlockSize,szTemp1),
191 + m_info.dwCylinderGroupSize, m_info.dwBasicBlockSize, m_info.qwDataFrags);
192 +--- a/src/shared/common.cpp
193 ++++ b/src/shared/common.cpp
194 +@@ -272,7 +272,7 @@
195 +
196 + if (qwSize < llKiloB) // In Bytes
197 + {
198 +- snprintf(szText, nMaxLen, i18n("%"PRId64" bytes"), qwSize);
199 ++ snprintf(szText, nMaxLen, i18n("%" PRId64 " bytes"), qwSize);
200 + }
201 + else if (qwSize < llMegaB) // In KiloBytes
202 + {
203 +@@ -311,7 +311,7 @@
204 +
205 + if (qwSize < llKiloB) // In Bytes
206 + {
207 +- snprintf(szText, nMaxLen, i18n("%"PRId64" Bytes"), qwSize);
208 ++ snprintf(szText, nMaxLen, i18n("%" PRId64 " Bytes"), qwSize);
209 + }
210 + else if (qwSize < llMegaB) // In KiloBytes
211 + {
212
213 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
214 new file mode 100644
215 index 000000000000..05150e131e36
216 --- /dev/null
217 +++ b/sys-block/partimage/files/partimage-0.6.9-zlib-1.2.5.2-r1.patch
218 @@ -0,0 +1,33 @@
219 +http://bugs.gentoo.org/405323
220 +
221 +--- a/src/client/imagefile.cpp
222 ++++ b/src/client/imagefile.cpp
223 +@@ -783,7 +783,7 @@
224 + else if (m_options.dwCompression == COMPRESS_GZIP) // Gzip compression
225 + {
226 + showDebug(1, "open gzip\n");
227 +- m_gzImageFile = (gzFile *) gzdopen(m_nFdImage, "wb"); //"wb1h");
228 ++ m_gzImageFile = gzdopen(m_nFdImage, "wb"); //"wb1h");
229 + if (m_gzImageFile == NULL)
230 + {
231 + showDebug(1, "error:%d %s\n", errno, strerror(errno));
232 +@@ -1098,7 +1098,7 @@
233 + }
234 + else if (m_options.dwCompression == COMPRESS_GZIP) // Gzip compression
235 + {
236 +- m_gzImageFile = (gzFile *) gzdopen(m_nFdImage, "rb");
237 ++ m_gzImageFile = gzdopen(m_nFdImage, "rb");
238 + if (m_gzImageFile == NULL)
239 + THROW(ERR_ERRNO, errno);
240 + else
241 +--- a/src/client/imagefile.h
242 ++++ b/src/client/imagefile.h
243 +@@ -41,7 +41,7 @@
244 + COptions m_options;
245 +
246 + FILE *m_fImageFile;
247 +- gzFile *m_gzImageFile;
248 ++ gzFile m_gzImageFile;
249 + BZFILE *m_bzImageFile;
250 +
251 + int m_nFdImage;
252
253 diff --git a/sys-block/partimage/partimage-0.6.9-r3.ebuild b/sys-block/partimage/partimage-0.6.9-r3.ebuild
254 new file mode 100644
255 index 000000000000..acd0d0f68be4
256 --- /dev/null
257 +++ b/sys-block/partimage/partimage-0.6.9-r3.ebuild
258 @@ -0,0 +1,141 @@
259 +# Copyright 1999-2022 Gentoo Authors
260 +# Distributed under the terms of the GNU General Public License v2
261 +
262 +EAPI=8
263 +
264 +inherit autotools flag-o-matic pam
265 +
266 +DESCRIPTION="Console-based application to efficiently save raw partition data to image file"
267 +HOMEPAGE="https://www.partimage.org/"
268 +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
269 +
270 +LICENSE="GPL-2+"
271 +SLOT="0"
272 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~sparc ~x86"
273 +IUSE="nls nologin pam ssl static"
274 +REQUIRED_USE="static? ( !pam )"
275 +
276 +COMMON_DEPEND="
277 + acct-group/partimag
278 + acct-user/partimag
279 +"
280 +LIBS_DEPEND="
281 + app-arch/bzip2
282 + >=dev-libs/newt-0.52
283 + >=sys-libs/slang-2
284 + sys-libs/zlib:=
285 + !nologin? ( virtual/libcrypt:= )
286 + ssl? ( dev-libs/openssl:0= )
287 +"
288 +PAM_DEPEND="pam? ( sys-libs/pam )"
289 +RDEPEND="
290 + ${COMMON_DEPEND}
291 + ${PAM_DEPEND}
292 + !static? ( ${LIBS_DEPEND} )
293 +"
294 +DEPEND="
295 + ${PAM_DEPEND}
296 + ${LIBS_DEPEND}
297 +"
298 +BDEPEND="
299 + ${COMMON_DEPEND}
300 + nls? ( sys-devel/gettext )
301 +"
302 +
303 +PATCHES=(
304 + "${FILESDIR}"/${PN}-0.6.9-zlib-1.2.5.2-r1.patch #405323
305 + "${FILESDIR}"/${PN}-0.6.9-minor-typo.patch #580290
306 + "${FILESDIR}"/${PN}-0.6.9-openssl-1.1-compatibility.patch
307 + "${FILESDIR}"/${PN}-0.6.9-missing-includes.patch
308 + "${FILESDIR}"/${PN}-0.6.9-clang.patch
309 +)
310 +
311 +src_prepare() {
312 + default
313 + eautoreconf
314 +}
315 +
316 +src_configure() {
317 + # XXX: Do we still need these?
318 + filter-flags -fno-exceptions
319 + use ppc && append-flags -fsigned-char
320 +
321 + local myeconfargs=(
322 + $(use_enable nls)
323 + $(usex nologin '--disable-login' '')
324 + $(use_enable pam)
325 + $(use_enable ssl)
326 + $(use_enable static all-static)
327 + --with-log-dir="${EPREFIX}"/var/log/partimage
328 + )
329 +
330 + econf "${myeconfargs[@]}"
331 +}
332 +
333 +src_install() {
334 + default
335 +
336 + keepdir /var/lib/partimage
337 + keepdir /var/log/partimage
338 +
339 + newinitd "${FILESDIR}"/partimaged.init.2 partimaged
340 + newconfd "${FILESDIR}"/partimaged.conf partimaged
341 +
342 + if use pam; then
343 + newpamd "${FILESDIR}"/partimaged.pam.2 partimaged
344 + fi
345 +
346 + if use ssl; then
347 + insinto /etc/partimaged
348 + doins "${FILESDIR}"/servercert.cnf
349 + fi
350 +
351 + fowners partimag:root /etc/partimaged/partimagedusers
352 +}
353 +
354 +pkg_config() {
355 + if use ssl; then
356 + local confdir="${EROOT}"/etc/partimaged
357 + local privkey="${confdir}"/partimaged.key
358 + local cnf="${confdir}"/servercert.cnf
359 + local csr="${confdir}"/partimaged.csr
360 + local cert="${confdir}"/partimaged.cert
361 +
362 + ewarn "Please customize /etc/partimaged/servercert.cnf before you continue!"
363 + ewarn "Press Ctrl-C to break now for it, or press enter to continue."
364 + read
365 + if [ ! -f "${privkey}" ]; then
366 + einfo "Generating unencrypted private key: ${privkey}"
367 + openssl genrsa -out "${privkey}" 2048 || die
368 + else
369 + einfo "Private key already exists: ${privkey}"
370 + fi
371 + if [ ! -f "${csr}" ]; then
372 + einfo "Generating certificate request: ${csr}"
373 + openssl req -new -x509 -outform PEM -out "${csr}" -key "${privkey}" -config "${cnf}" || die
374 + else
375 + einfo "Certificate request already exists: ${csr}"
376 + fi
377 + if [ ! -f "${cert}" ]; then
378 + einfo "Generating self-signed certificate: ${cert}"
379 + openssl x509 -in "${csr}" -out "${cert}" -signkey "${privkey}" || die
380 + else
381 + einfo "Self-signed certifcate already exists: ${cert}"
382 + fi
383 + einfo "Setting permissions"
384 + chmod 600 "${privkey}" || die
385 + chown partimag:root "${privkey}" || die
386 + chmod 644 "${cert}" "${csr}" || die
387 + chown root:root "${cert}" "${csr}" || die
388 + einfo "Done"
389 + else
390 + einfo "SSL is disabled, not building certificates"
391 + fi
392 +}
393 +
394 +pkg_postinst() {
395 + if use ssl; then
396 + einfo "To create the required SSL certificates, please do:"
397 + einfo "emerge --config =${PF}"
398 + fi
399 +}