Skip to main content

AUR Sources

Publish source-based AUR packages that build from source via cargo

Anodizer can generate and publish source-based AUR packages that build your project from source using cargo build. This is separate from the AUR binary packages which distribute pre-built binaries.

Note: a source package builds from the source archive the release uploads, so it needs the source: stage turned on:

source:
  enabled: true

Without it the entry is skipped with no source archive found: enable `source.enabled: true` . The PKGBUILD downloads that archive and checks its SHA-256. With the default layout the archive's files sit at its root and the build runs in $srcdir; when source.prefix_template names a directory ("{{ ProjectName }}-{{ Version }}/"), the default build() and package() bodies cd into it first, and a custom body has to do the same.

Classification

GroupRequired (default)RollbackToken scope
SubmitterfalsenoneAUR_SSH_KEY write

See Release resilience for the full classification table and the Submitter gate semantics.

The required: field

Default: false — an AUR Sources submission failure is logged but does not fail the release.

Set required: true to make the release exit non-zero if this publisher fails:

aur_sources:
  - git_url: "ssh://aur@aur.archlinux.org/myapp.git"
    required: true

Warning: AUR Sources is a submitter publisher — it force-pushes to the upstream Arch User Repository via SSH. The AUR does not perform moderation, but the package is not "approved" by any external gate; the push itself is the final act. Despite this, the publisher is classified as Submitter because it modifies a shared namespace on an external service with no programmatic rollback path.

required: true fails the release when the SSH push fails. The AUR has no later review, so the push is the whole outcome.

With -v, anodizer prints this line when it loads a config that sets required: true on this publisher:

<location>: publisher 'aur_source' submits to an external moderation queue; `required: true` fails the release when the submission itself fails, but the eventual moderation outcome happens outside the release run and cannot be gated.

See Publish overview — the required: field for the full submitter-publisher semantics.

Minimal config

aur_sources:
  - git_url: "ssh://aur@aur.archlinux.org/myapp.git"

Full config reference

aur_sources:
  - name: myapp                      # optional; package name (default: crate name)
    ids: []                          # optional; no effect on a source package
    description: "A fast CLI tool"   # optional
    homepage: "https://example.com"  # optional
    license: MIT                     # optional; default from Cargo.toml
    maintainers: []                  # optional
    contributors: []                 # optional
    provides: []                     # optional; defaults to ["{name}"]
    conflicts: []                    # optional; defaults to ["{name}"]
    depends: []                      # optional; runtime deps
    optdepends: []                   # optional
    makedepends: ["rust", "cargo"]   # optional; build deps
    backup: []                       # optional; files to back up on upgrade
    rel: "1"                         # optional; package release number
    prepare: ""                      # optional; custom prepare() body
    build: ""                        # optional; defaults to "cargo build --release --locked"
    package: ""                      # optional; custom package() body
    install: ""                      # optional; .install file content
    url_template: ""                 # optional; source archive URL (template; default: the uploaded source archive)
    git_url: "ssh://aur@aur.archlinux.org/myapp.git"  # optional; AUR repo URL
    git_ssh_command: ""              # optional; custom GIT_SSH_COMMAND
    private_key: ""                  # optional; SSH key content (template, e.g. "{{ Env.AUR_SSH_KEY }}")
    directory: ""                    # optional; subdirectory in the git repo
    skip_upload: false               # optional; "auto" skips prereleases
    commit_author:
      name: "Bot"
      email: "bot@example.com"
    commit_msg_template: ""          # optional
    arches: []                       # optional; pacman arch=() list (default: from the Linux build targets)
    skip: false                      # optional

Authentication

Config fieldEnv varDescription
private_key—SSH private key content (the PEM / OpenSSH text itself), templated, usually "{{ Env.AUR_SSH_KEY }}"; written to a temporary file with mode 0600. git_ssh_command takes precedence when both are set
git_ssh_command—Override the full SSH invocation; takes precedence over private_key

Common gotchas

  • No git_url: if git_url is omitted, files are written to dist/ but not pushed. Useful for local inspection before submitting to AUR.
  • Version string hyphens: AUR pkgver does not allow hyphens. Anodizer replaces hyphens with underscores.
  • Default architectures: arch=() lists the pacman architecture of every Linux build target (x86_64 when there is none). Set arches to name the list yourself.
  • ids has no effect: a source package builds from the one source archive the release carries, so a build-ID filter selects nothing. Use arches to control the architectures.

AUR source config fields

FieldTypeDefaultDescription
namestringcrate namePackage name (alias: package_name)
idslistnoneNo effect on a source package
descriptionstringcrate namePackage description
homepagestring""Project homepage URL
licensestringfrom Cargo.tomlLicense identifier (SPDX; MIT OR Apache-2.0 renders both)
maintainerslist[]Package maintainers
contributorslist[]Package contributors
provideslist[{name}]Packages this provides
conflictslist[{name}]Conflicting packages
dependslist[]Runtime dependencies
optdependslist[]Optional dependencies
makedependslist["rust", "cargo"]Build dependencies
backuplist[]Files to back up on upgrade (written to the PKGBUILD and .SRCINFO)
relstring1Package release number
preparestringnoneCustom prepare() function body
buildstringcd into the archive's directory, then cargo build --release --lockedCustom build() function body
packagestringauto-generatedCustom package() function body
installstringnoneContent for a .install file (post-install/pre-remove scripts). When set, the PKGBUILD and .SRCINFO name <name>.install and the file is written alongside them.
url_templatestringthe uploaded source archive's URLSource archive download URL (template); {{ .ArtifactName }} is the archive's file name. In the rendered URL the version is replaced by ${pkgver} where it appears verbatim
git_urlstringnoneAUR git repository URL (for pushing)
git_ssh_commandstringnoneCustom GIT_SSH_COMMAND
private_keystringnoneSSH private key content (the PEM / OpenSSH text itself), templated, usually "{{ Env.AUR_SSH_KEY }}"; written to a temporary file with mode 0600. git_ssh_command takes precedence when both are set
directorystringrepo rootSubdirectory in the git repo
skip_uploadstring/boolnoneSkip git push: true or 1 always skips, auto skips for prereleases, false, 0 or empty publishes; a template is rendered and read the same way, in any letter case (see bool-or-template values)
commit_authorobjectnoneGit commit author (name, email)
commit_msg_templatestringnoneCustom commit message (template)
archeslistfrom the Linux build targetsPacman arch=() list
disablestring/boolnoneDisable this config

Behavior

  • Generates PKGBUILD and .SRCINFO files for source-based installation
  • The source is the archive the source: stage produced and the release uploaded, saved as ${pkgname}_${pkgver}.<format> with its SHA-256 in sha256sums; url_template replaces the URL
  • The SHA-256 is the one the source stage recorded, or is hashed from the archive when none was recorded. <format> is the archive's recorded format, else the URL's extension
  • In a workspace, the source archive belongs to the crate whose release ships it: the first crate with a release: block, else the primary crate. Its download URL is the one that release stamped on it when it uploaded the archive
  • An archive the release has not uploaded yet has no download URL. On --snapshot or --dry-run the PKGBUILD names it by file name; a live run skips the entry with source archive '<name>' has no download URL yet; the release stage sets it when the archive is uploaded. With source.enabled: true but no archive registered (--skip=source, or a source stage that failed first), the entry is skipped naming that cause
  • The top-level directory the default build() and package() enter comes from the archive's recorded prefix, so a --publish-only run knows it too; an artifacts.json written before the prefix was recorded falls back to rendering source.prefix_template
  • Version dashes are replaced with underscores for PKGBUILD compatibility
  • arch=() is derived from the Linux build targets unless arches is set
  • When git_url is set, clones the AUR repo, commits the generated files, and pushes

Full example

aur_sources:
  - name: myapp
    description: "A fast CLI tool"
    homepage: "https://example.com/myapp"
    license: Apache-2.0
    maintainers:
      - "Alice <alice@example.com>"
    depends:
      - openssl
    makedepends:
      - rust
      - cargo
    git_url: "ssh://aur@aur.archlinux.org/myapp.git"
    commit_author:
      name: "Bot"
      email: "bot@example.com"