diff --git a/docs/Kip.md b/docs/Kip.md index 91486e6e..2d3791ca 100644 --- a/docs/Kip.md +++ b/docs/Kip.md @@ -73,10 +73,10 @@ Remove the repository which you specified by ``. Note that you can remove also a default central repository. If you removed it, you should add it again. -#### `kip repo list` +#### `kip repo list [detail]` Show the list of central repositories. -Moreover, it shows also the list of packages registered to each repository. +Moreover, if you use a `detail` option, it shows also the list of packages registered to each repository. ### Package Control @@ -103,48 +103,30 @@ If you want to uninstall all versions in the package, specify it as `all` instea Install a development package which you are developing in progress. You must move to the root of the package repository before running the `kip devinst`. -And this command will search a `build/build.kx` file at first. -Therefore, you must prepare `build/build.kx` file under the repository root in advance. +And this command will search a `package.json` file at first. +Therefore, you must prepare `package.json` file under the repository root in advance. This command will install the package as a development package, which means the files are directly copied under the Kinx library path. -`build/build.kx` is the code to install the package like the following code for example. -This code is the stuff prepared in the `typesetting` package. +`package.json` file has just a package name. +The version will be automatically used as `99.99.99` for development. ```javascript -using pkg.Develop; - -var pkgname = "typesetting"; -var version = "0.0.2"; - -new PackageUpdater($$, pkgname, version).update { &(util) - Directory.change("src") { - Directory.walk(".") { - // _1 will be `bin`, `etc` and `lib`. - util.dircopy(_1, util.root / _1.filename()); - }; - }; - util.dircopy("docs", util.root / "docs"); -}; +{ + "name": "typesetting" +} ``` -As you see, you can use `PackageUpdater` class and use `util.dircopy()` to install your developped components into the Kinx package directory. - -By the way, the package directory will be marked as a development version. - #### `kip devuninst` -Uninstall a development package which version is specified by `build/build.kx`. +Uninstall a development package. You must move to the root of the package repository before running the `kip devuninst` command as well as when it's `kip devinst`. -The command line will know the package name and the version which should be uninstalled automatically and try to uninstall it. - -This command can not uninstall it when it is not a development version. -However, you can uninstall it if you use `kip uninstall ` with the name and the version. +The command line will know the package name by the `package.json` file and will automatically uninstall it. #### `kip list` Show the list of installed packages with installed versions. -It shows also a development version and you can also see that it is a development version. +It shows also a development version and you can also see that a development version is installed as a ``. #### `kip update []` diff --git a/docs/Package.md b/docs/Package.md index fa85851d..2e3a15f0 100644 --- a/docs/Package.md +++ b/docs/Package.md @@ -16,7 +16,7 @@ This section describe about the package by a user perspective and a developper p #### How To Install/Uninstall Package To install the package you want to use, do it with `kip install` command. -Here is the example of installing a `typesetting` package. +Here is the example of installing the `typesetting` package. ``` $ kip install typesetting @@ -30,8 +30,8 @@ $ kip install typesetting [2021/08/07 14:23:42] Generated a command of kxkitty.exe ``` -To install the package you want to use, do it with `kip uninstall` command. -Here is the example of uninstall a `typesetting` package. +To uninstall the package, do it with `kip uninstall` command. +Here is the example of uninstall the `typesetting` package. ``` $ kip uninstall typesetting all @@ -82,7 +82,7 @@ using @typesetting.Typesetting; ``` Note that the latest version will be usually used if not specified the version. -However, if you specify the version and the library code is including other library code by `using` directive without specifying the version, then the specified version will be used instead of the latest version. +However, if you specify the version and a loaded library is using a `using` directive without the version inside, the library loader will search it under the same version's library directory. For example, when both the version 0.0.1 and 0.0.2 are installed, it will be as below. @@ -105,36 +105,33 @@ using @typesetting.Logger; // => use Logger.kx of the version 0.0.1 which you sp #### Install Your Package To Develop You can use `kip devinst` command to instal your package as a development version. -For that, you must prepare the `build/build.kx` file to make the files locate to the correct location. +For that, you must prepare the `package.json` file to make the files locate to the correct location. Here is the example which is used in the `typesetting` package. +The version will be fixed as `99.99.99` for the development, so the package will be installed to `$libpath/package/typesetting/99.99.99`. ```javascript -using pkg.Develop; - -var pkgname = "typesetting"; -var version = "0.0.2"; - -new PackageUpdater($$, pkgname, version).update { &(util) - Directory.change("src") { - Directory.walk(".") { - // _1 will be `bin`, `etc` and `lib`. - util.dircopy(_1, util.root / _1.filename()); - }; - }; - util.dircopy("docs", util.root / "docs"); -}; +{ + "name": "typesetting" +} ``` -The callback function is receiving `util` object and you can use it. -`util.root` is the root location of packages, which is located to `$libpath/package/typesetting/0.0.2` in this case. -It means the root directory is automatically created by your package name and versions. +`kip devinst` will copy the directories under `src` directory to the same name under the package path. +Moreover, `docs` directory will be copied as is to the `docs` under the package path. -In the `typesetting` package, the directories of `bin`, `etc`, and `lib` under `src` directory will be copied to the same name under the path under `uril.root`. -Besides, `docs` directory will be copied as is to the `docs` under the path of `util.root`. +Here is the example of the location copied by the package installation. +It is the example of the case when the directories under `src` would be `bin`, `lib`, and `exc`. -You can install it correctly by running just `kip devinst` at the root of the package repository which has a `build` directory. -You can also uninstall it correctly by running just `kip devuninst` at the root of the package repository which has a `build` directory. +``` +[SOURCE] [PACKAGE] +src/bin -----------> $libpath/package/typesetting/0.0.2/bin + /lib -----------> /lib + /etc -----------> /etc +docs -----------> /docs +``` + +You can install it correctly by running just `kip devinst` at the root of the package repository which has a `package.json` file. +You can also uninstall it correctly by running just `kip devuninst` at the root of the package repository which has a `package.json` file. #### Special Directory @@ -142,10 +139,14 @@ You can also uninstall it correctly by running just `kip devuninst` at the root If you locate the script file under the `bin` directory, the executable command will be automatically created to the same path as `kinx`. For example, if you put the `something.kx` under the `bin`, `something.exe` will be automatically created. +In the `kip` world, this script file will be called a hook script. Note that it will be `something` without `.exe` on Linux. In this document, it is described as `something.exe` style because it is easy to understand. +Moreover, if the `kip` installer find an executable file under the `bin` directory, the `kip` will automatically change the attribute of the file to the `executable` when it's on Linux. +By the way, the `kip` will check if the file has the magic number of the ELF file format, or if the file extension is `.sh`. + ##### `lib` This `lib` directory is a search path of the package. diff --git a/lib/exec/kip.kx b/lib/exec/kip.kx index c8738fc5..6d5b52bc 100644 --- a/lib/exec/kip.kx +++ b/lib/exec/kip.kx @@ -3,54 +3,51 @@ Do not use this. */ -/* - Package Manager for Kinx - - For configuration. - $ kip config set|s Sets a value to a name in a configuration. - $ kip config remove|rm|r Removes a name from a configuration. - $ kip config show|sh|list|ls|l [] Lists up a name and a value in a configuration. - - For a central repository access. - $ kip repo add|a Adds a central repository for packages. - $ kip repo remove|rm|r Removes a central repository for packages. - $ kip repo list|ls|l Lists up a central repository list and its holding packages. - - For installed packages. - $ kip search|s Searches a package from central repositories. - $ kip install|i [] Installs a specified package with the latest version if not specified. - $ kip uninstall|u [] Uninstalls a specified package with the version if specified. - # $ kip update|up [] Installs the latest version of a specified package. - $ kip list|ls Lists up an installed packages. -*/ using SemanticVersion; using DateTime; using Process; +using pkg.Develop; const MAIN_PACKAGE_CENTRAL_REPO = "https://github.com/Kray-G/kinx-package-repository"; +const PACKAGE_BUILD_SCRIPT_FILE = "build/build.kx"; +const PACKAGE_INFO_FILE = "package.json"; +const DEVELOPMENT_VERSION = "99.99.99"; Kip.progress = _function(...args) { - System.print("[" + new DateTime().toString().bold().green() + "] ", ...args); + var date = "[" + new DateTime().toString().bold().green() + "] "; + System.print(date, ...args); }; Kip.progressln = _function(...args) { - System.println("[" + new DateTime().toString().bold().green() + "] ", ...args); + var date = "[" + new DateTime().toString().bold().green() + "] "; + System.println(date, ...args); }; Kip.warningln = _function(...args) { - System.println("[" + new DateTime().toString().bold().yellow() + "] ", ...args); + var date = "[" + new DateTime().toString().bold().yellow() + "] "; + System.println(date, ...args); }; Kip.errorln = _function(...args) { - System.println("[" + new DateTime().toString().bold().red() + "] ", ...args); + var date = "[" + new DateTime().toString().bold().red() + "] "; + System.println(date, ...args); }; Kip.info = _function(...args) { + System.print(...args); +}; +Kip.infoln = _function(...args) { System.println(...args); }; Kip.verbose = _function(...args) { var opts = args.shift(); if (opts.verbose) { - System.println("[" + new DateTime().toString().cyan() + "] ", ...args); + var date = "[" + new DateTime().toString().cyan() + "] "; + System.println(date, ...args); } }; +PackageUpdater.print = Kip.progress; +PackageUpdater.println = Kip.progressln; +PackageUpdater.errorln = Kip.errorln; +PackageUpdater.warningln = Kip.warningln; + class KinxPackageManagerConfig(configFile_, defFile_) { var config_, def_; @@ -124,7 +121,7 @@ class KinxPackageManagerConfig(configFile_, defFile_) { public list() { if (config_.values) { config_.values.keySet().each { - Kip.info(_1, "=", config_.values[_1]); + Kip.infoln(_1, "=", config_.values[_1]); }; } return true; @@ -235,11 +232,11 @@ class KinxPackage(key_, info_, cfgMgr_) { public show() { if (info_.base) { - Kip.info("* ", info_.base); + Kip.infoln("* ", info_.base); } - Kip.info(" - %{key_.bold()} - %{info_.name.yellow()}"); + Kip.infoln(" - %{key_.bold()} - %{info_.name.yellow()}"); if (info_.url) { - Kip.info(" ", info_.url); + Kip.infoln(" ", info_.url); } } @@ -283,14 +280,19 @@ class KinxPackageRepositoryManager(cfgMgr_) { public list(args) { var repolist = cfgMgr_.getRepository(); repolist.each { &(access) - Kip.info("* ", access.url); - if (args[3] != "url") { - json = cfgMgr_.httpGet(access.jsonUrl); - if (json) { + json = cfgMgr_.httpGet(access.jsonUrl); + if (json) { + if (args[3] == "detail") { + Kip.infoln("* ", access.url); json.keySet().each { &(key) new KinxPackage(key, json[key], cfgMgr_).show(); }; + } else { + var count = json.keySet().length(); + Kip.infoln("* ", access.url.bold(), (" (%{count} package%{count > 1 ? 's' : ''})").green()); } + } else { + Kip.infoln("* ", access.url); } }; return true; @@ -375,11 +377,11 @@ class KinxPackageLibraryManager(repoMgr_) { return; } var list = getRemotePackages(info); - Kip.info("* ", key) if (key); + Kip.infoln("* ", key) if (key); list.each { var version = _1.version.string; var installed = isInstalled(key, version); - Kip.info(" - %{version.bold()} (%{makeSizeString(_1.size)}) ", + Kip.infoln(" - %{version.bold()} (%{makeSizeString(_1.size)}) ", (_1.prerelease ? "[Pre-release]" : "").yellow(), (installed ? " - Installed" : "").yellow().bold()); }; @@ -397,21 +399,30 @@ class KinxPackageLibraryManager(repoMgr_) { return true; } + private getVersionString(ver) { + if (ver == DEVELOPMENT_VERSION) { + return ("".bold().green()).toString(); + } + return ver; + } + private getVersionList(name) { var l = []; var dir = $pkgpath / name; if (File.isDirectory(dir)) { var packdef = name ? cfgMgr_.getPackageDef(name) : null; Directory.walk(dir) { &(verpath) + var isDevelopment = File.exists(verpath / DEVELOP_FILE_NAME); var ver = verpath.filename(); l.push({ latest: packdef && packdef == ver, version: ver, - development: File.exists(verpath / DEVELOP_FILE_NAME), + semanticVersion: new SemanticVersion(ver), + development: isDevelopment, }); }; } - return l; + return l.sort { => _1.semanticVersion <=> _2.semanticVersion }; } public list(pkgname) { @@ -420,11 +431,18 @@ class KinxPackageLibraryManager(repoMgr_) { var name = path.filename(); if (pkgname.isUndefined || pkgname == name) { var l = getVersionList(name); - System.print(name, ": "); - Kip.info(l.map { => _1.development - ? (_1.latest ? _1.version.green().bold() : _1.version.green()) - : (_1.latest ? _1.version.bold() : _1.version.yellow()) - }); + var last = l.length() - 1; + Kip.info(name, ": ["); + l.map { => _1.development + ? getVersionString(_1.version) + : (_1.latest ? getVersionString(_1.version).bold() : getVersionString(_1.version).yellow()) + }.each { &(e, i) + Kip.info(_1); + if (i != last) { + Kip.info(", "); + } + }; + Kip.infoln("]"); } } }; @@ -453,7 +471,7 @@ class KinxPackageLibraryManager(repoMgr_) { verlist = getRemotePackages(packages[name]); } if (!verlist || verlist.length() == 0) { - Kip.info("No package found."); + Kip.infoln("No package found."); return false; } var semvlist = verlist.map({ => _1.version.semver }); @@ -464,7 +482,7 @@ class KinxPackageLibraryManager(repoMgr_) { var installed = getVersionList(name); if (installed.isArray && installed.length() > 0) { if (installed.filter({ => _1.version == version }).length() > 0) { - Kip.info("The package %s(%s) has been already installed." % name.bold().underline().toString() % version); + Kip.infoln("The package %s(%s) has been already installed." % name.bold().underline().toString() % version); return false; } } @@ -496,10 +514,10 @@ class KinxPackageLibraryManager(repoMgr_) { Kip.progressln(""); // Update .def file. - installed = getVersionList(name).map { => new SemanticVersion(_1.version)}; + installed = getVersionList(name).map { => _1.semanticVersion }; var latest = (installed.isArray && installed.length() > 0) ? installed.sort()[-1].version() : null; cfgMgr_.setPackageDef(name, latest); - Kip.progressln("Set the latest version of %s to %s" % name % latest); + Kip.progressln("Set the latest version of %s to %s" % name % getVersionString(latest)); // Auto detaction of exec candidate. var candidates = []; @@ -560,11 +578,11 @@ class KinxPackageLibraryManager(repoMgr_) { var packagebase = $pkgpath / name; var packagedir = packagebase / version; if (!File.exists(packagedir)) { - Kip.errorln("No package of %s(%s)" % name % version); + Kip.errorln("No package of %s(%s)" % name % getVersionString(version)); return false; } if (isDevOnly && !File.exists(packagedir / DEVELOP_FILE_NAME)) { - Kip.errorln("Not a development package of %s(%s)" % name % version); + Kip.errorln("Not a development package of %s(%s)" % name % getVersionString(version)); return false; } var vers = []; @@ -584,13 +602,13 @@ class KinxPackageLibraryManager(repoMgr_) { }; } if (removeDir(packagedir)) { - Kip.progressln("%s(%s) is successfully uninstalled" % name % version); + Kip.progressln("%s(%s) is successfully uninstalled" % name % getVersionString(version)); } - var installed = getVersionList(name).map { => new SemanticVersion(_1.version)}; + var installed = getVersionList(name).map { => _1.semanticVersion }; var latest = (installed.isArray && installed.length() > 0) ? installed.sort()[-1].version() : null; cfgMgr_.setPackageDef(name, latest); if (latest) { - Kip.progressln("Set the latest version of %s to %s" % name % latest); + Kip.progressln("Set the latest version of %s to %s" % name % getVersionString(latest)); } else { if (removeDir(packagebase)) { Kip.progressln("Removed all versions of %s" % name); @@ -656,9 +674,9 @@ class KinxPackageLibraryManager(repoMgr_) { buf = txts.pop(); txts.each { if (_1 =~ /(?i)error/) { - Kip.errorln(_1.replace(/(?i)error/, &(g) => g[0].string.bold().red())); + Kip.errorln(_1); } else if (_1 =~ /(?i)(warning|warn)/) { - Kip.warningln(_1.replace(/(?i)(warning|warn)/, &(g) => g[0].string.bold().yellow())); + Kip.warningln(_1); } else { Kip.progressln(_1); } @@ -667,16 +685,33 @@ class KinxPackageLibraryManager(repoMgr_) { return buf; } + private devDefaultInstall() { + var pkginfo = JSON.parse(File.load(PACKAGE_INFO_FILE)); + new PackageUpdater(["kip", "--inst"], pkginfo.name, DEVELOPMENT_VERSION).update { &(util) + if (File.exists("src") && File.isDirectory("src")) { + Directory.change("src") { + Directory.walk(".") { + // _1 will be `bin`, `etc` and `lib`. + util.dircopy(_1, util.root / _1); + }; + }; + } + if (File.exists("docs") && File.isDirectory("docs")) { + util.dircopy("docs", util.root / "docs"); + } + }; + return true; + } + private devinstimpl(buildopt, output) { - var buildkx = "build/build.kx"; - if (!File.exists(buildkx)) { - Kip.errorln("Not found: build/build.kx to install a developing package"); + if (!File.exists(PACKAGE_BUILD_SCRIPT_FILE)) { + Kip.errorln("Not found: build/build.kx to install a development package"); return; } var kinx = $kinxpath / "kinx"; var buf; var [r1, w1] = new Pipe(); - var p1 = new Process([kinx, buildkx, buildopt], { out: w1 }).run(); + var p1 = new Process([kinx, PACKAGE_BUILD_SCRIPT_FILE, buildopt], { out: w1 }).run(); w1.close(); while (p1.isAlive() || r1.peek() > 0) { buf += r1.read(); @@ -691,6 +726,9 @@ class KinxPackageLibraryManager(repoMgr_) { } public devinstall() { + if (File.exists(PACKAGE_INFO_FILE)) { + return devDefaultInstall(); + } var r = devinstimpl("--inst", true); if (r.isUndefined) { return false; @@ -699,13 +737,20 @@ class KinxPackageLibraryManager(repoMgr_) { } public devuninstall() { - var namever = devinstimpl("--version"); - if (namever.isUndefined) { - return false; + var name, version; + if (File.exists(PACKAGE_INFO_FILE)) { + var pkginfo = JSON.parse(File.load(PACKAGE_INFO_FILE)); + name = pkginfo.name; + version = DEVELOPMENT_VERSION; + } else { + var namever = devinstimpl("--version"); + if (namever.isUndefined) { + return false; + } + [name, version] = namever.trim().split('\t'); } - var [name, version] = namever.trim().split('\t'); if (name.isString && version.isString) { - Kip.progressln("Removing the versions(%s) of %s" % version % name); + Kip.progressln("Removing the versions(%s) of %s" % getVersionString(version) % name); return uninstallVersion(name, version, true); } return false; @@ -787,28 +832,28 @@ class KinxPackageManager { } private usage() { - Kip.info("Options"); - Kip.info(" -h Display this help."); - Kip.info(" -v Verbose mode."); - Kip.info(""); - Kip.info("Configuration"); - Kip.info(" config set Sets a value to a name."); - Kip.info(" config remove Removes a name and a value."); - Kip.info(" config show [] Lists up a name and a value."); - Kip.info(""); - Kip.info("Central Repository Access"); - Kip.info(" repo add Adds a central repository."); - Kip.info(" repo remove Removes a central repository."); - Kip.info(" repo list Lists up a central repository."); - Kip.info(""); - Kip.info("Packages Control"); - Kip.info(" search Searches a package."); - Kip.info(" install [] Installs a specified package."); - Kip.info(" uninstall |all Uninstalls a specified package."); - # Kip.info(" update [] Installs the latest version."); - Kip.info(" devinst Installs a develpment package."); - Kip.info(" devuninst Uninstalls a develpment package."); - Kip.info(" list Lists up installed packages."); + Kip.infoln("Options"); + Kip.infoln(" -h Display this help."); + Kip.infoln(" -v Verbose mode."); + Kip.infoln(""); + Kip.infoln("Configuration"); + Kip.infoln(" config set Sets a value to a name."); + Kip.infoln(" config remove Removes a name and a value."); + Kip.infoln(" config show [] Lists up a name and a value."); + Kip.infoln(""); + Kip.infoln("Central Repository Access"); + Kip.infoln(" repo add Adds a central repository."); + Kip.infoln(" repo remove Removes a central repository."); + Kip.infoln(" repo list Lists up a central repository."); + Kip.infoln(""); + Kip.infoln("Packages Control"); + Kip.infoln(" search Searches a package."); + Kip.infoln(" install [] Installs a specified package."); + Kip.infoln(" uninstall |all Uninstalls a specified package."); + Kip.infoln(" devinst Installs a develpment package."); + Kip.infoln(" devuninst Uninstalls a develpment package."); + Kip.infoln(" list Lists up installed packages."); + # Kip.infoln(" update [] Updates packages to the latest version."); } private checkOptions(args) { diff --git a/lib/std/kxstartup.kx b/lib/std/kxstartup.kx index 3691baed..cc28683b 100644 --- a/lib/std/kxstartup.kx +++ b/lib/std/kxstartup.kx @@ -50,6 +50,7 @@ var Xml, Net; _functional_compose2 = __functional_compose2; Range = _Range; System.setupRange(Range.create); + System.GetOpt = GetOpt; System.getopt = new Fiber(new GetOpt().getopt).resume; Iconv = _Iconv; Clipboard = _Clipboard; diff --git a/lib/std/pkg/Develop.kx b/lib/std/pkg/Develop.kx index 49a9c59e..b5a1657d 100644 --- a/lib/std/pkg/Develop.kx +++ b/lib/std/pkg/Develop.kx @@ -1,4 +1,9 @@ +PackageUpdater.print = System.print; +PackageUpdater.println = System.println; +PackageUpdater.errorln = System.println; +PackageUpdater.warningln = System.println; + class DevelopPackageUpdater(pkgname, version, options_) { const DEVELOP_FILE_NAME = "development.kip"; @@ -30,7 +35,7 @@ class DevelopPackageUpdater(pkgname, version, options_) { } private removeFile(file) { - System.try({ => File.remove(file) }).else({ => System.println("Failed to remove: %s" % file) }); + System.try({ => File.remove(file) }).else({ => PackageUpdater.errorln("ERROR: Failed to remove: %s" % file) }); return !File.exists(file); } @@ -52,7 +57,7 @@ class DevelopPackageUpdater(pkgname, version, options_) { public dircopy(file1, file2) { if (File.isDirectory(file1)) { - System.println("Copying a directory : ", file1); + PackageUpdater.println("Copying a directory : ", file1); if (!File.exists(file2)) { File.mkdir(file2); } @@ -60,7 +65,7 @@ class DevelopPackageUpdater(pkgname, version, options_) { dircopy(_1, file2 / _1.filename()); }; } else { - System.println("Copying a file : ", file1); + PackageUpdater.println("Copying a file : ", file1); File.copy(file1, file2); } } @@ -96,7 +101,7 @@ class DevelopPackageUpdater(pkgname, version, options_) { candidates_.each { var dst = $kinxpath / _1.stem() + (exe ? ".exe" : ""); if (File.exists(dst) && removeFile(dst)) { - System.println("Removed an executable of %{dst.filename().bold().yellow()}"); + PackageUpdater.println("Removed an executable of %{dst.filename().bold().yellow()}"); } }; } @@ -108,7 +113,7 @@ class DevelopPackageUpdater(pkgname, version, options_) { Directory.recursiveWalk(root_ / "bin") { &(f) if (isExecutable(f)) { File.chmod(f, 755); - System.println("Made the file of %{_1.filename().bold().yellow()} executable"); + PackageUpdater.println("Made the file of %{_1.filename().bold().yellow()} executable"); } }; [ "kxrepl", "kxrepl.exe" ].each { &(exefile) @@ -122,7 +127,7 @@ class DevelopPackageUpdater(pkgname, version, options_) { } File.copy(src.replace("\\", "/"), dst.replace("\\", "/")); File.chmod(dst, 755); - System.println("Generated a command of %{dst.filename().bold().yellow()}"); + PackageUpdater.println("Generated a command of %{dst.filename().bold().yellow()}"); }; } }; @@ -136,12 +141,12 @@ class DevelopPackageUpdater(pkgname, version, options_) { } if (!options_.force && File.exists(root_) && !File.exists(root_ / DEVELOP_FILE_NAME)) { - System.println("Found the directory for the release version."); - System.println("ERROR: Cancelled the installation.".bold().red()); + PackageUpdater.println("Found the directory for the release version."); + PackageUpdater.errorln("ERROR: Cancelled the installation."); return; } - System.println("$PKGPATH: ", root_); + PackageUpdater.println("$PKGPATH: ", root_); removeExecutableCandidates(); if (File.exists(root_)) { removeDir(root_); @@ -163,7 +168,7 @@ class ReleasePackageArchiver(pkgname, version) { public dircopy(file1, file2) { if (File.isDirectory(file1)) { - System.println("Adding a directory : ", file1); + PackageUpdater.println("Adding a directory : ", file1); zip_.addFile(file1); } } @@ -176,8 +181,9 @@ class ReleasePackageArchiver(pkgname, version) { class PackageUpdater(args, pkgname, version) { + var getopt = new Fiber(new System.GetOpt().getopt).resume; var opt, options = { release: true }; - while (opt = System.getopt(args, "iv", { inst: 'i', version: 'v' })) { + while (opt = getopt(args, "iv", { inst: 'i', version: 'v' })) { switch (opt.type) { case 'i': options.devinst = true;