OSDN Git Service

[NEW] pkg command is added.
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Mon, 6 Aug 2018 16:49:02 +0000 (00:49 +0800)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Mon, 6 Aug 2018 16:49:02 +0000 (00:49 +0800)
 Changes to be committed:
modified:   lib/libmain.sh
modified:   lib/main/libcommand.sh
modified:   lib/main/libusage.sh
modified:   man/portsreinstall.8

lib/libmain.sh
lib/main/libcommand.sh
lib/main/libusage.sh
man/portsreinstall.8

index ee9d394..8603088 100644 (file)
@@ -12,7 +12,7 @@ main_set_version ()
        MYVERSION=4.1.0
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9])$'
        # Template for development versions
-       MYVERSION=4.0.0+toward_4.1.0_20180806100240
+       MYVERSION=4.0.0+toward_4.1.0_20180807004844
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
index 18310d8..4099efa 100644 (file)
@@ -164,7 +164,7 @@ command_all_parse_args ()
                fi
                COMMAND_LOAD_FILE=`realpath "$COMMAND_LOAD_FILE"`
                ;;
-       glob )
+       glob | pkg )
                _command_parse_args__chk_glob_args $#
                ;;
        options )
@@ -325,7 +325,7 @@ command_all_exec_without_pkgtools ()
 # ============= Execute command operations which are irrespective of option settings =============
 command_all_exec_irrespective_of_saved_options ()
 {
-       local arcfile
+       local arcfile origins_match pkgs_match
        shift || :
        case $COMMAND_MODE in
        ok )
@@ -402,7 +402,31 @@ command_all_exec_irrespective_of_saved_options ()
        glob )
                _command_exec_irrespective_of_saved_options__notify_ignored_options
                message_echo "Evaluated flavored port origins are as follows:"
-               pkgsys_eval_ports_glob "$@"
+               origins_match=`pkgsys_eval_ports_glob "$@"`
+               if  [ -n "$origins_match" ]
+               then
+                       message_echo "Evaluated flavored port origins are as follows:"
+               else
+                       message_echo "No matching flavored port origin is found."
+               fi
+               echo "$origins_match"
+               exit
+               ;;
+       pkg )
+               _command_exec_irrespective_of_saved_options__notify_ignored_options
+               message_echo "Evaluated installed package are as follows:"
+               pkgs_match=`pkgsys_eval_ports_glob "$@" | while read origin
+               do
+                       pkgsys_get_installed_pkg_from_origin "$origin"
+               done`
+               if  [ -n "$pkgs_match" ]
+               then
+                       message_echo "Evaluated installed package are as follows:"
+                       echo "$pkgs_match"
+               else
+                       message_echo "ERROR: No matching package is installed." >&2
+                       exit 1
+               fi
                exit
                ;;
        reconf | rmconf | forget | escape | restore | pkgsanity | packupgrade )
index 34c1dd4..7a42f6e 100644 (file)
@@ -62,19 +62,21 @@ USAGE: portsreinstall [OPTIONS] [--] [command]
 [ARGUMENTS]
  command:
             do [all] (default) | [do] prepare | redo [all] | redo prepare
-          | clean [normal] | clean force | reset [all] | reset keepopts | reset keepstatus
+          | clean [normal] | clean force
+          | reset [all] | reset keepopts | reset keepstatus
           | ok add globs... | ok del globs...
           | taboo add globs... | taboo del globs...
           | freeze add globs... | freeze del globs...
           | need add globs... | need del globs...
           | noneed add globs... | noneed del globs...
           | reselect leaves | reselect obsolete
-          | save [dir] | load path | glob globs... | options
+          | save [dir] | load path
           | rmconf globs... | reconf globs... | forget globs...
           | escape globs... | restore globs...
           | pkgsanity [globs...]
-          | make glob [target] [arguments...]
           | packupgrade create | packupgrade crop [path] | packupgrade clean
+          | make glob [target] [arguments...]
+          | glob globs... | pkg globs... | options
           | show todo | show done | show resolved | show failure | show redo
           | show taboo | show need | show noneed | show restored | show deleted
           | show conflict
index 0040ee5..54a7048 100644 (file)
@@ -171,13 +171,6 @@ By default save directory is the current directory.
 Load a temporary database archive.
 Note that the currently temporary database is removed.
 .TP
-\fBglob\fR \fIglob\fR [\fIglob2\fR ...]
-Evaluate port globs and show matched flavored origins both for installed and uninstalled packages.
-.TP
-\fBoptions\fR
-Show saved option settings and expected effects of option-resetting options \fB\-L\fR, \fB\-M\fR and \fB\-N\fR.
-With \fB\-a\fR option, the first, second and third columns denote the option-resetting options, reset options and remaining options, respectively.
-.TP
 \fBrmconf\fR \fIglob\fR [\fIglob2\fR ...]
 Reset port options for the specified ports to the default and reset affected parts in the temporary database.
 .TP
@@ -211,15 +204,6 @@ The escaped packages are registered as taboo as same as \fBtaboo add\fR \fIglob\
 Restore packages specified by \fIglobs\fR escaped by \fBescape\fR command.
 The escaped packages are deregistered from taboo as same as \fBtaboo del\fR \fIglob\fR [\fIglob2\fR ...].
 .TP
-\fBmake\fR \fIglob\fR [\fItarget\fR ...] [\fIarguments\fR ...]
-Execute \fBmake\fR(1) command for ports matching the glob pattern.
-The taget and arguments are passed as they are with the arguments and environment variables customized for each port.
-For flavored ports, the appropriate argument (FLAVOR variable) is automatically set.
-The main purpose of this command is diagnosis and experimental build of unsuccessful ports.
-The result of this command will not be recognized by the (re)installation processes of \fBdo\fR and \fBredo\fR commands.
-The execution is carried out for each matching port in the alphanumeric order.
-If any port failed to execute \fBmake\fR(1) command, its exit status is returned by terminating immediately (so the following ports in the queue are skipped). 
-.TP
 \fBpackupgrade\fR \fBcreate\fR
 Create packages of the all reinstalled or newly installed ports (at a "builder" environment) with a set of scripts for upgrading another system with the same initial configuration of installed packages ("target" environment).
 One of typical examples of application can be such that the builder is a "forked" jail/chroot system constructed onto a host system by using nullfs and unionfs and the target is the host system (Refer to "Package build in a chroot system" Section).
@@ -240,6 +224,27 @@ This does not affect any already cropped sets of scripts or created packages.
 This command is provided for cases that ports/packages are reinstalled or reconfigured during/after the execution of \fBpackupgrade\fR \fBcreate\fR command.
 After execution of this command, \fBpackupgrade\fR \fBcreate\fR command will overwrite the packages by creating them again.
 .TP
+\fBmake\fR \fIglob\fR [\fItarget\fR ...] [\fIarguments\fR ...]
+Execute \fBmake\fR(1) command for ports matching the glob pattern.
+The taget and arguments are passed as they are with the arguments and environment variables customized for each port.
+For flavored ports, the appropriate argument (FLAVOR variable) is automatically set.
+The main purpose of this command is diagnosis and experimental build of unsuccessful ports.
+The result of this command will not be recognized by the (re)installation processes of \fBdo\fR and \fBredo\fR commands.
+The execution is carried out for each matching port in the alphanumeric order.
+If any port failed to execute \fBmake\fR(1) command, its exit status is returned by terminating immediately (so the following ports in the queue are skipped). 
+.TP
+\fBglob\fR \fIglob\fR [\fIglob2\fR ...]
+Evaluate port globs and show matched flavored origins both for installed and uninstalled packages.
+The exit status is always 0.
+.TP
+\fBpkg\fR \fIglob\fR [\fIglob2\fR ...]
+Evaluate port globs and show matched installed package names.
+The returned exit status is 1 if no installed package matches any of the globs.
+.TP
+\fBoptions\fR
+Show saved option settings and expected effects of option-resetting options \fB\-L\fR, \fB\-M\fR and \fB\-N\fR.
+With \fB\-a\fR option, the first, second and third columns denote the option-resetting options, reset options and remaining options, respectively.
+.TP
 \fBshow\fR [\fIsubject\fR] [@[\fBrun\fR|\fBbuild\fR|\fBall\fR][,[\fBdirect\fR|\fBfull\fR]]] [\fIarguments\fR]
 Show the list of ports to be reinstalled.
 The applied scope of dependencies can be controlled by "show option" proceeded by "@"; \fBrun\fR, \fBbuild\fR and \fBall\fR employ the run\-time, build\-time or both-time ones, respectively; \fBdirect\fR and \fBfull\fR include only the direct or fully recursive ones, respectively.
@@ -1104,7 +1109,7 @@ Configuration file of \fBportupgrade\fR(1).
 .PP
 [NEW] \fBauto\fR command is added to \fBportsreinstall\-chroot\fR(8).
 .PP
-[NEW] \fBmake\fR, \fBshow errormessage\fR, \fBshow leaves\fR and \fBshow obsolete\fR commands are added.
+[NEW] \fBpkg\fR, \fBmake\fR, \fBshow errormessage\fR, \fBshow leaves\fR and \fBshow obsolete\fR commands are added.
 .PP
 [NEW] BUILDCONFLICT and INSTCONFLICT sections are added to ${LOCALBASE}/etc/portsreinstall.conf.
 .PP