From 5ee1ee7136f492b07783a3bac7d2bebb579b13ee Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Sat, 21 Dec 2024 18:02:29 +0100 Subject: [PATCH] ADDED: ``swipl pack rebuild [--dir=dir] [pack ...]`` --- app/pack.pl | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/app/pack.pl b/app/pack.pl index bf4537add1..177df06062 100644 --- a/app/pack.pl +++ b/app/pack.pl @@ -38,6 +38,7 @@ :- use_module(library(apply)). :- use_module(library(strings)). :- use_module(library(dcg/basics)). +:- use_module(library(lists)). :- initialization(main, main). @@ -63,6 +64,9 @@ pack(install, Argv) => pack_install:argv_options(Argv, Pos, Options), cli_pack_install(Pos, Options). +pack(rebuild, Argv) => + pack_rebuild:argv_options(Argv, Pos, Options), + cli_pack_rebuild(Pos, Options). pack(remove, Argv) => pack_remove:argv_options(Argv, Pos, Options), cli_pack_remove(Pos, Options). @@ -76,12 +80,13 @@ pack(_, _) => argv_usage(debug). -pack_command(list, "List packages"). -pack_command(find, "Find packages"). +pack_command(list, "List packs"). +pack_command(find, "Find packs"). pack_command(search, "Alias for `find`"). pack_command(info, "Print info on a pack"). -pack_command(install, "Install or upgrade a package"). -pack_command(remove, "Uninstall a package"). +pack_command(install, "Install or upgrade a pack"). +pack_command(rebuild, "Recompile foreign parts for a pack"). +pack_command(remove, "Uninstall a pack"). pack_command(publish, "Register a pack with swi-prolog.org"). pack_command(help, "Help on command (also swipl pack command -h)"). @@ -162,6 +167,12 @@ pack_install:opt_meta(commit, 'HASH'). pack_install:opt_meta(server, 'URL'). +pack_rebuild:opt_type(dir, pack_directory, directory). + +pack_rebuild:opt_help(help(usage), + " rebuild [--dir=DIR] [pack ...]"). +pack_rebuild:opt_help(pack_directory, "Rebuild packs in directory"). + pack_publish:opt_type(git, git, boolean). pack_publish:opt_type(sign, sign, boolean). pack_publish:opt_type(force, force, boolean). @@ -245,6 +256,15 @@ cli_pack_install(_, _) => argv_usage(pack_install:debug). +cli_pack_rebuild(Packs, Options), + select_option(pack_directory(Dir), Options, Options1) => + attach_packs(Dir, [replace(true)]), + cli_pack_rebuild(Packs, [installed(true)|Options1]). +cli_pack_rebuild([], _Options) => + cli(pack_rebuild). +cli_pack_rebuild(Packs, _Options) => + cli(forall(member(Pack, Packs), pack_rebuild(Pack))). + cli_pack_remove(Packs, Options), Packs \== [] => cli(forall(member(Pack, Packs), pack_remove(Pack, Options))). cli_pack_remove(_, _) =>