archlinux-downgrade / downgrade

Downgrade packages in Arch Linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement independent --version

atreyasha opened this issue · comments

What if we didn't build --version at all, and just had the Issue Template ask for pacman -Qi downgrade?

Using pacman's version comes with the downside that you might be running a dowgrade installed some other way. I'm OK with that downside, but probably only if we didn't implement our own --version that tried to do it. If we just asked users to supply pacman's version information, they can say if they're installed in some other way. If we build it as --version the user wouldn't know that's happening and we might be supplying the wrong information, or throwing an error, etc, etc.

So IMO we either build a real --version or we just ask the users to give us pacman details. I don't feel strongly which though.

Originally posted by @pbrisbin in #137 (comment)

Was thinking again about this issue and had a change of mind, I would like at some point in time to implement an independent --version CLI option outside of pacman.

In terms of implementation, I was thinking that we could add a line or two in the Makefile where on each new release; the new version will be appended somewhere in the downgrade script and perhaps also in the footer of the mandoc. Then any calls with --version would simply search for this version watermark and output it.

WDYT? Any suggestions on the exact implementation?

Edit: One problem with my suggestion here is multiple merges, since any commits from me to downgrade (eg. adding a version watermark before release) would require another approval and merge. To circumvent this, how about adding another PHONY to the Makefile (eg. called version-mark) which simply adds the version watermarks to relevant files based on the version bump we agree on. This could then be part of the book-keeping procedures before releasing. That way, we can leave the actual make release* just as it is; and all the commits to downgrade can happen before as part of book-keeping.

WDYT? Any suggestions on the exact implementation?

If I understand it correctly, a common UNIX-ey way to do this would be to add VERSION = ... to Makefile, make any files that need to know about it .in files and then pre-process them with m4:

VERSION = 1.0.0

downgrade: downgrade.in
  m4 -D @VERSION@=$(VERSION) < $^ > $@
# downgrade.in

# ...

version() {
  echo "downgrade v@VERSION@"
}

# ...

You could get fancier, encoding git information and all that as well, but I defer to you on if we should explore that.