lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD-N9QU5RA_z3pS3sGzXA_H=mHCDWyCCfDrv5JwL0hiAxx2qBQ@mail.gmail.com>
Date: Fri, 13 Sep 2024 19:23:27 +0800
From: Dongliang Mu <mudongliangabcd@...il.com>
To: Cheng Ziqiu <chengziqiu@...t.edu.cn>
Cc: Alex Shi <alexs@...nel.org>, YanTeng Si <si.yanteng@...ux.dev>, 
	Jonathan Corbet <corbet@....net>, Dongliang Mu <dzm91@...t.edu.cn>, linux-doc@...r.kernel.org, 
	linux-kernel@...r.kernel.org, hust-os-kernel-patches@...glegroups.com
Subject: Re: [PATCH] scripts: use ':Original:' tag to locate the origin file

On Fri, Sep 13, 2024 at 4:17 PM Cheng Ziqiu <chengziqiu@...t.edu.cn> wrote:
>
> Simply substitute path may cause file finding failed
> if we have a different dir map for translation. The
> ':Original:' tag could be used to locate the origin
> file if both the tag and file exist.

+cc yanteng's new email

>
> Signed-off-by: Cheng Ziqiu <chengziqiu@...t.edu.cn>
> ---
>  scripts/checktransupdate.py | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/scripts/checktransupdate.py b/scripts/checktransupdate.py
> index 578c3fecfdfd..f28176691b03 100755
> --- a/scripts/checktransupdate.py
> +++ b/scripts/checktransupdate.py
> @@ -25,6 +25,7 @@ commit 42fb9cfd5b18 ("Documentation: dev-tools: Add link to RV docs")
>
>  import os
>  import time
> +import re
>  import logging
>  from argparse import ArgumentParser, ArgumentTypeError, BooleanOptionalAction
>  from datetime import datetime
> @@ -32,6 +33,18 @@ from datetime import datetime
>
>  def get_origin_path(file_path):
>      """Get the origin path from the translation path"""
> +    with open(file_path, "r") as f:
> +        content = f.read()
> +    # find the origin path in the content
> +    match = re.search(r":Original:\s*(?::ref:`|:doc:`)?([^\s`]+)", content)
> +    if match:
> +        f = match.group(1)
> +        if os.path.exists(f):
> +            logging.debug("Origin tag found: %s", f)
> +            return f
> +        else:
> +            logging.warning("Origin tag found but file not exists: %s", f)
> +
>      paths = file_path.split("/")
>      tidx = paths.index("translations")
>      opaths = paths[:tidx]
> --
> 2.34.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ