@@ -62,6 +62,20 @@ function is_pkg_deprecated(pkg::Union{PackageSpec, PackageEntry}, registries::Ve
6262    return  false 
6363end 
6464
65+ function  get_pkg_deprecation_info (pkg:: Union{PackageSpec, PackageEntry} , registries:: Vector{Registry.RegistryInstance}  =  Registry. reachable_registries ())
66+     pkg. uuid ===  nothing  &&  return  nothing 
67+     for  reg in  registries
68+         reg_pkg =  get (reg, pkg. uuid, nothing )
69+         if  reg_pkg != =  nothing 
70+             info =  Registry. registry_info (reg_pkg)
71+             if  Registry. isdeprecated (info)
72+                 return  info. deprecated
73+             end 
74+         end 
75+     end 
76+     return  nothing 
77+ end 
78+ 
6579function  default_preserve ()
6680    return  if  Base. get_bool_env (" JULIA_PKG_PRESERVE_TIERED_INSTALLED" false )
6781        PRESERVE_TIERED_INSTALLED
@@ -2927,11 +2941,12 @@ struct PackageStatusData
29272941    compat_data:: Union{Nothing, Tuple{Vector{String}, VersionNumber, VersionNumber}} 
29282942    changed:: Bool 
29292943    extinfo:: Union{Nothing, Vector{ExtInfo}} 
2944+     deprecation_info:: Union{Nothing, Dict{String, Any}} 
29302945end 
29312946
29322947function  print_status (
29332948        env:: EnvCache , old_env:: Union{Nothing, EnvCache} , registries:: Vector{Registry.RegistryInstance} , header:: Symbol ,
2934-         uuids:: Vector , names:: Vector ; manifest =  true , diff =  false , ignore_indent:: Bool , workspace:: Bool , outdated:: Bool , extensions:: Bool , io:: IO ,
2949+         uuids:: Vector , names:: Vector ; manifest =  true , diff =  false , ignore_indent:: Bool , workspace:: Bool , outdated:: Bool , deprecated :: Bool ,  extensions:: Bool , io:: IO ,
29352950        mode:: PackageMode , hidden_upgrades_info:: Bool , show_usagetips:: Bool  =  true 
29362951    )
29372952    not_installed_indicator =  sprint ((io, args) ->  printstyled (io, args... ; color =  Base. error_color ()), " →" =  io)
@@ -3015,6 +3030,19 @@ function print_status(
30153030            continue 
30163031        end 
30173032
3033+         #  Deprecated info
3034+         deprecation_info =  nothing 
3035+         pkg_deprecated =  false 
3036+         if  ! isnothing (new)
3037+             pkg_spec =  something (new, old)
3038+             deprecation_info =  get_pkg_deprecation_info (pkg_spec, registries)
3039+             pkg_deprecated =  deprecation_info != =  nothing 
3040+         end 
3041+ 
3042+         #  if we are running with deprecated, only show packages that are deprecated
3043+         if  deprecated &&  ! pkg_deprecated
3044+             continue 
3045+         end 
30183046
30193047        #  TODO : Show extension deps for project as well?
30203048
@@ -3033,7 +3061,7 @@ function print_status(
30333061        no_visible_packages_heldback &=  (! changed ||  ! pkg_heldback)
30343062        no_packages_heldback &=  ! pkg_heldback
30353063
3036-         push! (package_statuses, PackageStatusData (uuid, old, new, pkg_downloaded, pkg_upgradable, pkg_heldback, cinfo, changed, ext_info))
3064+         push! (package_statuses, PackageStatusData (uuid, old, new, pkg_downloaded, pkg_upgradable, pkg_heldback, cinfo, changed, ext_info, deprecation_info ))
30373065    end 
30383066
30393067    for  pkg in  package_statuses
@@ -3067,10 +3095,22 @@ function print_status(
30673095        end 
30683096
30693097        #  show if package is deprecated
3070-         if  is_pkg_deprecated (pkg_spec, registries) 
3098+         if  pkg . deprecation_info  != =   nothing 
30713099            printstyled (io, "  [deprecated]" =  :yellow )
30723100        end 
30733101
3102+         #  show deprecation details when using --deprecated flag
3103+         if  deprecated &&  ! diff &&  pkg. deprecation_info != =  nothing 
3104+             reason =  get (pkg. deprecation_info, " reason" nothing )
3105+             alternative =  get (pkg. deprecation_info, " alternative" nothing )
3106+             if  reason != =  nothing 
3107+                 printstyled (io, "  (reason: " " )" =  :yellow )
3108+             end 
3109+             if  alternative != =  nothing 
3110+                 printstyled (io, "  (alternative: " " )" =  :yellow )
3111+             end 
3112+         end 
3113+ 
30743114        if  outdated &&  ! diff &&  pkg. compat_data != =  nothing 
30753115            packages_holding_back, max_version, max_version_compat =  pkg. compat_data
30763116            if  pkg. new. version != =  max_version_compat &&  max_version_compat !=  max_version
@@ -3161,6 +3201,17 @@ function print_status(
31613201        It is recommended to update them to resolve a valid version."""  , color =  Base. warn_color (), ignore_indent)
31623202    end 
31633203
3204+     #  Check if any packages are deprecated for info message
3205+     any_deprecated_packages =  any (pkg ->  pkg. deprecation_info != =  nothing , package_statuses)
3206+ 
3207+     #  Add info for deprecated packages (only if not already in deprecated mode)
3208+     if  ! deprecated &&  any_deprecated_packages
3209+         deprecated_str =  sprint ((io, args) ->  printstyled (io, args... ; color =  :yellow ), " [deprecated]" =  io)
3210+         tipend =  manifest ?  "  -m" :  " " 
3211+         tip =  show_usagetips ?  "  Use `status --deprecated$tipend ` to see more information." :  " " 
3212+         printpkgstyle (io, :Info , """ Packages marked with $deprecated_str  are no longer maintained.$tip """ =  Base. info_color (), ignore_indent)
3213+     end 
3214+ 
31643215    return  nothing 
31653216end 
31663217
@@ -3192,7 +3243,7 @@ end
31923243function  status (
31933244        env:: EnvCache , registries:: Vector{Registry.RegistryInstance} , pkgs:: Vector{PackageSpec}  =  PackageSpec[];
31943245        header =  nothing , mode:: PackageMode  =  PKGMODE_PROJECT, git_diff:: Bool  =  false , env_diff =  nothing , ignore_indent =  true ,
3195-         io:: IO , workspace:: Bool  =  false , outdated:: Bool  =  false , extensions:: Bool  =  false , hidden_upgrades_info:: Bool  =  false , show_usagetips:: Bool  =  true 
3246+         io:: IO , workspace:: Bool  =  false , outdated:: Bool  =  false , deprecated :: Bool   =   false ,  extensions:: Bool  =  false , hidden_upgrades_info:: Bool  =  false , show_usagetips:: Bool  =  true 
31963247    )
31973248    io ==  Base. devnull  &&  return 
31983249    #  if a package, print header
@@ -3223,10 +3274,10 @@ function status(
32233274    diff =  old_env != =  nothing 
32243275    header =  something (header, diff ?  :Diff  :  :Status )
32253276    if  mode ==  PKGMODE_PROJECT ||  mode ==  PKGMODE_COMBINED
3226-         print_status (env, old_env, registries, header, filter_uuids, filter_names; manifest =  false , diff, ignore_indent, io, workspace, outdated, extensions, mode, hidden_upgrades_info, show_usagetips)
3277+         print_status (env, old_env, registries, header, filter_uuids, filter_names; manifest =  false , diff, ignore_indent, io, workspace, outdated, deprecated,  extensions, mode, hidden_upgrades_info, show_usagetips)
32273278    end 
32283279    if  mode ==  PKGMODE_MANIFEST ||  mode ==  PKGMODE_COMBINED
3229-         print_status (env, old_env, registries, header, filter_uuids, filter_names; diff, ignore_indent, io, workspace, outdated, extensions, mode, hidden_upgrades_info, show_usagetips)
3280+         print_status (env, old_env, registries, header, filter_uuids, filter_names; diff, ignore_indent, io, workspace, outdated, deprecated,  extensions, mode, hidden_upgrades_info, show_usagetips)
32303281    end 
32313282    return  if  is_manifest_current (env) ===  false 
32323283        tip =  if  show_usagetips
0 commit comments