docker-library / buildpack-deps

MIT License
445 stars 113 forks source link

unstable/stable/testing variants #77

Closed roxspring closed 6 years ago

roxspring commented 6 years ago

Hi,

The upstream debian packages have tags for unstable/stable/testing/oldstable/oldoldstable. Is there any possibility that some of these could be translated into buildpack-deps too?

Specifically we have an internal docker image which gets regularly built against the "stable" scm variant and I only just noticed that we're still using jessie when stable has moved onto stretch. Would be great if we could just reference "stable-scm" and have that pull down whatever is current!

To be clear, I've only got a desire for stable but thought others might want the other variants.

tianon commented 6 years ago

Interesting thought for sure -- my first foray to implement this was to use bashbrew list on debian:TAG to figure out aliases, but in my haste I forgot that testing, etc aren't actually aliases (but are discrete separate images with square-wheel-rolling /etc/apt/sources.list contents), so this would probably require hitting the mirror directly in generate-stackbrew-library.sh to scrape the value of Suite: from files like https://deb.debian.org/debian/dists/jessie/Release.

tianon commented 6 years ago

This seems to do the trick:

diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh
index 4691a94..60fb160 100755
--- a/generate-stackbrew-library.sh
+++ b/generate-stackbrew-library.sh
@@ -1,8 +1,9 @@
-#!/bin/bash
-set -eu
+#!/usr/bin/env bash
+set -Eeuo pipefail

 declare -A aliases=(
-   [stretch]='latest'
+   #[stretch]='latest'
+   # ("latest" determined automatically via "bashbrew" below)
 )

 self="$(basename "$BASH_SOURCE")"
@@ -67,6 +68,17 @@ join() {
 for version in "${versions[@]}"; do
    versionAliases=( $version ${aliases[$version]:-} )

+   if debianSuite="$(
+       wget -qO- "https://deb.debian.org/debian/dists/$version/Release" \
+           | gawk -F ':[[:space:]]+' '$1 == "Suite" { print $2 }'
+   )" && [ -n "$debianSuite" ]; then
+       # "stable", "oldstable", etc.
+       versionAliases+=( "$debianSuite" )
+   fi
+   if bashbrew list "https://github.com/docker-library/official-images/raw/master/library/debian:$version" 2>/dev/null | grep -qE ':latest$'; then
+       versionAliases+=( latest )
+   fi
+
    parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/curl/Dockerfile")"
    arches="${parentRepoToArches[$parent]}"
$ diff -u <(bashbrew cat buildpack-deps) <(bashbrew cat <(./generate-stackbrew-library.sh))
--- /dev/fd/63  2018-04-09 18:03:51.627762757 -0700
+++ /dev/fd/62  2018-04-09 18:03:51.627762757 -0700
@@ -31,62 +31,62 @@
 GitCommit: 0db0cf15f1c507b17e7edc6dfbe301b8e357568f
 Directory: bionic

-Tags: buster-curl
+Tags: buster-curl, testing-curl
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: d662dc69f910feb241f6d0c9d2cd6cc2fb6c5e6c
 Directory: buster/curl

-Tags: buster-scm
+Tags: buster-scm, testing-scm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: 99a1c33fda559272e9322b02a5d778bbd04154e7
 Directory: buster/scm

-Tags: buster
+Tags: buster, testing
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: d7da72aaf3bb93fecf5fcb7c6ff154cb0c55d1d1
 Directory: buster

-Tags: jessie-curl
+Tags: jessie-curl, oldstable-curl
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: d662dc69f910feb241f6d0c9d2cd6cc2fb6c5e6c
 Directory: jessie/curl

-Tags: jessie-scm
+Tags: jessie-scm, oldstable-scm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: 1845b3f918f69b4c97912b0d4d68a5658458e84f
 Directory: jessie/scm

-Tags: jessie
+Tags: jessie, oldstable
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: d7da72aaf3bb93fecf5fcb7c6ff154cb0c55d1d1
 Directory: jessie

-Tags: sid-curl
+Tags: sid-curl, unstable-curl
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: d662dc69f910feb241f6d0c9d2cd6cc2fb6c5e6c
 Directory: sid/curl

-Tags: sid-scm
+Tags: sid-scm, unstable-scm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: 99a1c33fda559272e9322b02a5d778bbd04154e7
 Directory: sid/scm

-Tags: sid
+Tags: sid, unstable
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: d7da72aaf3bb93fecf5fcb7c6ff154cb0c55d1d1
 Directory: sid

-Tags: stretch-curl, curl
+Tags: stretch-curl, stable-curl, curl
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: d662dc69f910feb241f6d0c9d2cd6cc2fb6c5e6c
 Directory: stretch/curl

-Tags: stretch-scm, scm
+Tags: stretch-scm, stable-scm, scm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: 1845b3f918f69b4c97912b0d4d68a5658458e84f
 Directory: stretch/scm

-Tags: stretch, latest
+Tags: stretch, stable, latest
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
 GitCommit: d7da72aaf3bb93fecf5fcb7c6ff154cb0c55d1d1
 Directory: stretch
@@ -106,17 +106,17 @@
 GitCommit: d7da72aaf3bb93fecf5fcb7c6ff154cb0c55d1d1
 Directory: trusty

-Tags: wheezy-curl
+Tags: wheezy-curl, oldoldstable-curl
 Architectures: amd64, arm32v5, arm32v7, i386
 GitCommit: d662dc69f910feb241f6d0c9d2cd6cc2fb6c5e6c
 Directory: wheezy/curl

-Tags: wheezy-scm
+Tags: wheezy-scm, oldoldstable-scm
 Architectures: amd64, arm32v5, arm32v7, i386
 GitCommit: 1845b3f918f69b4c97912b0d4d68a5658458e84f
 Directory: wheezy/scm

-Tags: wheezy
+Tags: wheezy, oldoldstable
 Architectures: amd64, arm32v5, arm32v7, i386
 GitCommit: d7da72aaf3bb93fecf5fcb7c6ff154cb0c55d1d1
 Directory: wheezy

@yosifkit thoughts?

yosifkit commented 6 years ago

Since they are purely tag aliases rather than new builds, those sound good to me. They will be fairly easy to control so that they can be updated at the same time that debian:buster transitions to stable.