From 037d666a33b28811737e2664c1a39ac69a8c0375 Mon Sep 17 00:00:00 2001 From: Mattia Verga Date: Sep 25 2021 08:24:09 +0000 Subject: Import reg into epel8 branch --- diff --git a/.gitignore b/.gitignore index e69de29..90621db 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/reg-0.16.1.tar.gz diff --git a/fix-row-cell-index-for-server-searching-feature.patch b/fix-row-cell-index-for-server-searching-feature.patch new file mode 100644 index 0000000..562d044 --- /dev/null +++ b/fix-row-cell-index-for-server-searching-feature.patch @@ -0,0 +1,30 @@ +From e25a3c266ab957f41308e30350b92fdc7a611e9f Mon Sep 17 00:00:00 2001 +From: Athos Ribeiro +Date: Wed, 4 Mar 2020 10:14:40 +0100 +Subject: [PATCH] Fix row cell index for server searching feature + +The HTML template for repositories carries the container image name in +the first cell of each entry in the table. This patch adjusts the JS +search function to fetch the image name information from that cell. + +Signed-off-by: Athos Ribeiro +--- + server/static/js/scripts.js | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/server/static/js/scripts.js b/server/static/js/scripts.js +index 0e8dd867..d36e1624 100644 +--- a/server/static/js/scripts.js ++++ b/server/static/js/scripts.js +@@ -23,7 +23,7 @@ function prettyDate(time){ + function search(search_val){ + var suche = search_val.toLowerCase(); + var table = document.getElementById("directory"); +- var cellNr = 1; ++ var cellNr = 0; + var ele; + for (var r = 1; r < table.rows.length; r++){ + ele = table.rows[r].cells[cellNr].innerHTML.replace(/<[^>]+>/g,""); +-- +2.26.2 + diff --git a/reg-server.service b/reg-server.service new file mode 100644 index 0000000..23002d1 --- /dev/null +++ b/reg-server.service @@ -0,0 +1,28 @@ +# It is not recommended to modify this file in-place, because it will be +# overwritten during package upgrades. If you want to customize, the best +# way is to use the "systemctl edit" command to create an override unit. + +[Unit] +Description=A static UI for a docker registry. +Documentation=https://github.com/jessfraz/reg/ +After=network.target + +[Service] +Type=simple +EnvironmentFile=-/etc/sysconfig/reg-server +WorkingDirectory=/var/lib/reg-server/ +ExecStart=/usr/bin/reg-server \ + $REG_USERNAME \ + $REG_PASSWORD \ + $REG_REGISTRY \ + $REG_PORT \ + $REG_CERTPATH \ + $REG_KEYPATH \ + $REG_INTERVAL \ + $REG_CLAIRURL \ + $REG_DEBUG +Restart=on-failure +PrivateTmp=yes + +[Install] +WantedBy=multi-user.target diff --git a/reg.spec b/reg.spec new file mode 100644 index 0000000..901654e --- /dev/null +++ b/reg.spec @@ -0,0 +1,247 @@ +# Generated by go2rpm 1.5.0 +%bcond_without check + +%if 0%{?epel} +%bcond_without bundled +%endif + +# Redefine macros for EPEL +%if 0%{?epel} + %global gobuilddir %{_builddir}/%{name}-%{version}/_build + %global gourl https://%{goipath} + %global gosource %{gourl}/archive/v%{version}/%{name}-%{version}.tar.gz + %define gobuild(o:) %{expand: + # https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12 + %global _dwz_low_mem_die_limit 0 + %ifnarch ppc64 + go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}' -compressdwarf=false" -a -v -x %{?**}; + %else + go build -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}' -compressdwarf=false" -a -v -x %{?**}; + %endif + } + %define goprep(:k) %{expand: + if [[ ! -e "%{gobuilddir}/bin" ]] ; then + install -m 0755 -vd "%{gobuilddir}/bin" + export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}/usr/share/gocode" + fi + if [[ ! -e "%{gobuilddir}/src/%{goipath}" ]] ; then + install -m 0755 -vd "$(dirname %{gobuilddir}/src/%{goipath})" + ln -fs "%{_builddir}/%{name}-%{version}" "%{gobuilddir}/src/%{goipath}" + fi + } +%endif + +# https://github.com/genuinetools/reg +%global goipath github.com/genuinetools/reg +Version: 0.16.1 + +%if !0%{?epel} +%gometa +%endif + +%global common_description %{expand: +Docker registry v2 command line client and repo listing generator with security +checks.} + +%global golicenses LICENSE +%global godocs VERSION.txt README.md + +Name: reg +Release: 5%{?dist} +Summary: Docker registry v2 command line client + +License: MIT +URL: %{gourl} +Source0: %{gosource} + +# Upstream advertises this as something that's meant to be run in a container +# and doesn't provide a systemd unit or sysV init script or sysconfig files +# so I'm providing them here. +Source1: reg-server.service +Source2: sysconfig.reg-server + +# https://github.com/genuinetools/reg/pull/200 +Patch0: fix-row-cell-index-for-server-searching-feature.patch + +%if 0%{?epel} +ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}} +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +%endif + +%if 0%{?epel} && 0%{?epel} < 8 +BuildRequires: systemd +%else +BuildRequires: systemd-rpm-macros +%endif + +%if %{without bundled} +BuildRequires: golang(github.com/coreos/clair/api/v3/clairpb) +BuildRequires: golang(github.com/docker/cli/cli/config) +BuildRequires: golang(github.com/docker/cli/cli/config/types) +BuildRequires: golang(github.com/docker/distribution) +BuildRequires: golang(github.com/docker/distribution/manifest/manifestlist) +BuildRequires: golang(github.com/docker/distribution/manifest/schema1) +BuildRequires: golang(github.com/docker/distribution/manifest/schema2) +BuildRequires: golang(github.com/docker/distribution/reference) +BuildRequires: golang(github.com/docker/docker/api/types) +BuildRequires: golang(github.com/docker/docker/api/types/container) +BuildRequires: golang(github.com/docker/docker/client) +BuildRequires: golang(github.com/docker/docker/pkg/jsonmessage) +BuildRequires: golang(github.com/docker/docker/pkg/term) +BuildRequires: golang(github.com/genuinetools/pkg/cli) +BuildRequires: golang(github.com/gorilla/mux) +BuildRequires: golang(github.com/mitchellh/go-wordwrap) +BuildRequires: golang(github.com/opencontainers/go-digest) +BuildRequires: golang(github.com/peterhellberg/link) +BuildRequires: golang(github.com/shurcooL/httpfs/html/vfstemplate) +BuildRequires: golang(github.com/sirupsen/logrus) +BuildRequires: golang(google.golang.org/grpc) + +%if %{with check} +# Tests +BuildRequires: golang(github.com/google/go-cmp/cmp) +%endif +%endif + +Obsoletes: reg-server < %{version} + +%description +%{common_description} + +%prep +%if 0%{?epel} +%setup -q -n %{name}-%{version} +%endif +%goprep %{?with_bundled:-k} +%patch0 -p1 + +%build +# When vendoring, use Go modules +%if %{with bundled} +%global gomodulesmode GO111MODULE=on +export GO111MODULE=on +export GOFLAGS=-mod=vendor +%endif +%gobuild -o %{gobuilddir}/bin/reg %{goipath} + +%install +# Install the binaries +install -m 0755 -vd %{buildroot}%{_bindir} +install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ + +# Install templates and static content +mkdir -p %{buildroot}%{_sharedstatedir}/%{name}-server +install -d server/templates/ %{buildroot}/%{_sharedstatedir}/%{name}-server/templates/ +install -d server/static/ %{buildroot}%{_sharedstatedir}/%{name}-server/static/ +cp -p -r server/templates/* %{buildroot}%{_sharedstatedir}/%{name}-server/templates/ +cp -p -r server/static/* %{buildroot}%{_sharedstatedir}/%{name}-server/static/ + +# Install the systemd unit +mkdir -p %{buildroot}%{_unitdir} +install -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}-server.service + +# Install the sysconfig file +mkdir -p %{buildroot}%{_sysconfdir}/sysconfig +install -p -m 0640 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-server + +%post +%systemd_post %{name}-server.service + +%preun +%systemd_preun %{name}-server.service + +%postun +%systemd_postun %{name}-server.service + +%files +%doc README.md Dockerfile Makefile +%license LICENSE +%{_bindir}/%{name} +%{_unitdir}/%{name}-server.service +%config(noreplace) %{_sysconfdir}/sysconfig/%{name}-server +%config(noreplace) %{_sharedstatedir}/%{name}-server/static/ +%config(noreplace) %{_sharedstatedir}/%{name}-server/templates/ + +%changelog +* Sun Sep 19 2021 Robert-André Mauchin - 0.16.1-5 +- Fix vendoring for devel package +- Make compatible with EPEL8 +- Close: rhbz#1941017, rhbz#1933618 + +* Fri Jul 23 2021 Fedora Release Engineering - 0.16.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Feb 23 2021 Mattia Verga - 0.16.1-3 +- Use bundled modules for EPEL8 + +* Sun Feb 21 2021 Mattia Verga - 0.16.1-2 +- Use modules from Fedora repository where possible + +* Sat Feb 20 2021 Mattia Verga - 0.16.1-1 +- Update to 0.16.1 +- Fix FTB in F34 +- Make use of some Golang macros + +* Wed Jan 27 2021 Fedora Release Engineering - 0.15.5-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 0.15.5-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sun Jun 14 2020 Athos Ribeiro - 0.15.5-6 +- Fix image search + +* Thu Apr 23 2020 Mattia Verga - 0.15.5-5 +- Fix %%postun directive + +* Thu Jan 30 2020 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Jul 26 2019 Fedora Release Engineering - 0.15.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 0.15.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Oct 16 2018 Kevin Fenzi - 0.15.5-1 +- Update to 0.15.5 + +* Thu Jul 26 2018 Kevin Fenzi - 0.15.4-1 +- Update to 0.15.4. + +* Sat Jul 14 2018 Fedora Release Engineering - 0.4.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Feb 09 2018 Fedora Release Engineering - 0.4.1-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 0.4.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 0.4.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Thu Jun 29 2017 Adam Miller - 0.4.1-5 +- Actually apply the patch for single-run execution + +* Thu Jun 29 2017 Adam Miller - 0.4.1-4 +- Fix epel7 build + +* Tue Jun 27 2017 Adam Miller - 0.4.1-3 +- Add patch to allow single-run execution of reg-server for static html + generation + +* Mon Jun 19 2017 Adam Miller - 0.4.1-2 +- Add ghost file entry for statically generated index.html + +* Mon Jun 12 2017 Adam Miller - 0.4.1-1 +- Update to latest upstream +- Switch to using upstream versioning, they are tagging versions now. + +* Tue Mar 21 2017 Adam Miller - 0.2.0-2.git.0.94d0af5 +- Move static/templates and systemd workingdir to /var/lib/reg-server +- Change Source0 to point to github archive url instead of local git-archive +- Fix tabs vs spaces in the spec file + +* Tue Mar 14 2017 Adam Miller - 0.2.0-1.git.0.94d0af5 +- First package for Fedora diff --git a/sources b/sources index e69de29..836d209 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (reg-0.16.1.tar.gz) = 2be68b405bb384d8eb3ae17a9b1c802a7f3212865ce61cf72f01794b9456787b1ef0eb62a538735d119153b0f472e741a8bbe99f1ce70d3b16ce1b8ba90eb4b8 diff --git a/sysconfig.reg-server b/sysconfig.reg-server new file mode 100644 index 0000000..97206aa --- /dev/null +++ b/sysconfig.reg-server @@ -0,0 +1,42 @@ +# /etc/sysconfig/reg-server +# +# This file is used to configure various aspects of the reg-server systemd +# service unit +# +# https://github.com/jessfraz/reg/tree/master/server +# +# + +# Uncomment to enable debugging +REG_DEBUG="--debug" + +# Directory on the local system containing template and static web content +# (JS, CSS themes, etc) +REG_WEBDIR="/var/lib/reg-server/" + +# Remote Registry to index and display an web UI for +REG_REGISTRY="--registry registry.fedoraproject.org" + +# Port to listen on with the built-in Golang mux +# (https://github.com/gorilla/mux) service (Default: 8080) +#REG_PORT="--port 8080" + +# Username for the remote registry that you're attempting to index +#REG_USERNAME="--username USERNAME" + +# Password for the remote registry that you're attempting to index +#REG_PASSWORD="--password PASSWORD" + +# Path to SSL Cert for cert-based access to remote registry +#REG_CERTPATH="--cert PATH_TO_CERT" + +# Path to SSL Key for cert-based access to remote regitry +#REG_KEYPATH="--key PATH_TO_KEY" + +# Interval - how often to re-index remote registry and write out static content +# (Default is 5m) +#REG_INTERVAL="--interval 5m" + +# Url to Clair (https://github.com/coreos/clair) instance to provide security +# information about containers. +#REG_CLAIRURL="--clair CLAIR_URL"