[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#926416: Got conda to build and run tests



Hi,

I needed conda for something, found the current packaging progress and
fiddled a bit to get it to build.

The things I found that needed to be fixed:

conda has an undeclared dependency on distutils that I needed to add to
the package dependency

the conda/shell/bin/conda entry point was using the shebang
"#!/usr/bin/env python" which on Debian assumes python 2.

I added a patch to make it "#!/usr/bin/env python3" though I'm not sure
how that's going to work in conda environments?

conda/shell/bin/conda needs to be executable, which the standard Debian
dh_install step removes the x bit from anything going into
/usr/lib/python3/dist-package


For the run-test command I found the 
"source /usr/lib/python3/dist-packages/conda/shell/bin/activate"
line also needed CONDA_EXE to be set.

I also found (when testing in an autopkgtest shell that conda create
was a problem when running as root because it really wanted to install
files into the already existing directory /usr/pkgs and conda reported
a warning when being run as root.

To work correctly I believe conda create needs a non-root user with a
home directory to create it's configuration files in.

Since the default autopkgtest runner doesn't have network access, I
changed the run-test to running
"conda config"
(which doesn't report anything since there's no root configuration) and
"conda help"

I'm attaching the patches I made for discussion but I can push them to
the debian-med repository if everyone's ok with that.

Diane
From f5c379492753b9c13f3cc8c121ad801281fd023b Mon Sep 17 00:00:00 2001
From: Diane Trout <diane@ghic.org>
Date: Mon, 18 Oct 2021 14:36:59 -0700
Subject: [PATCH 1/4] conda has an undeclared runtime dependency on distutils

---
 debian/changelog | 3 +++
 debian/control   | 1 +
 2 files changed, 4 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 8f3e357..355b10a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,13 @@
 conda (4.9.2+dfsg-1~rc0) UNRELEASED; urgency=medium
 
+  [ Steffen Moeller ]
   * New upstream release.
   * Bumped standard to 4.5.1 (no changes required)
   * Improved clean for repeated builds
   * Added myself to uploaders
 
+  [ Diane Trout ]
+  * conda has an undeclared runtime dependency on distutils
  -- Steffen Moeller <moeller@debian.org>  Wed, 10 Feb 2021 20:31:05 +0100
 
 conda (4.8.2+dfsg-1~rc0) experimental; urgency=medium
diff --git a/debian/control b/debian/control
index 9c4ca07..3951589 100644
--- a/debian/control
+++ b/debian/control
@@ -27,6 +27,7 @@ Architecture: any
 Depends: ${python3:Depends},
          ${misc:Depends},
          conda-package-handling,
+         python3-distutils,
          python3-pycosat,
          python3-pexpect,
          python3-requests,
-- 
2.33.0

From 3032843b0f3f539f3b073eef3e222ac80f86dcc6 Mon Sep 17 00:00:00 2001
From: Diane Trout <diane@ghic.org>
Date: Mon, 18 Oct 2021 14:37:15 -0700
Subject: [PATCH 2/4] conda/shell/bin/conda needs to have execute permissions

---
 debian/changelog | 1 +
 debian/rules     | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 355b10a..47edc98 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ conda (4.9.2+dfsg-1~rc0) UNRELEASED; urgency=medium
 
   [ Diane Trout ]
   * conda has an undeclared runtime dependency on distutils
+  * conda/shell/bin/conda needs to have execute permissions
  -- Steffen Moeller <moeller@debian.org>  Wed, 10 Feb 2021 20:31:05 +0100
 
 conda (4.8.2+dfsg-1~rc0) experimental; urgency=medium
diff --git a/debian/rules b/debian/rules
index c09f71e..5d2fc18 100755
--- a/debian/rules
+++ b/debian/rules
@@ -49,7 +49,9 @@ override_dh_auto_install:
 	dh_auto_install
 	for py3ver in $(shell py3versions -s); do \
 	  mv debian/conda/usr/lib/$${py3ver}/dist-packages/test_data \
-	  debian/conda/usr/lib/$${py3ver}/dist-packages/conda/test_data ; done
+	  debian/conda/usr/lib/$${py3ver}/dist-packages/conda/test_data ; \
+	  chmod a+x debian/conda/usr/lib/$${py3ver}/dist-packages/conda/shell/bin/conda ; \
+	done
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-- 
2.33.0

From 1aa80ab9ae85dbf5cf1bf0c4d309a0314656cbea Mon Sep 17 00:00:00 2001
From: Diane Trout <diane@ghic.org>
Date: Mon, 18 Oct 2021 14:37:36 -0700
Subject: [PATCH 3/4] add use-python3-bin-conda.patch to fix unversioned
 bin/conda shebang

---
 debian/changelog                           | 1 +
 debian/patches/series                      | 1 +
 debian/patches/use-python3-bin-conda.patch | 8 ++++++++
 3 files changed, 10 insertions(+)
 create mode 100644 debian/patches/use-python3-bin-conda.patch

diff --git a/debian/changelog b/debian/changelog
index 47edc98..8b1e0d6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,7 @@ conda (4.9.2+dfsg-1~rc0) UNRELEASED; urgency=medium
   [ Diane Trout ]
   * conda has an undeclared runtime dependency on distutils
   * conda/shell/bin/conda needs to have execute permissions
+  * add use-python3-bin-conda.patch to fix unversioned bin/conda shebang
  -- Steffen Moeller <moeller@debian.org>  Wed, 10 Feb 2021 20:31:05 +0100
 
 conda (4.8.2+dfsg-1~rc0) experimental; urgency=medium
diff --git a/debian/patches/series b/debian/patches/series
index 4d8ae48..d7294fd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@ ignore_test_trying_to_delete_python3.patch
 fix_other_test_issues.patch
 no_windows_files_in_test.patch
 find_conda_profile
+use-python3-bin-conda.patch
diff --git a/debian/patches/use-python3-bin-conda.patch b/debian/patches/use-python3-bin-conda.patch
new file mode 100644
index 0000000..f070ad7
--- /dev/null
+++ b/debian/patches/use-python3-bin-conda.patch
@@ -0,0 +1,8 @@
+--- a/conda/shell/bin/conda
++++ b/conda/shell/bin/conda
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # -*- coding: utf-8 -*-
+ # Copyright (C) 2012 Anaconda, Inc
+ # SPDX-License-Identifier: BSD-3-Clause
-- 
2.33.0

From 48f4b45ec9e67580749e5e2e373960259c64c55f Mon Sep 17 00:00:00 2001
From: Diane Trout <diane@ghic.org>
Date: Mon, 18 Oct 2021 14:37:47 -0700
Subject: [PATCH 4/4] Fix autopkgtest run-tests

Every conda command needs CONDA_EXE to be set
run local only conda commands to test executable
---
 debian/changelog      | 4 ++++
 debian/tests/run-test | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 8b1e0d6..8600e6b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,10 @@ conda (4.9.2+dfsg-1~rc0) UNRELEASED; urgency=medium
   * conda has an undeclared runtime dependency on distutils
   * conda/shell/bin/conda needs to have execute permissions
   * add use-python3-bin-conda.patch to fix unversioned bin/conda shebang
+  * Fix autopkgtest run-tests
+    - Every conda command needs CONDA_EXE to be set
+    - run local only conda commands to test executable
+
  -- Steffen Moeller <moeller@debian.org>  Wed, 10 Feb 2021 20:31:05 +0100
 
 conda (4.8.2+dfsg-1~rc0) experimental; urgency=medium
diff --git a/debian/tests/run-test b/debian/tests/run-test
index caef375..33790c9 100755
--- a/debian/tests/run-test
+++ b/debian/tests/run-test
@@ -1,4 +1,5 @@
 #!/bin/bash -ex
 
-source /usr/lib/python3/dist-packages/conda/shell/bin/activate
-CONDA_EXE=/usr/lib/python3/dist-packages/conda/shell/bin/conda conda create --name snowflakes biopython
+CONDA_EXE=/usr/lib/python3/dist-packages/conda/shell/bin/conda source /usr/lib/python3/dist-packages/conda/shell/bin/activate
+CONDA_EXE=/usr/lib/python3/dist-packages/conda/shell/bin/conda conda config
+CONDA_EXE=/usr/lib/python3/dist-packages/conda/shell/bin/conda conda help
-- 
2.33.0


Reply to: