From 6df1f4d4595248b2ec76c969a2d0c1ccabab84bc Mon Sep 17 00:00:00 2001 From: Max Erenberg Date: Sun, 23 Oct 2022 22:00:48 -0400 Subject: [PATCH] Revert "Simplify packaging" This reverts commit b4a137355925cbe26a0ab6a35402d8da365216ba. --- .gitignore | 1 - Makefile | 5 +--- PACKAGING.md | 60 +++++++++++++++++++++++++++++++------------ debian/source/options | 2 +- package.sh | 5 ---- 5 files changed, 46 insertions(+), 27 deletions(-) delete mode 100755 package.sh diff --git a/.gitignore b/.gitignore index 00c9dea..84b1aba 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,3 @@ __pycache__/ /debian/files /debian/.debhelper/ /debian/debhelper-build-stamp -/pyceo.tar.gz diff --git a/Makefile b/Makefile index dbd052e..8ecb067 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,4 @@ clean: rm -rf venv rm -rf debian/{ceo,ceod,ceo-common,tmp} -package: - podman run -it --rm -v "$$PWD":"$$PWD" -w "$$PWD" --security-opt label=disable debian:bullseye bash package.sh - -.PHONY: build docs clean venv install package +.PHONY: build docs clean venv install diff --git a/PACKAGING.md b/PACKAGING.md index 7f26256..62491e2 100644 --- a/PACKAGING.md +++ b/PACKAGING.md @@ -12,25 +12,53 @@ for instructions. Make sure you are in the `csc-mirror` group too. ## Creating the package -Make sure you have Podman installed. - -Update `VERSION.txt` to the next version, `debian/changelog` with the new changes and do a git commit. - -Run `make package` to build the package and create the tarball `pyceo.tar.gz` in the repo root. - -**Important**: Make sure the container image for the same distribution which you're packaging. -For example, if you're creating a package for bullseye, you should be using the debian:bullseye -Docker image (this is because the virtualenv symlinks python to the OS' version of python). Also make -sure that all of the packages in the 'Build-Depends' section in debian/control are installed in the container. - -At some point before actually uploading, you'll need to the sign the package. On the extracted tarball, -run the following while placing your key ID after the `-k` argument, e.g. +Use Docker/Podman to avoid screwing up your main system. +For example, to create a package for bullseye (replace `podman` with `docker` in all instances below if you're using Docker): ```sh -debsign -k8E5568ABB0CF96BC367806ED127923BE10DA48DC *.changes +podman run -it --name pyceo-packaging -v "$PWD":"$PWD" -w "$PWD" debian:bullseye bash +``` +**Important**: Make sure to use a container image for the same distribution which you're packaging. +For example, if you're creating a package for bullseye, you should be using the debian:bullseye +Docker image (this is because the virtualenv symlinks python to the OS' version of python). + +Here are some of the prerequisites you'll need to build the deb files +(run this inside the container): +```sh +apt update +apt install -y devscripts debhelper git-buildpackage vim +``` +Make sure to also install all of the packages in the 'Build-Depends' section in debian/control. + +Update VERSION.txt to the next version, and do a git commit. + +Now run `dch -i` and edit the changelog. + +Now you will build a signed package. Place your key ID after the `-k` argument, e.g. +```sh +gbp buildpackage --git-upstream-branch=master -k8E5568ABB0CF96BC367806ED127923BE10DA48DC +``` +This will create a bunch of files (deb, dsc, tar.gz, etc.) in the parent directory. + +Now do another git commit (since you edited the changelog file). + +To clean the packages: +```sh +rm ../*.{xz,gz,dsc,build,buildinfo,changes,deb} ``` ## Uploading the package -Upload the tarball to a CSC machine, e.g. +Inside the container, go up one directory, and create a tarball with all the package files: +``` +cd .. +tar zcvf pyceo.tar.gz *.{xz,gz,dsc,build,buildinfo,changes,deb} +``` +Outside of the container (i.e. on your personal machine), copy the tarball out of the +container into your current directory, e.g. +``` +podman cp pyceo-packaging:/home/max/repos/pyceo.tar.gz . +``` +(Replace `/home/max/repos` by the directory in the container with the tarball.) +Now upload the tarball to a CSC machine, e.g. ``` scp pyceo.tar.gz mannitol:~ ``` @@ -47,7 +75,7 @@ At this point, you will need a dupload.conf file. Ask someone on syscom for a co Now upload the package to potassium-benzoate: ``` kinit -dupload --to debian.csclub *.changes +dupload *.changes ``` Now SSH into potassium-benzoate and run the following: diff --git a/debian/source/options b/debian/source/options index 21bc363..fdd7a05 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1 +1 @@ -extend-diff-ignore = "^(venv/|docs/.+\.\d$|dist/|.+\.egg-info/|build/|\.vscode/|\.idea/|pyceo\.tar\.gz)|__pycache__/|(^|/)\..+" +extend-diff-ignore = "^(venv/|docs/.+\.\d$|dist/|.+\.egg-info/|build/|\.vscode/|\.idea/)|__pycache__/|(^|/)\..+" diff --git a/package.sh b/package.sh deleted file mode 100755 index f81beb3..0000000 --- a/package.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -apt update && apt install -y git-buildpackage debhelper libkrb5-dev libpq-dev libaugeas0 python3-dev python3-venv scdoc -gbp buildpackage --git-export-dir=/tmp/build --git-upstream-branch=master --no-sign -tar zcvf pyceo.tar.gz -C /tmp/build .