[squash] split common data

instead of building the packaged binaries with the `bindata` tag, this
introduces a new forgejo-common package which contains common assets and
architecture independent files.

This is the first of a handful of PRs that will ultimately enable
building packages for multiple architectures.
This commit is contained in:
crystal 2024-04-29 04:30:06 -06:00
parent 7fcc7721f8
commit b5914277d3
No known key found for this signature in database
GPG key ID: 1122054731F7CC43
11 changed files with 54 additions and 25 deletions

View file

@ -8,6 +8,10 @@ CI_VERIFY_RETRY_COUNT=30 # How many times to retry before giving up if the pipel
case "$1" in
"submodule-build")
cd "$2"
LDFLAGS="$LDFLAGS -X \"code.gitea.io/gitea/modules/setting.StaticRootPath=/usr/share/forgejo\""
LDFLAGS="$LDFLAGS -X \"code.gitea.io/gitea/modules/setting.AppWorkPath=/var/lib/forgejo\""
LDFLAGS="$LDFLAGS -X \"code.gitea.io/gitea/modules/setting.CustomConf=/etc/forgejo/app.ini\""
export LDFLAGS
make build
EXIT_STATUS=$?
mv gitea ../"$3"
@ -145,11 +149,14 @@ case "$1" in
mkdir deb/forgejo-sqlite-bin
mv forgejo-bin deb/forgejo-bin/forgejo
mv forgejo-sqlite-bin deb/forgejo-sqlite-bin/forgejo
cp -r forgejo/public deb/public
cp -r forgejo/templates deb/templates
cp -r forgejo/options deb/options
if [ -x forgejo-bin-dl ] ; then
mkdir deb/forgejo-bin-dl
mv forgejo-bin-dl deb/forgejo-bin-dl/forgejo
mv deb/.forgejo-bin.install deb/debian/forgejo-bin.install
ln -s forgejo.preinst deb/debian/forgejo-bin.preinst
ln -s forgejo-common.preinst deb/debian/forgejo-bin.preinst
ln -s forgejo.postinst deb/debian/forgejo-bin.postinst
ln -s forgejo.prerm deb/debian/forgejo-bin.prerm
echo >> deb/debian/control
@ -192,13 +199,27 @@ case "$1" in
"install-run-test")
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y ./"$2"
[ -f "/etc/default/forgejo" ] && . /etc/default/forgejo
[ -z "$FORGEJO_HOME" ] && FORGEJO_HOME=/var/lib/forgejo
[ -z "$FORGEJO_USER" ] && FORGEJO_USER=forgejo
sudo -u $FORGEJO_USER USER=$FORGEJO_USER \
HOME=$FORGEJO_HOME FORGEJO_WORK_DIR=$FORGEJO_HOME \
forgejo web -q --config /etc/forgejo/app.ini &
if [ "$2" = "${2#"./forgejo-bin_"}" ] ; then
APT_FORGEJO_COMMON_RESOLVE="$(ls -1 ./forgejo-common_*_all.deb)"
if [ -f "$APT_FORGEJO_COMMON_RESOLVE" ] ; then
APT_FORGEJO_COMMON="./$APT_FORGEJO_COMMON_RESOLVE"
else
echo "ERR! Unable to find the necessary forgejo-common package!"
exit 96
fi
fi
apt install -y $APT_FORGEJO_COMMON ./"$2"
if [ -f "/etc/default/forgejo" ] || [ "$2" != "${2#"./forgejo-bin_"}" ] ; then
[ -f "/etc/default/forgejo" ] && . /etc/default/forgejo
[ -z "$FORGEJO_HOME" ] && FORGEJO_HOME=/var/lib/forgejo
[ -z "$FORGEJO_USER" ] && FORGEJO_USER=forgejo
sudo -u $FORGEJO_USER USER=$FORGEJO_USER \
HOME=$FORGEJO_HOME FORGEJO_WORK_DIR=$FORGEJO_HOME \
forgejo web -q --config /etc/forgejo/app.ini &
else
echo "No env setup! Run testing defaults using hardcoded vars..."
sudo -u forgejo USER=forgejo forgejo web -q &
fi
sleep 10
curl http://localhost:3000/ | grep -A 4 "Powered by Forgejo"
exit $?

View file

@ -59,13 +59,11 @@ jobs:
- name: Build Forgejo for amd64
run: ./.ci-make.sh submodule-build forgejo forgejo-bin
env:
TAGS: bindata
- name: Build Forgejo (with SQLite) for amd64
run: ./.ci-make.sh submodule-build forgejo forgejo-sqlite-bin
env:
TAGS: bindata sqlite sqlite_unlock_notify
TAGS: sqlite sqlite_unlock_notify
- run: ./.ci-make.sh package-prep
- run: ./.ci-make.sh package-build-deps

View file

@ -1,8 +1,8 @@
Package: forgejo-bin
Architecture: amd64
Priority: optional
Provides: forgejo,gitea
Provides: forgejo, gitea
Depends: adduser (>= 3.11), git
Conflicts: forgejo,forgejo-sqlite,forgejo-common
Conflicts: forgejo, forgejo-sqlite, forgejo-common
Description: Forgejo: Beyond Coding. We Forge. (binary)
The official Forgejo release binary in a Debian package

View file

@ -1,4 +1,4 @@
forgejo (7.0.1-1) unstable; urgency=medium
forgejo (7.0.1-2) unstable; urgency=medium
WARNING: Forgejo will be upgraded to v7.0.1 LTS

View file

@ -2,13 +2,15 @@ forgejo (7.0.5-1) unstable; urgency=medium
* Forgejo version 7.0.5
* See https://codeberg.org/forgejo/forgejo/src/branch/forgejo/RELEASE-NOTES.md#7-0-5
* Split `forgejo-common` package for extra data
-- mkobel <moritz@kobelnet.ch> Fri, 05 July 2024 22:03:00 +0200
-- crystal <crystal@noreply.codeberg.org> Sun, 07 July 2024 17:22:00 +0000
forgejo (7.0.1-1) unstable; urgency=medium
* Forgejo version 7.0.1
* See https://codeberg.org/forgejo/forgejo/src/branch/forgejo/RELEASE-NOTES.md#7-0-1
* Forgejo Actions based build process
-- crystal <crystal@noreply.codeberg.org> Sat, 27 Apr 2024 15:35:00 +0000

View file

@ -8,16 +8,24 @@ Package: forgejo
Architecture: amd64
Priority: optional
Provides: gitea
Depends: adduser (>= 3.11),git
Conflicts: forgejo-sqlite,forgejo-bin
Depends: forgejo-common (= ${source:Version}), adduser (>= 3.11), git
Conflicts: forgejo-sqlite, forgejo-bin
Description: Forgejo: Beyond Coding. We Forge.
Forgejo with bindata ONLY - Use this package for MySQL or PostgreSQL setup
Package: forgejo-sqlite
Architecture: amd64
Priority: optional
Provides: forgejo,gitea
Depends: adduser (>= 3.11),git
Conflicts: forgejo,forgejo-bin
Provides: forgejo, gitea
Depends: forgejo-common (= ${source:Version}), adduser (>= 3.11), git
Conflicts: forgejo, forgejo-bin
Description: Forgejo: Beyond Coding. We Forge. (SQLite)
Forgejo with bindata and SQLite support - Use this package to get started immediately
Package: forgejo-common
Architecture: all
Priority: optional
Depends: forgejo | forgejo-sqlite (= ${source:Version})
Conflicts: forgejo-bin
Description: Common files for Forgejo
Common data used for all Forgejo packages and architectures.

View file

@ -0,0 +1,5 @@
public/ /usr/share/forgejo
templates/ /usr/share/forgejo
options/ /usr/share/forgejo
forgejo.service /usr/lib/systemd/system
app.ini /etc/forgejo

View file

@ -1,3 +1 @@
forgejo-sqlite-bin/forgejo /usr/bin
forgejo.service /usr/lib/systemd/system
app.ini /etc/forgejo

View file

@ -1 +0,0 @@
forgejo.preinst

View file

@ -1,3 +1 @@
forgejo-bin/forgejo /usr/bin
forgejo.service /usr/lib/systemd/system
app.ini /etc/forgejo