Skip to content

Commit

Permalink
feat: aur backup (#3366)
Browse files Browse the repository at this point in the history
closes #3353
  • Loading branch information
caarlos0 committed Oct 5, 2022
1 parent 24178b1 commit a42c8ae
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/pipe/aur/aur.go
Expand Up @@ -292,6 +292,7 @@ func dataFor(ctx *context.Context, cfg config.AUR, cl client.Client, artifacts [
Contributors: cfg.Contributors,
Provides: cfg.Provides,
Conflicts: cfg.Conflicts,
Backup: cfg.Backup,
Depends: cfg.Depends,
OptDepends: cfg.OptDepends,
Package: cfg.Package,
Expand Down
4 changes: 4 additions & 0 deletions internal/pipe/aur/aur_test.go
Expand Up @@ -33,6 +33,10 @@ func createTemplateData() templateData {
Rel: "1",
Provides: []string{"test"},
OptDepends: []string{"nfpm"},
Backup: []string{
"/etc/mypkg.conf",
"/var/share/mypkg",
},
Maintainers: []string{
"Ciclano <ciclano@example.com>",
"Cicrano <cicrano@example.com>",
Expand Down
1 change: 1 addition & 0 deletions internal/pipe/aur/testdata/TestFullAur.golden
Expand Up @@ -15,6 +15,7 @@ provides=('test')
conflicts=('nope')
depends=('nope')
optdepends=('nfpm')
backup=('/etc/mypkg.conf' '/var/share/mypkg')

source_x86_64=("${pkgname}_${pkgver}_x86_64.tar.gz::https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz")
sha256sums_x86_64=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67')
Expand Down
4 changes: 4 additions & 0 deletions internal/pipe/aur/tmpl.go
Expand Up @@ -11,6 +11,7 @@ type templateData struct {
Contributors []string
Provides []string
Conflicts []string
Backup []string
Depends []string
OptDepends []string
Arches []string
Expand Down Expand Up @@ -53,6 +54,9 @@ depends=({{ pkgArray . }})
{{- with .OptDepends }}
optdepends=({{ pkgArray . }})
{{- end }}
{{- with .Backup }}
backup=({{ pkgArray . }})
{{- end }}
{{ range .ReleasePackages -}}
source_{{ .Arch }}=("${pkgname}_${pkgver}_{{ .Arch }}.{{ .Format }}::{{ .DownloadURL }}")
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Expand Up @@ -140,6 +140,7 @@ type AUR struct {
Conflicts []string `yaml:"conflicts,omitempty" json:"conflicts,omitempty"`
Depends []string `yaml:"depends,omitempty" json:"depends,omitempty"`
OptDepends []string `yaml:"optdepends,omitempty" json:"optdepends,omitempty"`
Backup []string `yaml:"backup,omitempty" json:"backup,omitempty"`
Rel string `yaml:"rel,omitempty" json:"rel,omitempty"`
Package string `yaml:"package,omitempty" json:"package,omitempty"`
GitURL string `yaml:"git_url,omitempty" json:"git_url,omitempty"`
Expand Down
8 changes: 8 additions & 0 deletions www/docs/customization/aur.md
Expand Up @@ -101,6 +101,14 @@ aurs:
optdepends:
- 'wget: for downloading things'

# List of files that can contain user-made changes and should be preserved
# during package upgrades and removals.
#
# Default: empty.
# Since: v1.12
backup:
- /etc/foo.conf

# Custom package instructions.
#
# Defaults to `install -Dm755 "./PROJECT_NAME" "${pkgdir}/usr/bin/PROJECT_NAME",
Expand Down

0 comments on commit a42c8ae

Please sign in to comment.