-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aerc: 0.4.0 -> 0.5.2 #103472
aerc: 0.4.0 -> 0.5.2 #103472
Conversation
18b7b36
to
29216c4
Compare
0.5.2 came out yesterday, I have updated this PR (and rebased) |
pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch
Outdated
Show resolved
Hide resolved
I tested this PR and it seems to work for me because I already have an aerc configuration, but if I delete it (i.e. if I do
|
Built on macOS. I don't have a aerc config but also getting @wizeman's error.
Result of 1 package built:
|
I suspect this is because the patch should also be affecting the stylesets config too. I'm having a look at that now, though I could probably do with some help from @tadeokondrak |
Not able to test it now, but does diff --git a/Makefile b/Makefile
index 77f5e61..98cbc11 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ aerc: $(GOSRC)
-o $@
aerc.conf: config/aerc.conf.in
- sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in
+ cat config/aerc.conf.in > $@
debug: $(GOSRC)
GOFLAGS="-tags=notmuch" \
diff --git a/config/config.go b/config/config.go
index 51982d2..945c5ef 100644
--- a/config/config.go
+++ b/config/config.go
@@ -549,6 +549,18 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
return nil, err
}
+ for i, filter := range config.Filters {
+ config.Filters[i].Command = strings.ReplaceAll(filter.Command, "@SHAREDIR@", sharedir)
+ }
+
+ for i, templateDir := range config.Templates.TemplateDirs {
+ config.Templates.TemplateDirs[i] = strings.ReplaceAll(templateDir, "@SHAREDIR@", sharedir)
+ }
+
+ for i, styleSetDir := range config.Ui.StyleSetDirs {
+ config.Ui.StyleSetDirs[i] = strings.ReplaceAll(styleSetDir, "@SHAREDIR@", sharedir)
+ }
+
if ui, err := file.GetSection("general"); err == nil {
if err := ui.MapTo(&config.General); err != nil {
return nil, err work? |
29216c4
to
536195f
Compare
Thanks, I think that works as advertised. I have tested with no config and the config I had been using in 0.4.0. I'd appreciate further testing before this is merged though. |
536195f
to
4246904
Compare
With commit 4246904 and an empty config directory I'm still getting:
|
Using nixpkgs-review, I can build it but I get a error with no config when I try to run it.
Result of 1 package built:
|
Have it working with the patch below. but I feel like there is a better way of doing it... diff --git a/Makefile b/Makefile
index 77f5e61..98cbc11 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ aerc: $(GOSRC)
-o $@
aerc.conf: config/aerc.conf.in
- sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in
+ cat config/aerc.conf.in > $@
debug: $(GOSRC)
GOFLAGS="-tags=notmuch" \
diff --git a/commands/set.go b/commands/set.go
index cc6333e..d2cdd9d 100644
--- a/commands/set.go
+++ b/commands/set.go
@@ -57,7 +57,7 @@ func SetCore(aerc *widgets.Aerc, args []string) error {
return err
}
- if err := config.LoadConfig(new_file); err != nil {
+ if err := config.LoadConfig(new_file, "NO_SHAREDIR_TO_SET"); err != nil {
return err
}
diff --git a/config/config.go b/config/config.go
index 87d183a..ca182ec 100644
--- a/config/config.go
+++ b/config/config.go
@@ -288,7 +288,7 @@ func installTemplate(root, sharedir, name string) error {
return nil
}
-func (config *AercConfig) LoadConfig(file *ini.File) error {
+func (config *AercConfig) LoadConfig(file *ini.File, sharedir string) error {
if filters, err := file.GetSection("filters"); err == nil {
// TODO: Parse the filter more finely, e.g. parse the regex
for _, match := range filters.KeyStrings() {
@@ -318,6 +318,7 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
config.Filters = append(config.Filters, filter)
}
}
+
if viewer, err := file.GetSection("viewer"); err == nil {
if err := viewer.MapTo(&config.Viewer); err != nil {
return err
@@ -421,6 +422,18 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
}
}
+ for i, filter := range config.Filters {
+ config.Filters[i].Command = strings.ReplaceAll(filter.Command, "@SHAREDIR@", sharedir)
+ }
+
+ for i, templateDir := range config.Templates.TemplateDirs {
+ config.Templates.TemplateDirs[i] = strings.ReplaceAll(templateDir, "@SHAREDIR@", sharedir)
+ }
+
+ for i, styleSetDir := range config.Ui.StyleSetDirs {
+ config.Ui.StyleSetDirs[i] = strings.ReplaceAll(styleSetDir, "@SHAREDIR@", sharedir)
+ }
+
if err := config.Ui.loadStyleSet(
config.Ui.StyleSetDirs); err != nil {
return err
@@ -470,6 +483,11 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
return nil, err
}
}
+ if sec, err := file.GetSection("templates"); err == nil {
+ if key, err := sec.GetKey("template-dirs"); err == nil {
+ sec.NewKey("template-dirs", strings.ReplaceAll(key.String(), "@SHAREDIR@", sharedir))
+ }
+ }
file.NameMapper = mapName
config := &AercConfig{
Bindings: BindingConfig{
@@ -543,7 +561,7 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
quit, _ := ParseBinding("<C-q>", ":quit<Enter>")
config.Bindings.AccountWizard.Add(quit)
- if err = config.LoadConfig(file); err != nil {
+ if err = config.LoadConfig(file, sharedir); err != nil {
return nil, err
} |
AFAICT this seems redundant now that #107880 is through. Can I close this? |
Yep, that looks like it's done the job. I'll close this down now. |
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)I had to remake the
runtime-sharedir
patch as it no longer applied cleanly.