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

Implement --md5 and --channel-subdir for non-explicit env export #2672

Merged
merged 4 commits into from
Sep 1, 2023

Conversation

jonashaag
Copy link
Collaborator

@jonashaag jonashaag commented Jul 13, 2023

This keeps the old behaviour of defaulting to md5 output for explicit files and no md5 output for environment files, but allows for outputting md5 with --md5 for environment files.

@JohanMabille
Copy link
Member

JohanMabille commented Jul 13, 2023

I've just merged the fix for the umamba_tests_win_cmd ci job in the main branch, rebasing your PR should make the CI pass.

@jonashaag jonashaag changed the title Implement --md5 for non-explicit env export Implement --md5 and --channel-subdir for non-explicit env export Jul 13, 2023
@jonashaag
Copy link
Collaborator Author

Done, I've also added --channel-subdir

@jonashaag
Copy link
Collaborator Author

build/micromamba/micromamba env export -p /tmp/env --channel-subdir --md5
name:
channels:
- conda-forge
dependencies:
- conda-forge/osx-arm64::bzip2=1.0.8=h3422bc3_4[md5=fc76ace7b94fb1f694988ab1b14dd248]
- conda-forge/osx-arm64::ca-certificates=2023.5.7=hf0a4a13_0[md5=a8387be82224743cf849fb907790b91a]
- conda-forge/osx-arm64::libexpat=2.5.0=hb7217d7_1[md5=5a097ad3d17e42c148c9566280481317]
- conda-forge/osx-arm64::libffi=3.4.2=h3422bc3_5[md5=086914b672be056eb70fd4285b6783b6]
- conda-forge/osx-arm64::libsqlite=3.42.0=hb31c410_0[md5=6ae1bbf3ae393a45a75685072fffbe8d]
- conda-forge/osx-arm64::libzlib=1.2.13=h53f4e23_5[md5=1a47f5236db2e06a320ffa0392f81bd8]
- conda-forge/noarch::multiregex=2.0.1=pyhd8ed1ab_0[md5=fc050ddbb61645437f080e9323d94983]
- conda-forge/osx-arm64::ncurses=6.4=h7ea286d_0[md5=318337fb9d0c53ba635efb7888242373]
- conda-forge/osx-arm64::openssl=3.1.1=h53f4e23_1[md5=7451b96ed28b5fd02f0df32689327755]
- conda-forge/noarch::pip=23.1.2=pyhd8ed1ab_0[md5=7288da0d36821349cf1126e8670292df]
- conda-forge/osx-arm64::pyahocorasick=2.0.0=py311he2be06e_0[md5=4c4e5d758113c1339abf6fe45cad6008]
- conda-forge/osx-arm64::python=3.11.4=h47c9636_0_cpython[md5=b790b3cac8db7bdf2aaced9460bdbce4]
- conda-forge/osx-arm64::python_abi=3.11=3_cp311[md5=e1586496f8acd1c9293019ab14dbde9d]
- conda-forge/osx-arm64::readline=8.2=h92ec313_1[md5=8cbb776a2f641b943d413b3e19df71f4]
- conda-forge/noarch::setuptools=68.0.0=pyhd8ed1ab_0[md5=5a7739d0f57ee64133c9d32e6507c46d]
- conda-forge/osx-arm64::tk=8.6.12=he1e0b03_0[md5=2cb3d18eac154109107f093860bd545f]
- conda-forge/noarch::tzdata=2023c=h71feb2d_0[md5=939e3e74d8be4dac89ce83b20de2492a]
- conda-forge/noarch::wheel=0.40.0=pyhd8ed1ab_0[md5=49bb0d9e60ce1db25e151780331bb5f3]
- conda-forge/osx-arm64::xz=5.2.6=h57fd34a_0[md5=39c6b54e94014701dd157f4f576ed211]

if (!no_build)
{
dependencies << "=" << v.build_string;
}
if (no_md5 == -1)
Copy link
Member

Choose a reason for hiding this comment

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

In which scenario no_md5 would be equal to -1 if it's configured as a flag and initialized to 0?
Is there any test for this use case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think when you pass --md5

Copy link
Member

Choose a reason for hiding this comment

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

--md5 is just a negation for no_md5 and they are both flags, so I don't think it's ever going to be equal to -1. We could either use add_option instead of add_flag to allow the user to set it to -1 or other int and have that use case, or leave it as a bool and not have that use case.

Copy link
Member

Choose a reason for hiding this comment

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

I'm also a bit confused why no_md5 is not a boolean. If there are more complex cases than boolean, I think an enum would be more readable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just experimentally verified the following behavior:

  • Passing nothing: no_md5=0
  • Passing --no-md5: no_md5=1
  • Passing --md5: no_md5=-1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm merging this for now but I'm happy to improve on it using an enum or something else in a follow up PR

@jonashaag jonashaag merged commit 07ce0c4 into main Sep 1, 2023
23 checks passed
@jonashaag jonashaag deleted the export-md5 branch September 1, 2023 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants