Skip to content
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

How should distribution package the latest autojump? #338

Closed
Siosm opened this issue Dec 18, 2014 · 17 comments
Closed

How should distribution package the latest autojump? #338

Siosm opened this issue Dec 18, 2014 · 17 comments
Labels

Comments

@Siosm
Copy link

Siosm commented Dec 18, 2014

Distributions (Arch Linux example: https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/autojump) use this kind of command to package autojump:

$ ./install.py --destdir "${pkgdir}" --prefix 'usr/' --zshshare 'usr/share/zsh/site-functions'

But this creates broken '/etc/profile.d/autojump.sh' config files with a custom path dependent on the compile time folder location and not the actual prefix location (example from a custom build on my system):

# the login $SHELL isn't always the one used
# NOTE: problems might occur if /bin/sh is symlinked to /bin/bash
if [ -n "${BASH}" ]; then
    shell="bash"
elif [ -n "${ZSH_NAME}" ]; then
    shell="zsh"
elif [ -n "${__fish_datadir}" ]; then
    shell="fish"
elif [ -n "${version}" ]; then
    shell="tcsh"
else
    shell=$(echo ${SHELL} | awk -F/ '{ print $NF }')
fi

# prevent circular loop for sh shells
if [ "${shell}" = "sh" ]; then
    return 0

# check local install
elif [ -s ~/.autojump/share/autojump/autojump.${shell} ]; then
    source ~/.autojump/share/autojump/autojump.${shell}

# check global install
elif [ -s /usr/local/share/autojump/autojump.${shell} ]; then
    source /usr/local/share/autojump/autojump.${shell}

fi

# check custom install         
if [ -s /home/tim/projects/perso/asp/autojump/repos/community-any/pkg/autojump/etc/profile.d/autojump.${shell} ]; then             
    source /home/tim/projects/perso/asp/autojump/repos/community-any/pkg/autojump/etc/profile.d/autojump.${shell}         
fi

The expected custom section:

# check custom install         
if [ -s /usr/share/autojump/autojump.${shell} ]; then             
    source /usr/share/autojump/autojump.${shell}         
fi

Fixing this is more than just replacing 'etc_dir' by 'share_dir' in install.py:210 (which might be a good thing to do too), so I'm asking for inputs.

@youtux
Copy link

youtux commented Dec 18, 2014

Fix in #339

@BenoitZugmeyer
Copy link

The issue here (for Arch at least) is that the packaging is done in a random directory, and files are put in the system directories during package installation.

So, when packaging, the --prefix option needs to be passed as relative to the current directory (so the files are put in /home/aaa/autojump/pkg/usr for example), but the generated autojump.sh tries to source the absolute path where the packaging has occured (/home/aaa/autojump/pkg/usr/share/autojump.sh) instead of the system one (/usr/share/...).

@Siosm
Copy link
Author

Siosm commented Dec 18, 2014

Thanks @youtux, this looks like valid fix for the last part of the problem.

@youtux
Copy link

youtux commented Dec 18, 2014

@BenoitZugmeyer mmm, I see. I think that other programs have this kind of issue, do you know how it is solved?

@youtux
Copy link

youtux commented Dec 18, 2014

@Siosm @BenoitZugmeyer What is the value of pkgdir in your case?

@Siosm
Copy link
Author

Siosm commented Dec 18, 2014

@youtux It's the output folder conventionally used to instruct Makefiles to put all the content at install time in the DESTDIR folder instead of the current /. It depends on where you're storing your PKGBUILD (the file that describe how packages are build for Arch Linux). It could be any one of:
/home/tim/projects/perso/asp/autojump/repos/community-any/pkg/
/home/tim/projects/packages/autojump/pkg/
...

@BenoitZugmeyer
Copy link

@youtux I'm sorry, I have no idea how other packages deal with that. Adding another install.py option, like --destdir, defaulting to --prefix, might help.
FYI, the Arch maintainer did fix the package with a few sed: https://projects.archlinux.org/svntogit/community.git/commit/trunk?h=packages/autojump&id=b87100cfb5972b67e6249ca3514deba68d96e972

@youtux
Copy link

youtux commented Dec 18, 2014

Does #328 solve your issue? Although it seems pretty convoluted.

@Siosm
Copy link
Author

Siosm commented Dec 18, 2014

@youtux It looks like it would fix it.

@wting
Copy link
Owner

wting commented Jan 25, 2015

I've fixed modify_autojump_sh() in fa3ff58. Can you guys check if this is still a problem in the latest version?

@wting wting added the bug label Jan 25, 2015
@mineo
Copy link
Contributor

mineo commented Jan 25, 2015

It's still a problem because autojump.sh will still try to source files from destdir (like /home/wieland/dev/PKGBUILDS/autojump-git/pkg/autojump-git/usr/share/autojump/autojump.${shell} when the file really is in just /usr/share/autojump/autojump.${shell}) which (according to the GNU Coding Standards) should not actually appear in installed files at all.

@youtux
Copy link

youtux commented Jan 25, 2015

@wting Could you please tag the latest version on git? (And maybe also all the future releases). In this way I can test using the brew formula properly, and open a pull request for the new version. Thanks

@wting
Copy link
Owner

wting commented Jan 25, 2015

Sorry, forgot about; done!

@youtux
Copy link

youtux commented Jan 25, 2015

@wting can't still see it. Maybe you forgot to push?

@wting
Copy link
Owner

wting commented Jan 26, 2015

I accidentally only pushed it to my fork (which I use for dev). Just pushed it to this repo.

@0-wiz-0
Copy link

0-wiz-0 commented Feb 8, 2015

I had problems packaging as well, and found this issue. Let me know if I should open a separate issue for this:

I wanted to use 'install.py -fs -p /usr/pkg -d ${SOMETMPDIR}' but get

Custom paths incompatible with --system option.

When I try without '-fs', destdir is ignored:

Installing autojump to /usr/obj/shells/autojump/work/.destdir ...
creating directory: /usr/pkg/bin
creating directory: /usr/pkg/share/man/man1
Traceback (most recent call last):
  File "install.py", line 214, in <module>
    sys.exit(main(parse_arguments()))
  File "install.py", line 177, in main
    mkdir(doc_dir, args.dryrun)
  File "install.py", line 29, in mkdir
    os.makedirs(path)
  File "/usr/pkg/lib/python3.4/os.py", line 227, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/pkg/lib/python3.4/os.py", line 237, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/pkg/share/man'
*** Error code 1

Please let me know what the proper invocation is.

@Siosm
Copy link
Author

Siosm commented Sep 28, 2020

Closing as this will probably never happen. Feel free to reopen / open your own issue if needed.

@Siosm Siosm closed this as completed Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants