M conf/webkitgtk.yml => conf/webkitgtk.yml +5 -0
@@ 1,6 1,11 @@
pattern: webkitgtk-%.tar.xz
package: WebKitGTK
+extract-tarballs:
+ "%{packageid}-%{version}/Documentation/jsc-glib-4.1": jsc-glib-html-%{version}.tar.xz
+ "%{packageid}-%{version}/Documentation/webkit2gtk-4.1": webkit2gtk-html-%{version}.tar.xz
+ "%{packageid}-%{version}/Documentation/webkit2gtk-web-extension-4.1": webkit2gtk-web-extension-html-%{version}.tar.xz
+
email:
recipients:
- webkit-gtk@lists.webkit.org
M conf/wpewebkit.yml => conf/wpewebkit.yml +5 -0
@@ 1,6 1,11 @@
pattern: wpewebkit-%.tar.xz
package: WPE WebKit
+extract-tarballs:
+ "%{packageid}-%{version}/Documentation/wpe-javascriptcore-1.1": wpe-javascriptcore-html-%{version}.tar.xz
+ "%{packageid}-%{version}/Documentation/wpe-web-extension-1.1": wpe-web-extension-html-%{version}.tar.xz
+ "%{packageid}-%{version}/Documentation/wpe-webkit-1.1": wpe-webkit-html-%{version}.tar.xz
+
email:
recipients:
- webkit-wpe@lists.webkit.org
M wkrel/commands.py => wkrel/commands.py +38 -1
@@ 10,7 10,7 @@ import sys
import tarfile
from cmdcmd import Option, Command, CLI
-from pathlib import Path
+from pathlib import Path, PurePosixPath
from typing import Optional
from .release import Release
from . import config, yaml
@@ 184,6 184,43 @@ class cmd_sign(Command):
return 1
+class cmd_extract_tarballs(Command):
+ """
+ Extract subdirectories as indidividual tarballs.
+ """
+ aliases = ("extract-tars", "tarballs")
+ takes_args = ("tarball",)
+ takes_options = (opt_config_dir, opt_verbose)
+
+ def run(self, tarball, config_dir=None, verbose=False):
+ tar = Path(tarball)
+ if not tar.is_file():
+ raise SystemExit("Not a file: {!s}".format(tarball))
+ if not tarfile.is_tarfile(str(tar)):
+ raise SystemExit("Not a supported tarball format: {!s}"
+ .format(tarball))
+
+ release = Release.from_tarball(tar, config_dir)
+ srctar = tarfile.open(release.file.path, "r:*")
+ dsts = dict((release.render_template(inpath) + "/",
+ tarfile.open(tar.with_name(release.render_template(tarname)), "w:xz"))
+ for inpath, tarname in release.config.extract_tarballs.items())
+
+ for member in srctar:
+ for prefix, dst in dsts.items():
+ if member.isfile() and member.name.startswith(prefix):
+ srcpath = str(PurePosixPath(prefix).parent) + "/"
+ with srctar.extractfile(member) as stream:
+ member.path = member.path[len(srcpath):]
+ dst.addfile(member, stream)
+ if verbose:
+ print(member.path)
+
+ # Close files
+ for _, tar in dsts.items():
+ tar.close()
+
+
def main():
raise SystemExit(CLI().run() or 0)
M wkrel/config.py => wkrel/config.py +5 -1
@@ 47,6 47,10 @@ class Config(object):
email: Optional[ConfigEmail] = \
attr.ib(default=None,
converter=attr.converters.optional(ConfigEmail._from_yaml))
+ extract_tarballs: Dict[Template, Template] = \
+ attr.ib(default=attr.Factory(dict),
+ converter=lambda d:
+ dict((Template(k), Template(v)) for k, v in d.items()))
@pattern.validator
def __check_pattern(self, attribute, value):
@@ 67,7 71,7 @@ class Config(object):
@classmethod
def from_yaml(cls, value):
- return cls(**dict(value.items()))
+ return cls(**dict((k.replace("-", "_"), v) for k, v in value.items()))
def matches(self, s: str) -> bool:
min_match_len = len(self.pattern_prefix) + len(self.pattern_suffix)
M wkrel/release.py => wkrel/release.py +4 -1
@@ 84,12 84,15 @@ class Release(object):
raise ValueError("File is not a supported Tar format: {!s}".format(value.path))
def render_item(self, name: str) -> str:
+ t: Template = self.config.files[name]
+ return self.render_template(t)
+
+ def render_template(self, t: Template) -> str:
today = date.today()
date_string = "{} {}{}, {}".format(_MONTHS[today.month - 1],
today.day,
_day_suffix(today.day),
today.year)
- t: Template = self.config.files[name]
extra_vars = {
"date": date_string,
"release-notes": lambda: self.notes,