markdown · 6755 bytes Raw Blame History

Fortress Deployment Guide

This guide covers deploying fortress to AUR, Homebrew, and repos.musicsian.com.

Prerequisites

For RPM builds

  • rpmbuild (install via dnf install rpm-build)
  • fpm (Fortran Package Manager) - install via cargo install fpm
  • createrepo_c (for repository metadata)
  • GPG key configured for signing

For AUR

  • AUR account with SSH key configured
  • makepkg (part of Arch Linux base-devel)
  • updpkgsums (to update checksums)

For Homebrew

  • Homebrew tap repository (or PR to homebrew-core)
  • Access to create GitHub releases

1. AUR Deployment

The AUR package is already configured in this repository.

Initial Setup (One-time)

# Clone your AUR repository
git clone ssh://aur@aur.archlinux.org/fortress.git fortress-aur
cd fortress-aur

# Copy files from fortress repo
cp /path/to/fortress/{PKGBUILD,.SRCINFO,fortress.install} .

Deploying Updates

cd fortress-aur

# Update version in PKGBUILD
vim PKGBUILD  # Update pkgver and pkgrel

# Generate checksums
updpkgsums

# Generate .SRCINFO
makepkg --printsrcinfo > .SRCINFO

# Test build locally
makepkg -si

# Push to AUR
git add PKGBUILD .SRCINFO fortress.install
git commit -m "Update fortress to version X.Y.Z"
git push

Notes:

  • Shell integration is automatic for bash and fish
  • Zsh users need to manually source /usr/share/fortress/fortress.sh
  • The fortress.install file shows post-install messages to users

2. Homebrew Deployment

Homebrew formulas can be deployed via a tap or submitted to homebrew-core.

Option A: Personal Tap (Easier)

# Create a tap repository (first time only)
# Repository name must be: homebrew-<tapname>
# Example: homebrew-fortran

git clone https://github.com/yourusername/homebrew-fortran
cd homebrew-fortran

# Copy the formula
cp /path/to/fortress/fortress.rb Formula/

# Create a GitHub release first with the tarball
# Update the sha256 in fortress.rb:
shasum -a 256 fortress-0.1.0.tar.gz

# Commit and push
git add Formula/fortress.rb
git commit -m "Add fortress 0.1.0"
git push

# Users install with:
# brew tap yourusername/fortran
# brew install fortress

Option B: Submit to homebrew-core (Official)

  1. Fork https://github.com/Homebrew/homebrew-core
  2. Add fortress.rb to Formula/
  3. Submit a PR following Homebrew guidelines
  4. Wait for review and approval

Notes:

  • Homebrew cannot automatically modify user dotfiles
  • Users must manually source the shell integration files
  • The caveats block provides clear installation instructions
  • Shell integration files are installed to #{HOMEBREW_PREFIX}/share/fortress/

Updating the Formula

# Update version and sha256
vim Formula/fortress.rb

# Test locally
brew install --build-from-source ./Formula/fortress.rb
brew test fortress
brew audit --strict fortress

# Commit and push
git add Formula/fortress.rb
git commit -m "fortress 0.2.0"
git push

3. RPM Repository (repos.musicsian.com)

Build the RPM

cd /home/espadon/src/fortress

# Ensure fpm is installed
cargo install fpm  # If not already installed

# Build the RPM
./build-rpm.sh

This script will:

  1. Create a source tarball
  2. Build the RPM using rpmbuild
  3. Output RPMs to ~/rpmbuild/RPMS/

Deploy to Repository

cd /home/espadon/src/fortress

# Copy RPM to repo and prepare deployment
./deploy-to-repo.sh

# Change to repo directory
cd ~/src/repos-musicsian-com

# Add and commit
git add RPMS/fortress-*.rpm fortress.repo
git commit -m "Add fortress 0.1.0-1"
git push

# Deploy to server (signs RPMs, creates metadata, updates site)
./deploy.sh

The deploy.sh script will:

  1. Stage files to a timestamped build directory
  2. Sign all RPM packages with GPG
  3. Generate repository metadata with createrepo_c
  4. Sign repository metadata
  5. Deploy to /var/www/repos.musicsian.com/releases/
  6. Update the current symlink
  7. Reload nginx
  8. Test the deployment

User Installation

Users can install from your repo with:

# Add the repository
sudo curl -o /etc/yum.repos.d/fortress.repo https://repos.musicsian.com/fortress.repo

# Install fortress
sudo dnf install fortress

# The shell integration is automatic for bash and fish
# Zsh users need to add to ~/.zshrc:
source /usr/share/fortress/fortress.sh

Shell Integration Comparison

Package Manager Bash Fish Zsh
AUR ✅ Auto ✅ Auto ⚠️ Manual
Homebrew ⚠️ Manual ⚠️ Manual ⚠️ Manual
RPM ✅ Auto ✅ Auto ⚠️ Manual

Auto: Shell integration is automatically set up during installation Manual: User must manually source the integration file

Version Bumping Checklist

When releasing a new version:

  • Update version in fpm.toml
  • Update version in fortress.spec (RPM)
  • Update version in PKGBUILD (AUR)
  • Update version in fortress.rb (Homebrew)
  • Create GitHub release with tarball
  • Update SHA256 checksums:
    • updpkgsums for AUR
    • Manual update in Homebrew formula
  • Update changelog in fortress.spec
  • Test build on all platforms
  • Deploy in order: AUR → RPM → Homebrew

Troubleshooting

RPM Build Fails - "fpm: command not found"

cargo install fpm
# Add to PATH if needed:
export PATH="$HOME/.cargo/bin:$PATH"

AUR Build Fails - Checksum Mismatch

updpkgsums  # Regenerate checksums
makepkg --printsrcinfo > .SRCINFO

Homebrew Install Fails - Binary Not Found

Check that the glob pattern in fortress.rb matches your build output:

built_binary = Dir["build/gfortran_*/app/fortress"].first

Shell Integration Not Working

Make sure users restart their shell or source the integration file:

# Bash
source /etc/profile.d/fortress.sh  # RPM
source /usr/share/fortress/fortress.sh  # AUR
source $(brew --prefix)/share/fortress/fortress.sh  # Homebrew

# Fish
source /usr/share/fish/vendor_functions.d/fortress.fish  # RPM/AUR
source $(brew --prefix)/share/fortress/fortress.fish  # Homebrew

Automation Ideas

Consider setting up:

  • GitHub Actions to automatically build and test on releases
  • Automatic AUR updates via CI/CD
  • Homebrew bump-formula-pr for version updates
  • RPM builds in CI with artifact upload

Notes on Homebrew Shell Integration

Homebrew cannot automatically set up shell integration because:

  1. Homebrew formulas run in a sandbox
  2. Writing to user home directories is not allowed
  3. System-wide profile.d directories vary by OS (macOS vs Linux)

This is why the caveats block is important - it provides clear instructions users will see after installation.

License

MIT - See LICENSE file for details

View source
1 # Fortress Deployment Guide
2
3 This guide covers deploying fortress to AUR, Homebrew, and repos.musicsian.com.
4
5 ## Prerequisites
6
7 ### For RPM builds
8 - `rpmbuild` (install via `dnf install rpm-build`)
9 - `fpm` (Fortran Package Manager) - install via `cargo install fpm`
10 - `createrepo_c` (for repository metadata)
11 - GPG key configured for signing
12
13 ### For AUR
14 - AUR account with SSH key configured
15 - `makepkg` (part of Arch Linux base-devel)
16 - `updpkgsums` (to update checksums)
17
18 ### For Homebrew
19 - Homebrew tap repository (or PR to homebrew-core)
20 - Access to create GitHub releases
21
22 ## 1. AUR Deployment
23
24 The AUR package is already configured in this repository.
25
26 ### Initial Setup (One-time)
27
28 ```bash
29 # Clone your AUR repository
30 git clone ssh://aur@aur.archlinux.org/fortress.git fortress-aur
31 cd fortress-aur
32
33 # Copy files from fortress repo
34 cp /path/to/fortress/{PKGBUILD,.SRCINFO,fortress.install} .
35 ```
36
37 ### Deploying Updates
38
39 ```bash
40 cd fortress-aur
41
42 # Update version in PKGBUILD
43 vim PKGBUILD # Update pkgver and pkgrel
44
45 # Generate checksums
46 updpkgsums
47
48 # Generate .SRCINFO
49 makepkg --printsrcinfo > .SRCINFO
50
51 # Test build locally
52 makepkg -si
53
54 # Push to AUR
55 git add PKGBUILD .SRCINFO fortress.install
56 git commit -m "Update fortress to version X.Y.Z"
57 git push
58 ```
59
60 **Notes:**
61 - Shell integration is automatic for bash and fish
62 - Zsh users need to manually source `/usr/share/fortress/fortress.sh`
63 - The `fortress.install` file shows post-install messages to users
64
65 ## 2. Homebrew Deployment
66
67 Homebrew formulas can be deployed via a tap or submitted to homebrew-core.
68
69 ### Option A: Personal Tap (Easier)
70
71 ```bash
72 # Create a tap repository (first time only)
73 # Repository name must be: homebrew-<tapname>
74 # Example: homebrew-fortran
75
76 git clone https://github.com/yourusername/homebrew-fortran
77 cd homebrew-fortran
78
79 # Copy the formula
80 cp /path/to/fortress/fortress.rb Formula/
81
82 # Create a GitHub release first with the tarball
83 # Update the sha256 in fortress.rb:
84 shasum -a 256 fortress-0.1.0.tar.gz
85
86 # Commit and push
87 git add Formula/fortress.rb
88 git commit -m "Add fortress 0.1.0"
89 git push
90
91 # Users install with:
92 # brew tap yourusername/fortran
93 # brew install fortress
94 ```
95
96 ### Option B: Submit to homebrew-core (Official)
97
98 1. Fork https://github.com/Homebrew/homebrew-core
99 2. Add `fortress.rb` to `Formula/`
100 3. Submit a PR following Homebrew guidelines
101 4. Wait for review and approval
102
103 **Notes:**
104 - Homebrew **cannot** automatically modify user dotfiles
105 - Users must manually source the shell integration files
106 - The caveats block provides clear installation instructions
107 - Shell integration files are installed to `#{HOMEBREW_PREFIX}/share/fortress/`
108
109 ### Updating the Formula
110
111 ```bash
112 # Update version and sha256
113 vim Formula/fortress.rb
114
115 # Test locally
116 brew install --build-from-source ./Formula/fortress.rb
117 brew test fortress
118 brew audit --strict fortress
119
120 # Commit and push
121 git add Formula/fortress.rb
122 git commit -m "fortress 0.2.0"
123 git push
124 ```
125
126 ## 3. RPM Repository (repos.musicsian.com)
127
128 ### Build the RPM
129
130 ```bash
131 cd /home/espadon/src/fortress
132
133 # Ensure fpm is installed
134 cargo install fpm # If not already installed
135
136 # Build the RPM
137 ./build-rpm.sh
138 ```
139
140 This script will:
141 1. Create a source tarball
142 2. Build the RPM using rpmbuild
143 3. Output RPMs to `~/rpmbuild/RPMS/`
144
145 ### Deploy to Repository
146
147 ```bash
148 cd /home/espadon/src/fortress
149
150 # Copy RPM to repo and prepare deployment
151 ./deploy-to-repo.sh
152
153 # Change to repo directory
154 cd ~/src/repos-musicsian-com
155
156 # Add and commit
157 git add RPMS/fortress-*.rpm fortress.repo
158 git commit -m "Add fortress 0.1.0-1"
159 git push
160
161 # Deploy to server (signs RPMs, creates metadata, updates site)
162 ./deploy.sh
163 ```
164
165 The `deploy.sh` script will:
166 1. Stage files to a timestamped build directory
167 2. Sign all RPM packages with GPG
168 3. Generate repository metadata with createrepo_c
169 4. Sign repository metadata
170 5. Deploy to `/var/www/repos.musicsian.com/releases/`
171 6. Update the `current` symlink
172 7. Reload nginx
173 8. Test the deployment
174
175 ### User Installation
176
177 Users can install from your repo with:
178
179 ```bash
180 # Add the repository
181 sudo curl -o /etc/yum.repos.d/fortress.repo https://repos.musicsian.com/fortress.repo
182
183 # Install fortress
184 sudo dnf install fortress
185
186 # The shell integration is automatic for bash and fish
187 # Zsh users need to add to ~/.zshrc:
188 source /usr/share/fortress/fortress.sh
189 ```
190
191 ## Shell Integration Comparison
192
193 | Package Manager | Bash | Fish | Zsh |
194 |----------------|------|------|-----|
195 | AUR | ✅ Auto | ✅ Auto | ⚠️ Manual |
196 | Homebrew | ⚠️ Manual | ⚠️ Manual | ⚠️ Manual |
197 | RPM | ✅ Auto | ✅ Auto | ⚠️ Manual |
198
199 **Auto**: Shell integration is automatically set up during installation
200 **Manual**: User must manually source the integration file
201
202 ## Version Bumping Checklist
203
204 When releasing a new version:
205
206 - [ ] Update version in `fpm.toml`
207 - [ ] Update version in `fortress.spec` (RPM)
208 - [ ] Update version in `PKGBUILD` (AUR)
209 - [ ] Update version in `fortress.rb` (Homebrew)
210 - [ ] Create GitHub release with tarball
211 - [ ] Update SHA256 checksums:
212 - [ ] `updpkgsums` for AUR
213 - [ ] Manual update in Homebrew formula
214 - [ ] Update changelog in `fortress.spec`
215 - [ ] Test build on all platforms
216 - [ ] Deploy in order: AUR → RPM → Homebrew
217
218 ## Troubleshooting
219
220 ### RPM Build Fails - "fpm: command not found"
221
222 ```bash
223 cargo install fpm
224 # Add to PATH if needed:
225 export PATH="$HOME/.cargo/bin:$PATH"
226 ```
227
228 ### AUR Build Fails - Checksum Mismatch
229
230 ```bash
231 updpkgsums # Regenerate checksums
232 makepkg --printsrcinfo > .SRCINFO
233 ```
234
235 ### Homebrew Install Fails - Binary Not Found
236
237 Check that the glob pattern in `fortress.rb` matches your build output:
238 ```ruby
239 built_binary = Dir["build/gfortran_*/app/fortress"].first
240 ```
241
242 ### Shell Integration Not Working
243
244 Make sure users restart their shell or source the integration file:
245 ```bash
246 # Bash
247 source /etc/profile.d/fortress.sh # RPM
248 source /usr/share/fortress/fortress.sh # AUR
249 source $(brew --prefix)/share/fortress/fortress.sh # Homebrew
250
251 # Fish
252 source /usr/share/fish/vendor_functions.d/fortress.fish # RPM/AUR
253 source $(brew --prefix)/share/fortress/fortress.fish # Homebrew
254 ```
255
256 ## Automation Ideas
257
258 Consider setting up:
259 - GitHub Actions to automatically build and test on releases
260 - Automatic AUR updates via CI/CD
261 - Homebrew bump-formula-pr for version updates
262 - RPM builds in CI with artifact upload
263
264 ## Notes on Homebrew Shell Integration
265
266 Homebrew **cannot** automatically set up shell integration because:
267 1. Homebrew formulas run in a sandbox
268 2. Writing to user home directories is not allowed
269 3. System-wide profile.d directories vary by OS (macOS vs Linux)
270
271 This is why the `caveats` block is important - it provides clear instructions users will see after installation.
272
273 ## License
274
275 MIT - See LICENSE file for details