pycargoebuild 0.12__tar.gz → 0.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/PKG-INFO +1 -1
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/pycargoebuild/__init__.py +1 -1
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/pycargoebuild/__main__.py +21 -3
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/pycargoebuild/ebuild.py +20 -5
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/LICENSE +0 -0
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/README.rst +0 -0
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/pycargoebuild/cargo.py +0 -0
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/pycargoebuild/fetch.py +0 -0
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/pycargoebuild/format.py +0 -0
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/pycargoebuild/license.py +0 -0
- {pycargoebuild-0.12 → pycargoebuild-0.13.0}/pyproject.toml +0 -0
|
@@ -6,6 +6,7 @@ import logging
|
|
|
6
6
|
import lzma
|
|
7
7
|
import os.path
|
|
8
8
|
import shutil
|
|
9
|
+
import subprocess
|
|
9
10
|
import sys
|
|
10
11
|
import tarfile
|
|
11
12
|
import tempfile
|
|
@@ -78,6 +79,10 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
78
79
|
action="store_true",
|
|
79
80
|
help="Do not include LICENSEs (e.g. when crates are "
|
|
80
81
|
"only used at build time")
|
|
82
|
+
argp.add_argument("-M", "--no-manifest",
|
|
83
|
+
action="store_true",
|
|
84
|
+
help="Do not call `pkgdev manifest` (called only if "
|
|
85
|
+
"Manifest exists)")
|
|
81
86
|
argp.add_argument("-o", "--output",
|
|
82
87
|
help="Ebuild file to write (default: INPUT if --input "
|
|
83
88
|
"is specified, {name}-{version}.ebuild otherwise)")
|
|
@@ -272,6 +277,9 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
272
277
|
fetch_crates(crates)
|
|
273
278
|
verify_crates(crates, distdir=args.distdir)
|
|
274
279
|
|
|
280
|
+
umask = os.umask(0)
|
|
281
|
+
os.umask(umask)
|
|
282
|
+
|
|
275
283
|
if args.crate_tarball:
|
|
276
284
|
crate_tarball = Path(
|
|
277
285
|
args.crate_tarball_path.format(name=pkg_meta.name,
|
|
@@ -293,6 +301,7 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
293
301
|
encoding="UTF-8",
|
|
294
302
|
preset=9 | lzma.PRESET_EXTREME,
|
|
295
303
|
) as tar_out: # type: ignore
|
|
304
|
+
os.fchmod(cratef.fileno(), 0o666 & ~umask)
|
|
296
305
|
logging.info("Repacking crates ...")
|
|
297
306
|
repack_crates(tar_out, crates)
|
|
298
307
|
except BaseException:
|
|
@@ -300,7 +309,10 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
300
309
|
raise
|
|
301
310
|
Path(cratef.name).rename(crate_tarball)
|
|
302
311
|
logging.info(f"Crate tarball written to {crate_tarball}")
|
|
303
|
-
|
|
312
|
+
|
|
313
|
+
# do not regenerate Manifest, crate tarball needs to be uploaded
|
|
314
|
+
# first
|
|
315
|
+
args.no_manifest = True
|
|
304
316
|
|
|
305
317
|
if args.input is not None:
|
|
306
318
|
ebuild = update_ebuild(
|
|
@@ -309,6 +321,7 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
309
321
|
crates,
|
|
310
322
|
distdir=args.distdir,
|
|
311
323
|
crate_license=not args.no_license,
|
|
324
|
+
crate_tarball=crate_tarball if args.crate_tarball else None,
|
|
312
325
|
license_overrides=config_toml.get("license-overrides", {}),
|
|
313
326
|
)
|
|
314
327
|
logging.warning(
|
|
@@ -320,6 +333,7 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
320
333
|
crates,
|
|
321
334
|
distdir=args.distdir,
|
|
322
335
|
crate_license=not args.no_license,
|
|
336
|
+
crate_tarball=crate_tarball if args.crate_tarball else None,
|
|
323
337
|
license_overrides=config_toml.get("license-overrides", {}),
|
|
324
338
|
)
|
|
325
339
|
|
|
@@ -335,8 +349,6 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
335
349
|
outf.fileno()) # type: ignore
|
|
336
350
|
args.input.close()
|
|
337
351
|
else:
|
|
338
|
-
umask = os.umask(0)
|
|
339
|
-
os.umask(umask)
|
|
340
352
|
os.fchmod(outf.fileno(), 0o666 & ~umask)
|
|
341
353
|
outf.write(ebuild)
|
|
342
354
|
except BaseException:
|
|
@@ -344,6 +356,12 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
344
356
|
raise
|
|
345
357
|
Path(outf.name).rename(outfile)
|
|
346
358
|
|
|
359
|
+
if not args.no_manifest and (outfile.parent / "Manifest").exists():
|
|
360
|
+
try:
|
|
361
|
+
subprocess.call(["pkgdev", "manifest"], cwd=outfile.parent)
|
|
362
|
+
except FileNotFoundError:
|
|
363
|
+
logging.warning("pkgdev not found, Manifest will not be updated")
|
|
364
|
+
|
|
347
365
|
print(f"{outfile}")
|
|
348
366
|
return 0
|
|
349
367
|
|
|
@@ -38,11 +38,19 @@ DESCRIPTION="{description}"
|
|
|
38
38
|
HOMEPAGE="{homepage}"
|
|
39
39
|
SRC_URI="
|
|
40
40
|
\t${{CARGO_CRATE_URIS}}
|
|
41
|
-
"
|
|
41
|
+
"{opt_crate_tarball}
|
|
42
42
|
|
|
43
43
|
LICENSE="{pkg_license}"
|
|
44
44
|
"""
|
|
45
45
|
|
|
46
|
+
EBUILD_TEMPLATE_CRATE_TARBALL = """
|
|
47
|
+
if [[ ${{PKGBUMPING}} != ${{PVR}} ]]; then
|
|
48
|
+
\tSRC_URI+="
|
|
49
|
+
\t\t{}
|
|
50
|
+
\t"
|
|
51
|
+
fi\
|
|
52
|
+
"""
|
|
53
|
+
|
|
46
54
|
EBUILD_TEMPLATE_CRATE_LICENSE = """\
|
|
47
55
|
# Dependent crate licenses
|
|
48
56
|
LICENSE+="{crate_licenses}"
|
|
@@ -54,12 +62,14 @@ KEYWORDS="~amd64"
|
|
|
54
62
|
"""
|
|
55
63
|
|
|
56
64
|
|
|
57
|
-
def get_CRATES(crates: typing.Iterable[Crate]
|
|
65
|
+
def get_CRATES(crates: typing.Iterable[Crate],
|
|
66
|
+
) -> str:
|
|
58
67
|
"""
|
|
59
68
|
Return the value of CRATES for the given crate list
|
|
60
69
|
"""
|
|
61
70
|
if not crates:
|
|
62
|
-
|
|
71
|
+
# cargo.eclass rejects empty crates, we need some whitespace
|
|
72
|
+
return "\n"
|
|
63
73
|
return ("\n" +
|
|
64
74
|
"\n".join(sorted(f"\t{c.crate_entry}"
|
|
65
75
|
for c in crates
|
|
@@ -184,6 +194,7 @@ def get_ebuild(pkg_meta: PackageMetadata,
|
|
|
184
194
|
distdir: Path,
|
|
185
195
|
*,
|
|
186
196
|
crate_license: bool = True,
|
|
197
|
+
crate_tarball: typing.Optional[Path] = None,
|
|
187
198
|
license_overrides: typing.Dict[str, str] = {},
|
|
188
199
|
) -> str:
|
|
189
200
|
"""
|
|
@@ -196,11 +207,13 @@ def get_ebuild(pkg_meta: PackageMetadata,
|
|
|
196
207
|
template += EBUILD_TEMPLATE_END
|
|
197
208
|
|
|
198
209
|
return template.format(
|
|
199
|
-
crates=get_CRATES(crates),
|
|
210
|
+
crates=get_CRATES(crates if crate_tarball is None else ()),
|
|
200
211
|
crate_licenses=get_crate_LICENSE(crates, distdir, license_overrides),
|
|
201
212
|
description=bash_dquote_escape(collapse_whitespace(
|
|
202
213
|
pkg_meta.description or "")),
|
|
203
214
|
homepage=url_dquote_escape(pkg_meta.homepage or ""),
|
|
215
|
+
opt_crate_tarball=EBUILD_TEMPLATE_CRATE_TARBALL.format(
|
|
216
|
+
crate_tarball.name) if crate_tarball is not None else "",
|
|
204
217
|
opt_git_crates=get_GIT_CRATES(crates, distdir),
|
|
205
218
|
pkg_license=get_package_LICENSE(pkg_meta.license),
|
|
206
219
|
prog_version=__version__,
|
|
@@ -255,13 +268,15 @@ def update_ebuild(ebuild: str,
|
|
|
255
268
|
distdir: Path,
|
|
256
269
|
*,
|
|
257
270
|
crate_license: bool = True,
|
|
271
|
+
crate_tarball: typing.Optional[Path] = None,
|
|
258
272
|
license_overrides: typing.Dict[str, str] = {},
|
|
259
273
|
) -> str:
|
|
260
274
|
"""
|
|
261
275
|
Update the CRATES, GIT_CRATES and LICENSE in an existing ebuild
|
|
262
276
|
"""
|
|
263
277
|
|
|
264
|
-
crates_repl = CountingSubst(
|
|
278
|
+
crates_repl = CountingSubst(
|
|
279
|
+
partial(get_CRATES, crates if crate_tarball is None else ()))
|
|
265
280
|
git_crates_repl = GitCratesSubst(partial(get_GIT_CRATES, crates, distdir))
|
|
266
281
|
crate_license_repl = (
|
|
267
282
|
CountingSubst(partial(get_crate_LICENSE, crates, distdir,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|