Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/gitea gitea: Various fixes.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5a05d1463eaf
branches:  trunk
changeset: 432353:5a05d1463eaf
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Thu May 21 13:35:12 2020 +0000

description:
gitea: Various fixes.

Add a target to generate the frontend artefacts that are required at
runtime, but do not build them by default as they require nodejs/npm which
will download node modules during the build.  Instead use a pre-built copy
stored in LOCAL_PORTS.  The web interface should now look correct.

Use the supplied Makefile to simplify some of the targets.

Remove unnecessary MAKE_DIRS (shadows an OWN_DIRS_PERMS), and fix
permissions on some of the installed files.

Based on joyent/pkgsrc#263 from GitHub user teutat3s.

diffstat:

 www/gitea/Makefile               |  55 ++++++++++++++++++++++++++-------------
 www/gitea/PLIST                  |   8 +++++-
 www/gitea/distinfo               |   7 ++++-
 www/gitea/patches/patch-Makefile |  15 ++++++++++
 4 files changed, 65 insertions(+), 20 deletions(-)

diffs (169 lines):

diff -r 05a0b3cf8455 -r 5a05d1463eaf www/gitea/Makefile
--- a/www/gitea/Makefile        Thu May 21 13:33:35 2020 +0000
+++ b/www/gitea/Makefile        Thu May 21 13:35:12 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.33 2020/05/17 14:50:40 nia Exp $
+# $NetBSD: Makefile,v 1.34 2020/05/21 13:35:12 jperkin Exp $
 
 DISTNAME=      gitea-1.11.5
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=go-gitea/}
@@ -13,19 +13,30 @@
 GO_DIST_BASE=          ${DISTNAME}
 GO_SRCPATH=            code.gitea.io/gitea
 
+FRONTEND=              ${DISTNAME}-frontend.tar.gz
+SITES.${FRONTEND}=     ${MASTER_SITE_LOCAL}
+DISTFILES:=            ${DEFAULT_DISTFILES} ${FRONTEND}
+
+BUILD_TARGET=  backend
+
+#
+# When updating this package it is necessary to build the front-end artefacts
+# and upload them to LOCAL_PORTS.  Doing this at build time is untenable as npm
+# will download a significant number of modules.
+#
+# Install nodejs>=10 and npm, uncomment the additional BUILD_TARGET, run the
+# generate-artefacts target, then upload the distfile to LOCAL_PORTS.
+#
+#BUILD_TARGET+=        frontend
+#
+
 .include "../../lang/go/go-vars.mk"
 .include "options.mk"
 
-.if !empty(GO_TAGS)
-GO_BUILD_PATTERN+=     -tags "${GO_TAGS}"
-.endif
-
-GO_BUILD_PATTERN+=     ${GO_SRCPATH}
-
 BUILD_DEFS+=   VARBASE GITEA_USER GITEA_GROUP
 
 EXTRACT_USING= bsdtar
-USE_TOOLS+=    pax
+USE_TOOLS+=    ggrep gmake pax tar
 DEPENDS+=      git-base-[0-9]*:../../devel/git-base
 
 EGDIR=         ${PREFIX}/share/examples/gitea
@@ -50,21 +61,12 @@
 PKG_SHELL.${GITEA_USER}=       ${SH}
 PKG_HOME.${GITEA_USER}=                ${VARBASE}/db/gitea
 
-SUBST_CLASSES+=                        fix-version
-SUBST_STAGE.fix-version=       pre-configure
-SUBST_MESSAGE.fix-version=     Fix the outdated version number.
-SUBST_FILES.fix-version=       main.go
-SUBST_SED.fix-version=         -e 's,^\(       Version = \)"1\.9\.0-dev",\1"${PKGVERSION}",'
-SUBST_NOOP_OK.fix-version=     no
-
 SUBST_CLASSES+=                fix-var
 SUBST_STAGE.fix-var=   pre-configure
 SUBST_MESSAGE.fix-var= Replace some vars
 SUBST_FILES.fix-var=   ${WRKDIR}/app.ini.sample
 SUBST_VARS.fix-var=    VARBASE GITEA_USER
 
-MAKE_DIRS+=    ${PKG_SYSCONFDIR}/conf
-
 CONF_FILES_PERMS+=     ${EGDIR}/app.ini.sample ${PKG_SYSCONFDIR}/conf/app.ini \
                        ${GITEA_USER} ${GITEA_GROUP} 0600
 
@@ -75,17 +77,34 @@
 
 RCD_SCRIPTS+=  gitea
 
+MAKE_ENV+=     TAGS="${GO_TAGS}"
+
 pre-patch:
        ${CP} ${FILESDIR}/app.ini.sample ${WRKDIR}/
+       ${CP} ${WRKDIR}/${DISTNAME}/.eslint* ${WRKSRC}/
+       ${CP} ${WRKDIR}/${DISTNAME}/.stylelintrc ${WRKSRC}/
+       ${ECHO} ${PKGVERSION_NOREV} > ${WRKSRC}/VERSION
+
+do-build:
+       cd ${WRKSRC} && ${BUILD_MAKE_CMD} ${BUILD_TARGET}
 
 do-install:
-       ${INSTALL_PROGRAM} ${WRKDIR}/bin/gitea ${DESTDIR}${PREFIX}/sbin
+       ${INSTALL_PROGRAM} ${WRKSRC}/gitea ${DESTDIR}${PREFIX}/sbin
        cd ${WRKSRC}/options && ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/gitea/options/
        cd ${WRKSRC}/templates && ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/gitea/templates/
        cd ${WRKSRC}/public && ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/gitea/public/
+       cd ${WRKDIR}/public && ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/gitea/public/
+       ${CHMOD} -R g-w ${DESTDIR}${PREFIX}/share/gitea
+       ${CHMOD} -x ${DESTDIR}${PREFIX}/share/gitea/public/vendor/plugins/tribute/tribute.css
+       ${CHMOD} -x ${DESTDIR}${PREFIX}/share/gitea/public/vendor/plugins/tribute/tribute.min.js
 
 post-install:
        ${INSTALL_DATA} ${WRKDIR}/app.ini.sample ${DESTDIR}${EGDIR}
 
+.PHONY: generate-frontend
+generate-frontend: build
+       cd ${WRKSRC} && ${TAR} -zcf ${WRKDIR}/${PKGNAME_NOREV}-frontend.tar.gz public/css public/js
+       @${ECHO} "Now upload ${WRKDIR}/${PKGNAME_NOREV}-frontend.tar.gz to LOCAL_PORTS"
+
 .include "../../lang/go/go-package.mk"
 .include "../../mk/bsd.pkg.mk"
diff -r 05a0b3cf8455 -r 5a05d1463eaf www/gitea/PLIST
--- a/www/gitea/PLIST   Thu May 21 13:33:35 2020 +0000
+++ b/www/gitea/PLIST   Thu May 21 13:35:12 2020 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.6 2020/03/09 11:06:16 nia Exp $
+@comment $NetBSD: PLIST,v 1.7 2020/05/21 13:36:12 jperkin Exp $
 sbin/gitea
 share/examples/gitea/app.ini.sample
 share/gitea/options/gitignore/Actionscript
@@ -660,6 +660,8 @@
 share/gitea/options/locale/locale_zh-HK.ini
 share/gitea/options/locale/locale_zh-TW.ini
 share/gitea/options/readme/Default
+share/gitea/public/css/index.css
+share/gitea/public/css/theme-arc-green.css
 share/gitea/public/img/404.png
 share/gitea/public/img/500.png
 share/gitea/public/img/auth/bitbucket.png
@@ -690,6 +692,10 @@
 share/gitea/public/img/repo_default.png
 share/gitea/public/img/slack.png
 share/gitea/public/img/telegram.png
+share/gitea/public/js/gitgraph.js
+share/gitea/public/js/gitgraph.js.map
+share/gitea/public/js/index.js
+share/gitea/public/js/index.js.map
 share/gitea/public/vendor/VERSIONS
 share/gitea/public/vendor/assets/font-awesome/LICENSE
 share/gitea/public/vendor/assets/font-awesome/css/LICENSE
diff -r 05a0b3cf8455 -r 5a05d1463eaf www/gitea/distinfo
--- a/www/gitea/distinfo        Thu May 21 13:33:35 2020 +0000
+++ b/www/gitea/distinfo        Thu May 21 13:35:12 2020 +0000
@@ -1,6 +1,11 @@
-$NetBSD: distinfo,v 1.20 2020/05/17 14:50:40 nia Exp $
+$NetBSD: distinfo,v 1.21 2020/05/21 13:36:12 jperkin Exp $
 
+SHA1 (gitea-1.11.5-frontend.tar.gz) = 262d7161cbfa663624094e44307ec4f32d182698
+RMD160 (gitea-1.11.5-frontend.tar.gz) = 7b1790a486d86d0043f98dcfd9a8d75696b6bfc7
+SHA512 (gitea-1.11.5-frontend.tar.gz) = 2350c0d8a71b2b5157b5158be90b4ef70dcf7779dd551082340a7bc44d999a79f57f779a412ffcd9d83b67210b31e0bd1c9c530acbf3ef89aa3fb4ed34b16255
+Size (gitea-1.11.5-frontend.tar.gz) = 304761 bytes
 SHA1 (gitea-1.11.5.tar.gz) = bc8ca807775578f0ffdc73e8d8c68b28211878c4
 RMD160 (gitea-1.11.5.tar.gz) = 942aabda1f4efe5a9cc5778a2283558c2d97e39b
 SHA512 (gitea-1.11.5.tar.gz) = ba80ba77f6f761a03d062d5ceaacf0d2f9a7c5ad3c414f3d34ff31ee37ac00c4af562ecba0f14c6dca3ad2012e6cbfd8aea105dd87cfb06aedc80cf22a9ff12b
 Size (gitea-1.11.5.tar.gz) = 28249501 bytes
+SHA1 (patch-Makefile) = e24daca412c8213a5cc8f312bb258b24d20e6407
diff -r 05a0b3cf8455 -r 5a05d1463eaf www/gitea/patches/patch-Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/gitea/patches/patch-Makefile  Thu May 21 13:35:12 2020 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-Makefile,v 1.1 2020/05/21 13:36:12 jperkin Exp $
+
+Exclude LDFLAGS, this is not C.
+
+--- Makefile.orig      2020-05-09 19:26:27.000000000 +0000
++++ Makefile
+@@ -49,7 +49,7 @@ else
+       endif
+ endif
+ 
+-LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
++LDFLAGS := -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
+ 
+ PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/)))
+ 



Home | Main Index | Thread Index | Old Index