From 4e2787e919cb1301483864decc19138cd42cf199 Mon Sep 17 00:00:00 2001 From: Carl George Date: Mon, 10 Aug 2020 23:19:21 -0500 Subject: [PATCH] Update to 1.0.5 --- caddy.spec | 43 ++++++++++----- enable-appVersion-ldflag.patch | 98 ---------------------------------- sources | 2 +- 3 files changed, 30 insertions(+), 113 deletions(-) delete mode 100644 enable-appVersion-ldflag.patch diff --git a/caddy.spec b/caddy.spec index 02ea2c3..1e096ac 100644 --- a/caddy.spec +++ b/caddy.spec @@ -1,4 +1,4 @@ -%bcond_without bootstrap +%bcond_with bootstrap %if %{without bootstrap} %bcond_without check @@ -18,12 +18,12 @@ # https://github.com/caddyserver/caddy %global goipath github.com/caddyserver/caddy %global goaltipaths github.com/mholt/caddy -Version: 1.0.4 +Version: 1.0.5 %gometa %global common_description %{expand: -Caddy is the HTTP/2 web server with automatic HTTPS.} +Caddy is the web server with automatic HTTPS.} %global golicenses LICENSE.txt %global godocs dist/README.txt dist/CHANGES.txt @@ -35,20 +35,18 @@ Obsoletes: golang-github-mholt-caddy-devel < 1.0.0-3 Name: caddy Release: 1%{?dist} -Summary: HTTP/2 web server with automatic HTTPS +Summary: Web server with automatic HTTPS License: ASL 2.0 URL: https://caddyserver.com Source0: %{gosource} Source1: caddy.conf Source2: caddy.service Source3: index.html -# https://github.com/caddyserver/caddy/issues/2584 -Patch0: enable-appVersion-ldflag.patch # For certmagic 0.9, drop when upstream implements it Patch1: add-context-to-certmagic.patch -# https://github.com/mholt/caddy/commit/80dfb8b2a7f89b120a627bc4d866a1dc5ed3d92f#diff-04c6e90faac2675aa89e2176d2eec7d8 -BuildRequires: golang >= 1.12 +# https://github.com/caddyserver/caddy/commit/aa94f2b802e87fe42241758fb7cf6282b26d2396 +BuildRequires: golang >= 1.13 BuildRequires: golang(github.com/dustin/go-humanize) BuildRequires: golang(github.com/flynn/go-shlex) BuildRequires: golang(github.com/go-acme/lego/certcrypto) @@ -114,7 +112,11 @@ BuildRequires: golang(github.com/caddyserver/dnsproviders/route53) BuildRequires: golang(github.com/go-acme/lego/providers/dns/route53) %endif +%if %{defined fedora} || (%{defined rhel} && 0%{?rhel} >= 8) +BuildRequires: systemd-rpm-macros +%else BuildRequires: systemd +%endif %{?systemd_requires} Provides: webserver @@ -141,11 +143,12 @@ This package was built with the following plugins: %prep %goprep -%patch0 -p 1 %patch1 -p 1 find . -name "*.go" -exec sed -i "s|github.com/go-acme/lego/v3|github.com/go-acme/lego|" "{}" +; find . -name "*.go" -exec sed -i "s|github.com/russross/blackfriday|gopkg.in/russross/blackfriday.v1|" "{}" +; +sed -e '/Version:/ s/unknown/%{version}-%{release}/' -i caddy/caddymain/run.go + sed -e '/where other plugins get plugged in/ a \\t// plugins added during rpmbuild' \ %{?with_geoip: -e '/where other plugins get plugged in/ a \\t_ "github.com/aablinov/caddy-geoip"'} \ %{?with_realip: -e '/where other plugins get plugged in/ a \\t_ "github.com/captncraig/caddy-realip"'} \ @@ -160,19 +163,28 @@ sed -e '/where other plugins get plugged in/ a \\t// plugins %build -export LDFLAGS="${LDFLAGS:-} -X %{goipath}/caddy/caddymain.appVersion=v%{version} " %gobuild -o %{gobuilddir}/bin/caddy %{goipath}/caddy %install %gopkginstall -install -D -m 0755 %{gobuilddir}/bin/caddy %{buildroot}%{_bindir}/caddy -install -D -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/caddy/caddy.conf -install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/caddy.service -install -D -m 0644 %{S:3} %{buildroot}%{_datadir}/caddy/index.html + +# command +install -D -p -m 0755 %{gobuilddir}/bin/caddy %{buildroot}%{_bindir}/caddy + +# config +install -D -p -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/caddy/caddy.conf install -d -m 0755 %{buildroot}%{_sysconfdir}/caddy/conf.d + +# systemd unit +install -D -p -m 0644 %{S:2} %{buildroot}%{_unitdir}/caddy.service + +# data directory install -d -m 0750 %{buildroot}%{_sharedstatedir}/caddy +# welcome page +install -D -p -m 0644 %{S:3} %{buildroot}%{_datadir}/caddy/index.html + %if %{with check} %check @@ -255,6 +267,9 @@ fi %changelog +* Tue Aug 11 2020 Carl George - 1.0.5-1 +- Update to 1.0.5 + * Tue Jul 07 20:56:10 CEST 2020 Robert-André Mauchin - 1.0.4-1 - Update to 1.0.4 (#1803691) diff --git a/enable-appVersion-ldflag.patch b/enable-appVersion-ldflag.patch deleted file mode 100644 index 3b3fec5..0000000 --- a/enable-appVersion-ldflag.patch +++ /dev/null @@ -1,98 +0,0 @@ -diff -up caddy-1.0.4/caddy/caddymain/run.go.orig caddy-1.0.4/caddy/caddymain/run.go ---- caddy-1.0.4/caddy/caddymain/run.go.orig 2019-11-15 21:11:32.000000000 +0100 -+++ caddy-1.0.4/caddy/caddymain/run.go 2020-02-13 17:00:56.329081155 +0100 -@@ -25,7 +25,6 @@ import ( - "os" - "path/filepath" - "runtime" -- "runtime/debug" - "strconv" - "strings" - -@@ -79,13 +78,11 @@ func init() { - func Run() { - flag.Parse() - -- module := getBuildModule() -- cleanModVersion := strings.TrimPrefix(module.Version, "v") -- - caddy.AppName = appName -- caddy.AppVersion = module.Version -+ caddy.AppVersion = appVersion -+ cleanVersion := strings.TrimPrefix(appVersion, "v") - caddy.OnProcessExit = append(caddy.OnProcessExit, certmagic.CleanUpOwnLocks) -- certmagic.UserAgent = appName + "/" + cleanModVersion -+ certmagic.UserAgent = appName + "/" + cleanVersion - - if !logTimestamps { - // Disable timestamps for logging -@@ -154,12 +151,7 @@ func Run() { - os.Exit(0) - } - if version { -- if module.Sum != "" { -- // a build with a known version will also have a checksum -- fmt.Printf("Caddy %s (%s)\n", module.Version, module.Sum) -- } else { -- fmt.Println(module.Version) -- } -+ fmt.Println(appVersion) - os.Exit(0) - } - if plugins { -@@ -197,7 +189,7 @@ func Run() { - } - - // Log Caddy version before start -- log.Printf("[INFO] Caddy version: %s", module.Version) -+ log.Printf("[INFO] Caddy version: %s", appVersion) - - // Start your engines - instance, err := caddy.Start(caddyfileinput) -@@ -206,7 +198,7 @@ func Run() { - } - - // Begin telemetry (these are no-ops if telemetry disabled) -- telemetry.Set("caddy_version", module.Version) -+ telemetry.Set("caddy_version", appVersion) - telemetry.Set("num_listeners", len(instance.Servers())) - telemetry.Set("server_type", serverType) - telemetry.Set("os", runtime.GOOS) -@@ -287,27 +279,6 @@ func defaultLoader(serverType string) (c - }, nil - } - --// getBuildModule returns the build info of Caddy --// from debug.BuildInfo (requires Go modules). If --// no version information is available, a non-nil --// value will still be returned, but with an --// unknown version. --func getBuildModule() *debug.Module { -- bi, ok := debug.ReadBuildInfo() -- if ok { -- // The recommended way to build Caddy involves -- // creating a separate main module, which -- // preserves caddy a read-only dependency -- // TODO: track related Go issue: https://github.com/golang/go/issues/29228 -- for _, mod := range bi.Deps { -- if mod.Path == "github.com/caddyserver/caddy" { -- return mod -- } -- } -- } -- return &debug.Module{Version: "unknown"} --} -- - func checkJSONCaddyfile() { - if fromJSON { - jsonBytes, err := ioutil.ReadAll(os.Stdin) -@@ -588,6 +559,9 @@ func ParseEnvFile(envInput io.Reader) (m - - const appName = "Caddy" - -+// Build information -+var appVersion = "unknown" -+ - // Flags that control program flow or startup - var ( - serverType string diff --git a/sources b/sources index 55e80b5..a02acf9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (caddy-1.0.4.tar.gz) = 49dae9c0965000ba1cf36a6148ff78718383a511d671fb73edc3b08e4219db0a9902fc70e40bcbb13ffa7afaa520fd1e6303ea3776059de04085896c018d9c02 +SHA512 (caddy-1.0.5.tar.gz) = 6f6df0b5bfc60cb6d67e6e65ddee7f16d12ae4c80f0168383807490f4d519e04cfdc754acf8b68d7996d52a764d4b13b5ce710cd391f8287a9907e0bec317ce1