projectcalico / calico

Cloud native networking and network security
https://docs.tigera.io/calico/latest/about/
Apache License 2.0
6.01k stars 1.34k forks source link

Provide Debian/Ubuntu packages for calicoctl on PPA #5267

Open eLvErDe opened 4 years ago

eLvErDe commented 4 years ago

Hello,

It could be great to provide calicoctl packages of calico's Ubuntu PPA.

Here is my Debian packaging building package for any architecture by downloading binaries from GitHub:

diff -Nur calicoctl-3.15.1.orig/debian/changelog calicoctl-3.15.1/debian/changelog
--- calicoctl-3.15.1.orig/debian/changelog  1970-01-01 01:00:00.000000000 +0100
+++ calicoctl-3.15.1/debian/changelog   2020-07-29 14:19:53.000000000 +0200
@@ -0,0 +1,5 @@
+calicoctl (3.15.1) unstable; urgency=medium
+
+  * Initial Release.
+
+ -- Adam Cecile <acecile@letz-it.lu>  Wed, 29 Jul 2020 14:19:53 +0200
diff -Nur calicoctl-3.15.1.orig/debian/compat calicoctl-3.15.1/debian/compat
--- calicoctl-3.15.1.orig/debian/compat 1970-01-01 01:00:00.000000000 +0100
+++ calicoctl-3.15.1/debian/compat  2020-07-29 14:19:53.000000000 +0200
@@ -0,0 +1 @@
+10
diff -Nur calicoctl-3.15.1.orig/debian/control calicoctl-3.15.1/debian/control
--- calicoctl-3.15.1.orig/debian/control    1970-01-01 01:00:00.000000000 +0100
+++ calicoctl-3.15.1/debian/control 2020-07-29 14:19:53.000000000 +0200
@@ -0,0 +1,19 @@
+Source: calicoctl
+Section: net
+Priority: optional
+Maintainer: Adam Cecile <acecile@letz-it.lu>
+Build-Depends: debhelper (>= 10),
+# To download binaries from GitHub
+ curl, ca-certificates,
+# To generate manpage
+ help2man
+Standards-Version: 4.5.0
+Homepage: https://github.com/projectcalico/calicoctl
+
+Package: calicoctl
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Command line interface to manage Calico resources
+ The calicoctl command line interface provides a number of resource
+ management commands to allow you to create, modify, delete, and view the
+ different Calico resources.
diff -Nur calicoctl-3.15.1.orig/debian/copyright calicoctl-3.15.1/debian/copyright
--- calicoctl-3.15.1.orig/debian/copyright  1970-01-01 01:00:00.000000000 +0100
+++ calicoctl-3.15.1/debian/copyright   2020-07-29 14:19:53.000000000 +0200
@@ -0,0 +1,33 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: calicoctl
+Upstream-Contact: https://github.com/projectcalico/calicoctl
+Source: https://github.com/projectcalico/calicoctl/releases
+
+Files: *
+Copyright: 2019-2020 Tigera, Inc.
+License: Apache-2.0
+
+Files: debian/*
+Copyright: 2020 Adam Cecile <acecile@le-vert.net>
+License: WTFPL
+
+License: Apache-2.0
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ .
+ https://www.apache.org/licenses/LICENSE-2.0
+ .
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ .
+ On Debian systems, the complete text of the Apache version 2.0 license
+ can be found in "/usr/share/common-licenses/Apache-2.0".
+
+License: WTFPL
+ This work is free. You can redistribute it and/or modify it under the
+ terms of the Do What The Fuck You Want To Public License, Version 2,
+ as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
diff -Nur calicoctl-3.15.1.orig/debian/dirs calicoctl-3.15.1/debian/dirs
--- calicoctl-3.15.1.orig/debian/dirs   1970-01-01 01:00:00.000000000 +0100
+++ calicoctl-3.15.1/debian/dirs    2020-07-29 14:19:53.000000000 +0200
@@ -0,0 +1 @@
+usr/bin
diff -Nur calicoctl-3.15.1.orig/debian/manpages calicoctl-3.15.1/debian/manpages
--- calicoctl-3.15.1.orig/debian/manpages   1970-01-01 01:00:00.000000000 +0100
+++ calicoctl-3.15.1/debian/manpages    2020-07-29 14:19:53.000000000 +0200
@@ -0,0 +1 @@
+debian/calicoctl.1
diff -Nur calicoctl-3.15.1.orig/debian/rules calicoctl-3.15.1/debian/rules
--- calicoctl-3.15.1.orig/debian/rules  1970-01-01 01:00:00.000000000 +0100
+++ calicoctl-3.15.1/debian/rules   2020-07-29 14:19:53.000000000 +0200
@@ -0,0 +1,25 @@
+#!/usr/bin/make -f
+
+include /usr/share/dpkg/pkg-info.mk
+URL := https://github.com/projectcalico/calicoctl/releases/download/v$(DEB_VERSION_UPSTREAM)/calicoctl-linux-$(DEB_BUILD_ARCH)
+DESTDIR := $(CURDIR)/debian/calicoctl
+SUPPORTED_ARCH := amd64 arm64 ppc64el
+SHORT_DESC := $(shell grep ^Description debian/control | cut -d':' -f2 | sed 's!^\s!!')
+
+%:
+   dh $@
+
+override_dh_install:
+   # Can only "build" with arch matching GitHub binary releases
+ifeq (,$(filter $(DEB_BUILD_ARCH),$(SUPPORTED_ARCH)))
+   $(error Only supported on $(SUPPORTED_ARCH))
+endif
+   dh_install
+   curl --fail --location '$(URL)' -o $(DESTDIR)/usr/bin/calicoctl
+   chmod 0755 $(DESTDIR)/usr/bin/calicoctl
+   help2man --no-info --version-string='$(DEB_VERSION_UPSTREAM)' --name '$(SHORT_DESC)' \
+     $(DESTDIR)/usr/bin/calicoctl \
+     > $(CURDIR)/debian/calicoctl.1
+
+override_dh_strip:
+   # Segmentation fault after stripping
diff -Nur calicoctl-3.15.1.orig/debian/source/format calicoctl-3.15.1/debian/source/format
--- calicoctl-3.15.1.orig/debian/source/format  1970-01-01 01:00:00.000000000 +0100
+++ calicoctl-3.15.1/debian/source/format   2020-07-29 14:19:53.000000000 +0200
@@ -0,0 +1 @@
+3.0 (native)
diff -Nur calicoctl-3.15.1.orig/debian/watch calicoctl-3.15.1/debian/watch
--- calicoctl-3.15.1.orig/debian/watch  1970-01-01 01:00:00.000000000 +0100
+++ calicoctl-3.15.1/debian/watch   2020-07-29 14:19:53.000000000 +0200
@@ -0,0 +1,4 @@
+version=4
+opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%calicoctl-$1.tar.gz%" \
+   https://github.com/projectcalico/calicoctl/tags \
+   (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate
caseydavenport commented 4 years ago

@neiljerram WDYT?

nelljerram commented 4 years ago

In terms of need.... I guess I can see that some people prefer to have everything on their system packaged. But this is quite a lot, given that there's a reasonable alternative of just downloading the calicoctl binary:

curl --fail --location '$(URL)' -o $(DESTDIR)/usr/bin/calicoctl

In terms of implementation... If we did package calicoctl, it should follow our current packaging architecture, which is

We might need to tweak the "WTFPL" :smile:

WDYT @caseydavenport ?

eLvErDe commented 4 years ago

For the license my point is: just relicense it as you want, I'm not claiming any copyright to make it easier

caseydavenport commented 4 years ago

@neiljerram yeah I agree with that general split.

I do think that some people will not want calicoctl packaged together with Felix, so this would probably need to be a new package rather than added to the existing ones.

nelljerram commented 4 years ago

Oh yes, definitely a different package. But if we start doing this, that package can go into our PPAs at https://launchpad.net/~project-calico.

So @eLvErDe if you'd like to take this forward, please raise the corresponding PRs against the calicoctl and packaging repos.