Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: deprecation, warnRenamed, release constants #19315

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ let
licenses = import ./licenses.nix;
platforms = import ./platforms.nix;
systems = import ./systems.nix;
releases = import ./releases.nix;

# misc
debug = import ./debug.nix;
misc = import ./deprecated.nix;
deprecate = import ./deprecate.nix;

# domain-specific
sandbox = import ./sandbox.nix;
Expand All @@ -38,8 +40,8 @@ in
attrsets lists strings stringsWithDeps
customisation maintainers meta sources
modules options types
licenses platforms systems
debug misc
licenses platforms systems releases
debug misc deprecate
sandbox fetchers;
}
# !!! don't include everything at top-level; perhaps only the most
Expand Down
19 changes: 19 additions & 0 deletions lib/deprecate.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# deprecation functions

let
releases = import ./releases.nix;
trivial = import ./trivial.nix;

in
{
warnRenamed = {
oldName
, newName
, reason
, removedAt ? releases.next
}: trivial.warn ''
"${oldName}" has been renamed to "${newName}".
It will be removed in ${releases.asString removedAt}.
Reason: ${reason}
'';
}
22 changes: 22 additions & 0 deletions lib/releases.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# nixpkgs/nixos release information
rec {

# formatting releases
asString = {
name
, releaseDate
}: "${name} (release date ${releaseDate})";

next = nixos-17-first;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be 17.09 (not 17.03)? If it's 17.03, there is no deprecation period for users of stable channels.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not 17.03)? If it's 17.03, there is no deprecation period for users of stable channels.

When you update your stable channel you are expected to read the changelog and fix any evaluation errors that arise in one swoop. At least for renames it gives a nice evaluation error and will be documented in the changelog.


nixos-17-first = {
name = "NixOS 17.?";
releaseDate = "early 2017";
};

"nixos-16.09" = {
name = "NixOS 16.09";
releaseDate = "2016-10-03";
};

}
8 changes: 7 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13838,7 +13838,13 @@ in

opusfile = callPackage ../applications/audio/opusfile { };

opusTools = callPackage ../applications/audio/opus-tools { };
opusTools = lib.deprecate.warnRenamed {
oldName = "opusTools";
newName = "opus-tools";
removedAt = lib.releases.next;
reason = "Consistency with vorbis-tools";
} opus-tools;
opus-tools = callPackage ../applications/audio/opus-tools { };

orpie = callPackage ../applications/misc/orpie { gsl = gsl_1; };

Expand Down