mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
common-updater-scripts,directoryListingUpdater: add extraRegex parameter
This commit is contained in:
parent
c1188a559b
commit
19e4b53b09
@ -11,9 +11,10 @@
|
||||
, odd-unstable ? false
|
||||
, patchlevel-unstable ? false
|
||||
, url ? null
|
||||
, extraRegex ? null
|
||||
}:
|
||||
|
||||
genericUpdater {
|
||||
inherit pname version attrPath ignoredVersions rev-prefix odd-unstable patchlevel-unstable;
|
||||
versionLister = "${common-updater-scripts}/bin/list-directory-versions ${lib.optionalString (url != null) "--url=${lib.escapeShellArg url}"}";
|
||||
versionLister = "${common-updater-scripts}/bin/list-directory-versions ${lib.optionalString (url != null) "--url=${lib.escapeShellArg url}"} ${lib.optionalString (extraRegex != null) "--extra-regex=${lib.escapeShellArg extraRegex}"}";
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ parser.add_argument(
|
||||
parser.add_argument("--url", help="url of the page that lists the package versions")
|
||||
parser.add_argument("--file", help="file name for writing debugging information")
|
||||
|
||||
parser.add_argument("--extra-regex", help="additional regex to filter versions with")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
@ -62,4 +64,6 @@ if __name__ == "__main__":
|
||||
rf"(.*/)?{args.pname}-([\d.]+?(-[\d\w.-]+?)?)(\.tar)?(\.[^.]*)", link_url
|
||||
)
|
||||
if match:
|
||||
print(match.group(2))
|
||||
version = match.group(2)
|
||||
if (not args.extra_regex) or re.fullmatch(args.extra_regex, version):
|
||||
print(version)
|
||||
|
Loading…
Reference in New Issue
Block a user