initial version
This commit is contained in:
		
							
								
								
									
										117
									
								
								gitea.spec
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										117
									
								
								gitea.spec
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,117 @@ | ||||
| ExclusiveArch:  %{go_arches} | ||||
|  | ||||
| Name:           gitea | ||||
| Version:        1.8.0 | ||||
| Release:        1%{?dist} | ||||
| Summary:        Go GIT Server | ||||
|  | ||||
| License:        MIT | ||||
| URL:            https://gitea.io/en-us/ | ||||
| Source0:        https://github.com/go-gitea/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz | ||||
|  | ||||
| BuildRequires:  golang | ||||
| BuildRequires:  pam-devel | ||||
| Requires(pre):  /usr/bin/getent | ||||
| Requires(pre):  /usr/sbin/useradd | ||||
| Requires:       git | ||||
|  | ||||
| %description | ||||
|  | ||||
|  | ||||
| %prep | ||||
| %setup -q -c | ||||
| %{__mkdir_p} src/code.gitea.io/ | ||||
| mv %{name}-%{version} src/code.gitea.io/gitea | ||||
|  | ||||
| %build | ||||
| export GOPATH=%{gopath}:$(pwd) | ||||
|  | ||||
| cd src/code.gitea.io/gitea | ||||
|  | ||||
| case ${RPM_ARCH} in | ||||
|   i386) | ||||
|     GOARCH=386 | ||||
|     ;; | ||||
|   x86_64) | ||||
|     GOARCH=amd64 | ||||
|     ;; | ||||
|   *) | ||||
|     echo UNKNOWN ${RPM_ARCH} | ||||
|     exit 1 | ||||
|     ;; | ||||
| esac | ||||
|  | ||||
| case ${RPM_OS} in | ||||
|   linux) | ||||
|     GOOS=linux | ||||
|     ;; | ||||
|   *) | ||||
|     echo UNKNOWN ${RPM_OS} | ||||
|     exit 1 | ||||
|     ;; | ||||
| esac | ||||
|  | ||||
| export GOARCH | ||||
| export GOOS | ||||
|  | ||||
|  | ||||
| # | ||||
| # It is best practice to always use external packages, rather than bundled | ||||
| # content. As not all of these packages are yet available in Fedora, we will | ||||
| # save this for a future date. | ||||
| # | ||||
| # rm -fr vendor | ||||
| # | ||||
|  | ||||
| # | ||||
| # Using -a to force everything to compile | ||||
| # | ||||
| # Using -v to display what is happening | ||||
| # | ||||
| go build -a -v -tags 'cert pam sqlite' | ||||
| sed -i \ | ||||
| 	-e 's|^User=.*$|User=gitea|g' \ | ||||
| 	-e 's|^Group=.*$|Group=gitea|g' \ | ||||
| 	-e 's|^WorkingDirectory=.*$|WorkingDirectory=/var/lib/gitea|g' \ | ||||
| 	-e 's|^ExecStart=.*$|ExecStart=%{_bindir}/gitea web /etc/gitea/app.ini|g' \ | ||||
| 	-e 's|^Environment=.*$|Environment=USER=gitea HOME=/var/lib/gitea GITEA_WORK_DIR=/var/lib/gitea|g' \ | ||||
| 	contrib/systemd/gitea.service | ||||
|  | ||||
|  | ||||
| %install | ||||
| rm -rf %{buildroot} | ||||
| cd src/github.com/gitea/gitea | ||||
| %{__install} -d %{buildroot}%{_bindir} | ||||
| %{__install} -d %{buildroot}%{_sysconfdir}/gitea | ||||
| %{__install} -d %{buildroot}/usr/lib/systemd/system | ||||
| %{__install} -d %{buildroot}/var/lib/gitea | ||||
| %{__install} -d %{buildroot}/var/log/gitea | ||||
| %{__install} -p -m 0755 %{name} %{buildroot}%{_bindir}/%{name} | ||||
| %{__cp} -rp conf %{buildroot}%{_sysconfdir}/gitea/ | ||||
| %{__install} -p -m 0644 contrib/systemd/gitea.service %{buildroot}/usr/lib/systemd/system/gitea.service | ||||
| %{__cp} -rp templates %{buildroot}/var/lib/gitea/ | ||||
| %{__cp} -rp public %{buildroot}/var/lib/gitea/ | ||||
|  | ||||
|  | ||||
| %pre | ||||
| getent passwd gitea > /dev/null 2>&1 || useradd -r -d /var/lib/gitea -s /bin/bash gitea | ||||
|  | ||||
|  | ||||
| %files | ||||
| %license src/github.com/gitea/gitea/LICENSE | ||||
| %doc src/github.com/gitea/gitea/README.md | ||||
| %doc src/github.com/gitea/gitea/README_ZH.md | ||||
| %doc src/github.com/gitea/gitea/scripts/mysql.sql | ||||
| %attr(0700, gitea, gitea) %dir /var/lib/gitea | ||||
| %attr(0700, gitea, gitea) %dir /var/log/gitea | ||||
| %{_bindir}/%{name} | ||||
| %attr(0644, root, root) /usr/lib/systemd/system/gitea.service | ||||
| %attr(-, gitea, gitea) %config(noreplace) %{_sysconfdir}/gitea | ||||
| %attr(-, gitea, gitea) %config(noreplace) /var/lib/gitea/templates | ||||
| %attr(-, gitea, gitea) %config(noreplace) /var/lib/gitea/public | ||||
|  | ||||
|  | ||||
| %changelog | ||||
| * Sun Jul 28 2019 Jason Rothstein | ||||
| - initial version | ||||
|  | ||||
		Reference in New Issue
	
	Block a user