sugarlabs / sugar

Sugar GTK shell
GNU General Public License v3.0
253 stars 241 forks source link

Packaging guide for Python 3 packages #859

Open Aniket21mathur opened 4 years ago

Aniket21mathur commented 4 years ago

We currently have guide for python 2 packaging, Link.

But changes need to be made in the debian dir for packaging for Python 3. A proper documentation for packaging will be of great help.

Aniket21mathur commented 4 years ago

@quozl @pro-panda while making Python 3 packages for sugar-datastore, I made some changes in control file of debian directory copied from Python 2 sources as per above guide. I am not sure whether that's all what we need or some other changes also needed to be made. Please review those changes.

Thanks!

quozl commented 4 years ago

Thanks. I don't yet know what changes are needed in the packaging guide.

While you've done some changes that a Debian developer would do eventually (once we have made a release and they have packaged it), the guide presupposes that the existing packaging would be used as a basis. A Debian developer could change how the package is made. In other words, if we document now, our effort could be obsolete very quickly, and it would only temporarily benefit developers capable of building packages; we only have two of them; you and me.

I've done recursive diff of your debian.tar.xz against the Debian sugar-datastore 0.112-1 package.

control

--- sugar-datastore-0.112/debian/control        2018-01-08 23:56:00.000000000 +1100
+++ debian/control      2019-08-06 23:44:15.000000000 +1000
@@ -1,5 +1,5 @@
 Source: sugar-datastore
-Section: python
+Section: python3
 Priority: optional
 Maintainer: Debian Sugar Team <pkg-sugar-devel@lists.alioth.debian.org>
 Uploaders: Jonas Smedegaard <dr@jones.dk>,
@@ -14,17 +14,17 @@
 Vcs-Git: https://anonscm.debian.org/git/pkg-sugar/sugar-datastore.git
 Vcs-Browser: https://anonscm.debian.org/git/pkg-sugar/sugar-datastore.git
 Homepage: http://wiki.sugarlabs.org/go/Sugar
-XS-Python-Version: >= 2.7
+XS-Python-Version: >= 3.6

-Package: python-carquinyol
+Package: python3-carquinyol
 Architecture: any
 Depends: ${cdbs:Depends},
  ${misc:Depends},
- ${python:Depends},
+ ${python3:Depends},
  ${shlibs:Depends}
 Recommends: ${cdbs:Recommends}
 Suggests: ${cdbs:Suggests}
-Provides: ${python:Provides}
+Provides: ${python3:Provides}
 Description: Sugar Learning Platform - datastore
  Sugar Learning Platform promotes collaborative learning through Sugar
  Activities that encourage critical thinking, the heart of a quality

These changes look fine. I don't know if any other changes are needed to this file.

rules

--- sugar-datastore-0.112/debian/rules  2018-01-08 23:55:02.000000000 +1100
+++ debian/rules        2019-08-06 23:44:15.000000000 +1000
@@ -24,7 +24,7 @@
 EXP_RELEASE = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))

 pkgbranch = $(subst $(space),.,$(words 2,$(subst .,$(space),$(DEB_UPSTREAM_VERSION))))
-pkg = python-carquinyol
+pkg = python3-carquinyol

 # Adapt packaging in maintainer mode when targeting experimental branch:
 #  * Switch git packaging branch
@@ -40,13 +40,13 @@
 endif

 # Needed (always/seldom) at runtime
-CDBS_DEPENDS_$(pkg) = python-gi, python-dbus, python-xapian, python-sugar3
+CDBS_DEPENDS_$(pkg) = python3-gi, python3-dbus, python3-xapian, python3-sugar3
 CDBS_DEPENDS_$(pkg) +=, gir1.2-glib-2.0
 CDBS_RECOMMENDS_$(pkg) = dbus

 # Ensure optimal hash-bang + dependency for scripts (see Python Policy)
 #  * TODO: drop cdbs_python_binary fallback when cdbs 0.5 is stable
-CDBS_DEPENDS_$(pkg) +=, python
+CDBS_DEPENDS_$(pkg) +=, python3
 binary-fixup/$(pkg)::
        egrep -r -l -Z '^#! ?/usr/bin/(env )?python[[:print:]]*$$' \
                debian/$(cdbs_curpkg)/usr/bin/* \

These changes look fine. I don't know if any other changes are needed to this file. But the missing python3-sugar3 package makes it impossible to build this package.

changelog

--- sugar-datastore-0.112/debian/changelog      2018-01-09 00:03:36.000000000 +1100
+++ debian/changelog    2019-08-06 23:44:15.000000000 +1000
@@ -1,3 +1,9 @@
+sugar-datastore (0.114~Aniket21mathur.0-1) bionic; urgency=medium
+
+  * new local test version
+
+ -- Aniket Mathur <amathur@ec.iitr.ac.in>  Tue, 06 Aug 2019 19:14:15 +0530
+
 sugar-datastore (0.112-1) unstable; urgency=medium

   [ upstream ]

These changes look fine, given that this is a local release by you. Debian or Ubuntu would follow their own version numbering.

Aniket21mathur commented 4 years ago

A Debian developer could change how the package is made. In other words, if we document now, our effort could be obsolete very quickly, and it would only temporarily benefit developers capable of building packages; we only have two of them; you and me.

Agreed. Let's wait for the Debian developers to package before having a guide of our own.

Thanks!