johnmehr / gitup

A minimalist, dependency-free FreeBSD program to clone/pull Git repositories.
BSD 2-Clause "Simplified" License
51 stars 9 forks source link

Make path of gitup.conf configurable. #5

Closed yasuhirokimura closed 3 years ago

yasuhirokimura commented 3 years ago

Make path of gitup.conf configurable by editing Makefile.

johnmehr commented 3 years ago

Thank you!

If it's ok with you, I'd like to postpone merging this until gitup has had more testing. I know there are things I'm missing (such as including additional directories to ignore in /usr/src) and since /usr/local/etc is normally only writable by root, I don't think it's safe just yet to take that step.

johnmehr commented 3 years ago

Do you have any ideas on how to make this work when gitup is added to the ports tree? If someone alters Makefile, the changes they make will be overwritten the next time the ports tree is pulled.

Thank you!

yasuhirokimura commented 3 years ago

@johnmehr If gitup is added to ports tree the path of gitup.conf will be fixed (e.g. /usr/local/etc/gitup.conf). It is decided by the maintainer of gitup port. From the viewpoint of ports framework this patch makes it easy for the maintainer of gitup port (and not for the user of gitup port) to change path of gitup.conf.

Does this explanation answers your question?

rbgarga commented 3 years ago

Do you have any ideas on how to make this work when gitup is added to the ports tree? If someone alters Makefile, the changes they make will be overwritten the next time the ports tree is pulled.

We have mechanisms in the ports tree to change source code during port build. Basically it uses sed to replace some hardcoded part of Makefile (or any other file in the source code) by environment variables from ports tree. So when we upgrade a port to a newer version we always make sure same changes are applied.

emaste commented 3 years ago

Could do something like

#ifndef CONFIG_FILE_PATH
#define CONFIG_FILE_PATH "./gitup.conf"
#endif

        const char         *configuration_file = CONFIG_FILE_PATH;

and then set CONFIG_FILE_PATH in the make invocation

johnmehr commented 3 years ago

I just added Ed's patch to gitup.c and committed it. Should I update the other three files?

rbgarga commented 3 years ago

I just added Ed's patch to gitup.c and committed it. Should I update the other three files?

It would make more sense if you rename manpage files adding a prefix .in and replace config file path by recently created variable CONFIG_FILE_PATH during build. This way all files will have the same information

nunotexbsd commented 3 years ago

Olá Renato,

I am testing gitup port to latest commit 093c480 (Added option to make configuration file path configurable.) and I've used: CFLAGS+= -DCONFIG_FILE_PATH=\\"${LOCALBASE}/etc/gitup.conf\\" with success!

Thanks,

Nuno

rbgarga commented 3 years ago

I just added Ed's patch to gitup.c and committed it. Should I update the other three files?

Take a look at the approach I used at https://github.com/johnmehr/gitup/pull/17

johnmehr commented 3 years ago

This should be taken care of with Renato's pull request. Thank you!