You are not logged in.

#1 2019-03-05 16:14:59

jbenge1
Member
From: Az
Registered: 2018-04-09
Posts: 151

[SOLVED]Please review my PKGBUILD

Hello all I have two questions (I hope this is ok, but I am more than happy to open a second thread if need be)

1.) I am curious if I could have my PKGBUILD reviewed for ceph-deploy and, 1.5) If it would be eligible for an AUR submission?

# Maintainer: <>
pkgname=ceph-deploy
pkgver=2.0.2
pkgrel=1
pkgdesc="Automation tool for ceph file cluster"
arch=("any")
url="https://github.com/ceph/ceph-deploy.git"
license=('MIT')
depends=('python-virtualenv')
provides=("$pkgname")
conflicts=("$pkgname")
source=("git+https://github.com/ceph/ceph-deploy.git")
md5sums=('SKIP')

build() {
    cd $srcdir/$pkgname
    test -d virtualenv || virtualenv -p python virtualenv
    ./virtualenv/bin/python setup.py develop
}

package() {
    cd "$srcdir/$pkgname"
    test -e ceph-deploy || ln -s virtualenv/bin/ceph-deploy .

    install -Dm755 ceph-deploy /usr/bin/
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

2.) (This may just be an oversight) But I don't see any explicit Makefile for the tool (which is how I see all the other PKGBUILD's I've used do it), so I am assuming I would just copy the executable file ceph-deploy into /usr/bin? If not how should I be doing this? and If it is correct, how would I go about copying it over to /usr/bin?  Currently I get the following error (and IIRC you can't run makepkg as root?)

$ makepkg -s
...
install: cannot create regular file '/usr/bin/ceph-deploy': Permission denied
==> ERROR: A failure occurred in package().
    Aborting...

Last edited by jbenge1 (2019-03-05 21:12:24)


"Dr. Madden, why don't the natural numbers include 0?" -me
"....... Take a philosophy course" -Dr. Madden

Offline

#2 2019-03-05 20:12:50

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED]Please review my PKGBUILD

install -Dm755 ceph-deploy /usr/bin/

and the resulting

install: cannot create regular file '/usr/bin/ceph-deploy': Permission denied

/usr/bin is referencing the the absolute path of the host system to package it use a relative path under $pkgdir

    install -Dm755 ceph-deploy "$pkgdir"/usr/bin/ceph-deploy

Edit:

provides=("$pkgname")
conflicts=("$pkgname")

All packages provide themselves and conflicting does not make sense.

source=("git+https://github.com/ceph/ceph-deploy.git")

makedepends does not include git and you have not pinned a specific commit or tag so the package-name should have a -git suffix and a pkgver function provided.
python packaging especially virtualenv usage is outside my area so I can not comment on the rest.
Edit:
fixed $pkgdir example usage
Edit:
fixed install usage

Last edited by loqs (2019-03-05 21:11:50)

Offline

#3 2019-03-05 20:26:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED]Please review my PKGBUILD

I believe loqs's install example has a typo, $pkgdir should be prefixed to the destination as you already have done for the LICENSE file:

    install -Dm755 ceph-deploy "$pkgdir/usr/bin/"

Last edited by Trilby (2019-03-05 20:27:18)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2019-03-05 20:30:07

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED]Please review my PKGBUILD

Trilby wrote:

I believe loqs's install example has a typo, $pkgdir should be prefixed to the destination as you already have done for the LICENSE file:

    install -Dm755 ceph-deploy "$pkgdir/usr/bin/"

Fixed thank you for spotting that.

Offline

#5 2019-03-05 20:50:23

jbenge1
Member
From: Az
Registered: 2018-04-09
Posts: 151

Re: [SOLVED]Please review my PKGBUILD

pkgname=ceph-deploy-git
_pkgname=ceph-deploy
pkgver=2.0.2
pkgrel=1
pkgdesc="Automation tool for ceph file cluster"
arch=("any")
url="https://github.com/ceph/ceph-deploy.git"
license=('MIT')
depends=('python-virtualenv')
makedepends=('git')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("git+https://github.com/ceph/ceph-deploy.git")
md5sums=('SKIP')

build() {
    cd $srcdir/$_pkgname
    test -d virtualenv || virtualenv -p python virtualenv
    ./virtualenv/bin/python setup.py develop
}

package() {
    cd "$srcdir/$_pkgname"
    test -e ceph-deploy || ln -s virtualenv/bin/ceph-deploy .

    install -Dm755 ceph-deploy ${pkgdir}/usr/bin
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

Here is the updated PKGBUILD

But now when running makpkg, I am presented with the following errors

ceph-deploy]$ makepkg -si
==> Making package: ceph-deploy-git 2.0.2-1 (Tue Mar  5 13:49:23 2019)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Cloning ceph-deploy git repo...
Cloning into bare repository '/home/justin/Documents/Build/ceph-deploy/ceph-deploy'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 10945 (delta 4), reused 3 (delta 1), pack-reused 10929
Receiving objects: 100% (10945/10945), 2.62 MiB | 4.26 MiB/s, done.
Resolving deltas: 100% (7041/7041), done.
==> Validating source files with md5sums...
    ceph-deploy ... Skipped
==> Extracting sources...
  -> Creating working copy of ceph-deploy git repo...
Cloning into 'ceph-deploy'...
done.
==> Starting build()...
Already using interpreter /usr/bin/python
Using base prefix '/usr'
New python executable in /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/bin/python
Installing setuptools, pip, wheel...done.
running develop
running egg_info
creating ceph_deploy.egg-info
writing ceph_deploy.egg-info/PKG-INFO
writing dependency_links to ceph_deploy.egg-info/dependency_links.txt
writing entry points to ceph_deploy.egg-info/entry_points.txt
writing requirements to ceph_deploy.egg-info/requires.txt
writing top-level names to ceph_deploy.egg-info/top_level.txt
writing manifest file 'ceph_deploy.egg-info/SOURCES.txt'
reading manifest file 'ceph_deploy.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'ceph_deploy.egg-info/SOURCES.txt'
running build_ext
Creating /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages/ceph-deploy.egg-link (link to .)
Adding ceph-deploy 2.0.2 to easy-install.pth file
Installing ceph-deploy script to /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/bin

Installed /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy
Processing dependencies for ceph-deploy==2.0.2
Searching for remoto
Reading https://pypi.org/simple/remoto/
Downloading https://files.pythonhosted.org/packages/8a/76/0eee00bc1de7a047e4bb3047ade022fae7e7c2c80ffc6401ef71c700d31c/remoto-1.1.0.tar.gz#sha256=3e9d9898b88b5993df985bad22382df0fbd9ecb3ca8052e2443f81b5a0eb521a
Best match: remoto 1.1.0
Processing remoto-1.1.0.tar.gz
Writing /tmp/easy_install-75xr4x7r/remoto-1.1.0/setup.cfg
Running remoto-1.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-75xr4x7r/remoto-1.1.0/egg-dist-tmp-5g4cfv_e
creating /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages/remoto-1.1.0-py3.7.egg
Extracting remoto-1.1.0-py3.7.egg to /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages
Adding remoto 1.1.0 to easy-install.pth file

Installed /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages/remoto-1.1.0-py3.7.egg
Searching for execnet
Reading https://pypi.org/simple/execnet/
Downloading https://files.pythonhosted.org/packages/f9/76/3343e69a2a1602052f587898934e5fea395d22310d39c07955596597227c/execnet-1.5.0-py2.py3-none-any.whl#sha256=fc155a6b553c66c838d1a22dba1dc9f5f505c43285a878c6f74a79c024750b83
Best match: execnet 1.5.0
Processing execnet-1.5.0-py2.py3-none-any.whl
Installing execnet-1.5.0-py2.py3-none-any.whl to /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages
writing requirements to /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages/execnet-1.5.0-py3.7.egg/EGG-INFO/requires.txt
Adding execnet 1.5.0 to easy-install.pth file

Installed /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages/execnet-1.5.0-py3.7.egg
Searching for apipkg>=1.4
Reading https://pypi.org/simple/apipkg/
Downloading https://files.pythonhosted.org/packages/67/08/4815a09603fc800209431bec5b8bd2acf2f95abdfb558a44a42507fb94da/apipkg-1.5-py2.py3-none-any.whl#sha256=58587dd4dc3daefad0487f6d9ae32b4542b185e1c36db6993290e7c41ca2b47c
Best match: apipkg 1.5
Processing apipkg-1.5-py2.py3-none-any.whl
Installing apipkg-1.5-py2.py3-none-any.whl to /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages
Adding apipkg 1.5 to easy-install.pth file

Installed /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages/apipkg-1.5-py3.7.egg
Searching for setuptools==40.8.0
Best match: setuptools 40.8.0
Adding setuptools 40.8.0 to easy-install.pth file
Installing easy_install script to /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/bin
Installing easy_install-3.6 script to /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/bin

Using /home/justin/Documents/Build/ceph-deploy/src/ceph-deploy/virtualenv/lib/python3.7/site-packages
Finished processing dependencies for ceph-deploy==2.0.2
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> WARNING: Package contains reference to $srcdir
usr/bin
==> Creating package "ceph-deploy-git"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: ceph-deploy-git 2.0.2-1 (Tue Mar  5 13:49:29 2019)
==> Installing package ceph-deploy-git with pacman -U...
[sudo] password for justin: 
loading packages...
resolving dependencies...
looking for conflicting packages...

Package (1)      New Version  Net Change

ceph-deploy-git  2.0.2-1        0.02 MiB

Total Installed Size:  0.02 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                                                             [----------------------------------------------------] 100%
(1/1) checking package integrity                                                           [----------------------------------------------------] 100%
(1/1) loading package files                                                                [----------------------------------------------------] 100%
(1/1) checking for file conflicts                                                          [----------------------------------------------------] 100%
error: failed to commit transaction (conflicting files)
ceph-deploy-git: /usr/bin exists in filesystem
Errors occurred, no packages were upgraded.
==> WARNING: Failed to install built package(s).

"Dr. Madden, why don't the natural numbers include 0?" -me
"....... Take a philosophy course" -Dr. Madden

Offline

#6 2019-03-05 21:01:55

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED]Please review my PKGBUILD

    install -Dm755 ceph-deploy ${pkgdir}/usr/bin

has renamed ceph-deploy to bin and installed it in the directory ${pkgdir}/usr
either of the following should resolve it

    install -dm755 "${pkgdir}"/usr/bin
    install -m755 ceph-deploy "${pkgdir}"/usr/bin
    install -Dm755 ceph-deploy "${pkgdir}"/usr/bin/ceph-deploy

Sorry for not spotting that.
Edit:
quoted ${pkgdir} in examples

Last edited by loqs (2019-03-05 21:10:57)

Offline

#7 2019-03-05 21:12:10

jbenge1
Member
From: Az
Registered: 2018-04-09
Posts: 151

Re: [SOLVED]Please review my PKGBUILD

thanks for your help big_smile Marking as solved. One final question, I've only ever adopted packages, never actually submitted anything myself. Does this look well enough to be submitted??


"Dr. Madden, why don't the natural numbers include 0?" -me
"....... Take a philosophy course" -Dr. Madden

Offline

#8 2019-03-05 21:22:25

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED]Please review my PKGBUILD

I believe it needs someone who has experience with virtualenv to comment on it when I built it in a chroot the produced usr/bin/ceph-deploy had this #!

#!/build/ceph-deploy-git/src/ceph-deploy/virtualenv/bin/python

I do not believe that path will not resolve on the installed system

Offline

#9 2019-03-05 21:33:49

jbenge1
Member
From: Az
Registered: 2018-04-09
Posts: 151

Re: [SOLVED]Please review my PKGBUILD

loqs wrote:

I believe it needs someone who has experience with virtualenv to comment on it when I built it in a chroot the produced usr/bin/ceph-deploy had this #!
I do not believe that path will not resolve on the installed system

Maybe it's the double negative, but I am struggling to understand what you mean by this, could you possibly clarify?

While I haven't tested it extensivley (by any strech of the word) it has seemed to work just fine on my to machines for deploying a ceph cluster. Should I unmark as solved? Or open a new topic about this?


"Dr. Madden, why don't the natural numbers include 0?" -me
"....... Take a philosophy course" -Dr. Madden

Offline

#10 2019-03-05 21:46:52

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED]Please review my PKGBUILD

I do not believe that path will resolve on the installed system.  The double negative was nonsensical.
If you install devtools.  Build the package with extra-x86_64-build and install the generated package that still works?
It seems the same topic to me but if you think a new thread would be better I can not see any objection to that either.
Edit:
tested on this system

# pacman -U ceph-deploy-git-2.0.2-1-any.pkg.tar.xz
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (2) python-virtualenv-16.0.0-1  ceph-deploy-git-2.0.2-1

Total Installed Size:  2.09 MiB

:: Proceed with installation? [Y/n] y
(2/2) checking keys in keyring                     [######################] 100%
(1/2) checking package integrity                   [######################] 100%
(1/2) loading package files                        [######################] 100%
(2/2) checking for file conflicts                  [######################] 100%
(2/2) checking available disk space                [######################] 100%
:: Processing package changes...
(1/2) installing python-virtualenv                 [######################] 100%
(2/2) installing ceph-deploy-git                   [######################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
$ ceph-deploy
bash: /usr/bin/ceph-deploy: /build/ceph-deploy-git/src/ceph-deploy/virtualenv/bin/python: bad interpreter: No such file or directory

Last edited by loqs (2019-03-05 21:51:12)

Offline

#11 2019-03-05 22:14:42

jbenge1
Member
From: Az
Registered: 2018-04-09
Posts: 151

Re: [SOLVED]Please review my PKGBUILD

Maybe I'm doing something wrong, but using extra-x86_64-build produces the following

https://ptpb.pw/scDR

then installing with pacman -U ...

$ sudo pacman -U ceph-deploy-git-2.0.2-1-any.pkg.tar.xz                                                                :(
loading packages...
resolving dependencies...
looking for conflicting packages...

Package (2)              New Version  Net Change

extra/python-virtualenv  16.0.0-1       2.07 MiB
ceph-deploy-git          2.0.2-1        0.03 MiB

Total Installed Size:  2.09 MiB

:: Proceed with installation? [Y/n] 
(2/2) checking keys in keyring                                                             [----------------------------------------------------] 100%
(1/2) checking package integrity                                                           [----------------------------------------------------] 100%
(1/2) loading package files                                                                [----------------------------------------------------] 100%
(2/2) checking for file conflicts                                                          [----------------------------------------------------] 100%
(2/2) checking available disk space                                                        [----------------------------------------------------] 100%
:: Processing package changes...
(1/2) installing python-virtualenv                                                         [----------------------------------------------------] 100%
(2/2) installing ceph-deploy-git                                                           [----------------------------------------------------] 100%
:: Running post-transaction hooks...
(1/5) Listing all orphaned packages
==> No candidates found for pruning


(2/5) Removing all versions older than 2 versions ago
==> no candidate packages found for pruning
(3/5) Removing all uninstalled cache data
==> no candidate packages found for pruning
(4/5) Arming ConditionNeedsUpdate...
(5/5) Updating package count for pretty conky output :)

??

Also on a seprate side note, what does extra-x86_64-build do? I couldn't really find much about it on the internet


"Dr. Madden, why don't the natural numbers include 0?" -me
"....... Take a philosophy course" -Dr. Madden

Offline

#12 2019-03-05 22:30:05

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED]Please review my PKGBUILD

Did the command not finish?  Otherwise it installed but I can not see you executing ceph-deploy.
DeveloperWiki:Building_in_a_clean_chroot#Convenience_way
It setups a chroot as would be used by a developer to build a package intended for the extra repository then builds the package in that chroot then runs namcap on it.

Last edited by loqs (2019-03-05 22:30:23)

Offline

#13 2019-03-05 22:41:29

jbenge1
Member
From: Az
Registered: 2018-04-09
Posts: 151

Re: [SOLVED]Please review my PKGBUILD

That was my mistake, after removing all the old references to the originally built package, building using extra-x86_64-build, I also am seeing the same error as you hmm I will look into this further, and possibly ask upstream?


"Dr. Madden, why don't the natural numbers include 0?" -me
"....... Take a philosophy course" -Dr. Madden

Offline

#14 2019-03-05 22:58:23

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED]Please review my PKGBUILD

I don't know much about virtualenv, but I really don't think it should be used when building packages.  The following build and package will likely be sufficient:

build() {
        cd "$pkgname"
        python setup.py build
}

package() {
        cd "$pkgname"
        python setup.py install --root="$pkgdir" --optimize=1
}

Be sure to add a pkgver function too, then remove virtualenv from the dependencies, but do add the actual depenendencies.

EDIT: and keep the manual installation of the license file as setup.py will not manage this for you.

Last edited by Trilby (2019-03-05 22:59:55)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#15 2019-03-06 09:13:02

jbenge1
Member
From: Az
Registered: 2018-04-09
Posts: 151

Re: [SOLVED]Please review my PKGBUILD

Here is the updated pkgbuild

pkgname=ceph-deploy-git
_pkgname=ceph-deploy
pkgver=r2063.e5831d6
pkgrel=1
pkgdesc="Automation tool for ceph file cluster"
arch=("any")
url="https://github.com/ceph/ceph-deploy.git"
license=('MIT')
depends=('python-setuptools' 'python-execnet')
makedepends=('git')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("git+https://github.com/ceph/ceph-deploy.git")
md5sums=('SKIP')

pkgver() {
  cd "$_pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}



build() {
    cd $_pkgname
    python setup.py build
}

package() {
    cd $_pkgname
    python setup.py install --root="$pkgdir" --optimize=1
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

I'm not great with git, so probably the pkgver function is wrong?


"Dr. Madden, why don't the natural numbers include 0?" -me
"....... Take a philosophy course" -Dr. Madden

Offline

#16 2019-03-06 13:34:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED]Please review my PKGBUILD

Upstream tags releases, so you should use the first form of the pkgver function from the wiki with one addition to remove the initial 'v':

   git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#17 2019-03-06 13:39:13

jbenge1
Member
From: Az
Registered: 2018-04-09
Posts: 151

Re: [SOLVED]Please review my PKGBUILD

How is it looking now?

pkgname=ceph-deploy-git
_pkgname=ceph-deploy
pkgver=r2063.e5831d6
pkgrel=1
pkgdesc="Automation tool for ceph file cluster"
arch=("any")
url="https://github.com/ceph/ceph-deploy.git"
license=('MIT')
depends=('python-setuptools' 'python-execnet')
makedepends=('git')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("git+https://github.com/ceph/ceph-deploy.git")
md5sums=('SKIP')

pkgver() {
  cd "$_pkgname"
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

build() {
    cd $_pkgname
    python setup.py build
}

package() {
    cd $_pkgname
    python setup.py install --root="$pkgdir" --optimize=1
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

"Dr. Madden, why don't the natural numbers include 0?" -me
"....... Take a philosophy course" -Dr. Madden

Offline

Board footer

Powered by FluxBB