Skip to content

Commit

Permalink
kernel: Always choose proper stable versions
Browse files Browse the repository at this point in the history
  • Loading branch information
darktohka committed Mar 23, 2024
1 parent d3aa2e5 commit 3265f21
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
42 changes: 20 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,41 @@ COPY requirements.txt /srv
WORKDIR /srv

RUN \
# Create user
# Create user
addgroup -g 423 -S kernelcollector \
&& adduser -u 423 -S kernelcollector -G kernelcollector \
# Upgrade system
# Upgrade system
&& apk update \
&& apk add --no-cache --virtual .dev-deps g++ clang autoconf gettext-tiny libtool automake make wget bzip2-dev libmd-dev linux-headers perl zlib-dev zstd-dev file patch grep \
&& apk add --no-cache --virtual .dev-deps g++ clang autoconf gettext-tiny libtool automake make curl bzip2-dev libmd-dev linux-headers perl zlib-dev zstd-dev file patch grep \
&& apk add --no-cache gnupg gzip fakeroot xz tar zlib bzip2 zstd-libs libmd \
# Compile dpkg from source (needed for zstd support)
# Compile dpkg from source (needed for zstd support)
&& cd /tmp \
# Find latest version of dpkg
# Find latest version of dpkg
&& DPKG_URL="http://archive.ubuntu.com/ubuntu/pool/main/d/dpkg" \
&& DPKG_VERSION=$(wget -q -O - "$DPKG_URL/?C=M;O=D" | grep -Poh -m 1 "(?<=\")dpkg_.+\.tar\.xz(?=\")") \
&& wget "$DPKG_URL/$DPKG_VERSION" \
&& tar -xf *.tar.xz \
&& rm -rf *.tar.xz \
&& cd dpkg-* \
&& DPKG_VERSION=$(curl -Ls "$DPKG_URL/?C=M;O=D" | grep -Poh -m 1 "(?<=\")dpkg_.+\.tar\.xz(?=\")") \
&& curl -Ls "$DPKG_URL/$DPKG_VERSION" | tar -xJ \
&& cd dpkg* \
&& if [[ -f configure ]]; then rm configure; fi \
&& ./autogen \
&& chmod +x configure \
&& ./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/tmp \
--with-libz \
--with-libbz2 \
--with-libzstd \
--disable-dselect \
--disable-start-stop-daemon \
--disable-nls \
--disable-static \
--disable-devel-docs \
--sysconfdir=/etc \
--localstatedir=/tmp \
--with-libz \
--with-libbz2 \
--with-libzstd \
--disable-dselect \
--disable-start-stop-daemon \
--disable-nls \
--disable-static \
--disable-devel-docs \
&& make -j$(nproc) \
&& make install \
&& cd /srv \
# Install Python dependencies
# Install Python dependencies
&& pip install --no-cache --upgrade -r requirements.txt \
&& chown -R kernelcollector:kernelcollector . \
# Cleanup
# Cleanup
&& apk del .dev-deps \
&& rm -rf /tmp/* /var/cache/apk/*

Expand Down
6 changes: 6 additions & 0 deletions kernelcollector/package_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def get_kernel_releases(self):
stable_version = stable_entry.find('strong').text
stable_download_link = stable_entry.find('a', {'title': 'Download complete tarball'})['href']

stable_version_tuple = utils.release_to_tuple(stable_version)[0:2]
mainline_version_tuple = utils.release_to_tuple(mainline_version)[0:2]

if stable_version_tuple < mainline_version_tuple and '-rc' not in mainline_version:
return mainline_version, mainline_download_link, mainline_version, mainline_download_link

return stable_version, stable_download_link, mainline_version, mainline_download_link

def get_ubuntu_releases(self):
Expand Down

0 comments on commit 3265f21

Please sign in to comment.