openhab / openhab-linuxpkg

Repo for Linux packages
Eclipse Public License 2.0
18 stars 33 forks source link

Added RPM package generation and upload #37

Closed BClark09 closed 7 years ago

BClark09 commented 7 years ago

Requires testing to confirm the following before merge:

To help test, please use the following /etc/yum.repos.d/openHAB.repo

[openHAB]
name=openHAB
baseurl=https://openhab.jfrog.io/openhab/linuxpkg-testing-rpm/
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://openhab.jfrog.io/openhab/api/gpg/key/public

install with:

yum install openhab2
yum install openhab2-addons
yum install openhab2-addons-legacy

Closes #36

Signed-off-by: Ben Clark ben@benjyc.uk

Stormwind99 commented 7 years ago

Error on Fedora 24:

[root@linus opt]# dnf install openhab2
Last metadata expiration check: 0:00:28 ago on Fri Feb 17 14:50:12 2017.
Error: nothing provides adduser needed by openhab2-2.1.0.20170217150518-1.noarch
(try to add '--allowerasing' to command line to replace conflicting packages)
[root@linus opt]# dnf install --allowerasing openhab2
Last metadata expiration check: 0:02:27 ago on Fri Feb 17 14:50:12 2017.
Error: nothing provides adduser needed by openhab2-2.1.0.20170217150518-1.noarch

adduser exists on the system, provided by shadow-utils package:

[root@linus opt]# which adduser
/usr/sbin/adduser
[root@linus opt]# rpm -q -f /usr/sbin/adduser
shadow-utils-4.2.1-8.fc24.i686

In https://github.com/openhab/openhab-linuxpkg/pull/37/files I see:

requires('adduser')

One way to fix might be (though might not be right for non-RH/Fedora/CentOS distros, I'm unsure):

if (pType == 'Rpm') {
requires('shadow-utils')
} else {
requires('adduser')
}

I don't know if gradle exposes this at the build.gradle level, but Fedora packaging guidelines use Requires(pre): shadow-utils and useradd: https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Dynamic_allocation

BClark09 commented 7 years ago

Hmm, even getting passed that the openhab user doesn't exist because there's no RPM based addgroup. Bare with me for a bit.

BClark09 commented 7 years ago

image

The latest version seems to work for testing.

theoweiss commented 7 years ago

@BClark09 I did the rpm packaging some weeks ago for a project at work. I've used the packaging of elasticsearch as template: You will need to add more deb/rpm specific handling into the script files as you can see here: https://github.com/elastic/elasticsearch/tree/master/distribution/src/main/packaging/scripts I suggest to stick with addgroup and adduser for debian like the elasticsearch guys did.

The script files are called with a different set of arguments depending if the executor is rpm or deb. Therefore you can distinguish between rpm and deb installations.

Stormwind99 commented 7 years ago

The yum repo packages still give me the adduser error - guessing the rpm in the repo has not been updated yet?

BClark09 commented 7 years ago

Hmm, what happens when you

dnf clean all
dnf update

?

sipvoip commented 7 years ago

Just a cosmetic thing, but you want way to rename it to openHAB rather then openHABRepo. Only issue I ran into was a LOT of warnings like:

warning: user openhab does not exist - using root warning: group openhab does not exist - using root

Should not the .spec file create the user if it does not exist? Also, should think about signing the rpms.

Was not able to install addons:

Transaction check error: file /usr/share/openhab2 from install of openhab2-addons-0:2.1.0.20170218132317-1.noarch conflicts with file from package openhab2-0:2.1.0.20170218132317-1.noarch

Also some errors with remove:

Running transaction Erasing : openhab2-2.1.0.20170218132317-1.noarch 1/1 postrm called with unknown argument `0' warning: %postun(openhab2-0:2.1.0.20170218132317-1.noarch) scriptlet failed, exit status 1 Non-fatal POSTUN scriptlet failure in rpm package openhab2-2.1.0.20170218132317-1.noarch Verifying : openhab2-2.1.0.20170218132317-1.noarch 1/1

Removed: openhab2.noarch 0:2.1.0.20170218132317-1

Complete!

BClark09 commented 7 years ago

Thanks for testing both, this is really helpful!

Just a cosmetic thing, but you want way to rename it to openHAB rather then openHABRepo

Good point! Will change that when I come to writing it up in docs.

warning: user openhab does not exist - using root warning: group openhab does not exist - using root

Right, I see that RPM and APT use different terms for [pre/post][inst/rm] and was trying to use the same ones. I've submitted another package to the repo to address this. Does this fix all the known errors (besides not being able to install addons)?

Also, should think about signing the rpms.

They will be signed with the same GPG key as the Deb files are when testing is complete.

BClark09 commented 7 years ago

@theoweiss Have just seen your comment, sorry. Now that the basics are working I will follow the same style as you have showed.

Stormwind99 commented 7 years ago

@BClark09 - dnf clean worked, but repos don't normally require that step to find newer packages.

The following worked and installled openhab2-2.1.0.20170218221203-1.noarch.rpm:

dnf clean
dnf install --nogpgcheck openhab2
Stormwind99 commented 7 years ago

Error on installing openhab2-addons:

Error: Transaction check error:
  file /usr/share/openhab2 from install of openhab2-addons-0:2.1.0.20170218221203-1.noarch conflicts with file from package openhab2-0:2.1.0.20170218221203-1.noarch
BClark09 commented 7 years ago

Hi @Stormwind99 and @sipvoip. I have completed the work on the rpm packages, and all known issues are resolved. Would you be able to test them for me? To do so you'll need to first

yum remove openhab2
yum update
yum install openhab2
yum install openhab2-addons

if you want to simulate an upgrade, then you can pick the other version (has the same rpm setup as the latest) on the repo, simply by running the command:

yum install openhab2-2.1.0.20170225003526

Please let me know how you get on, I have tested a new install and upgrade of all packages on Fedora 25, but would like confirmation before I start moving to a full repo with GPG signing.

BClark09 commented 7 years ago

@theoweiss, assuming that others are able to confirm my tests would you be happy for this PR (based on this diff to be merged?

Stormwind99 commented 7 years ago

Both packages installed without error for me in Fedora 24:

dnf remove openhab2
dnf update
dnf install --nogpgcheck openhab2
dnf install --nogpgcheck openhab2-addons
sipvoip commented 7 years ago

On Centos 7, I tested openhab2 first, and then addons, and also tested just installed addons and having yum realize it needed to pull openhab2 also. yum remove openhab2 also works, tho I don't know why anyone would want to remove openHab. ;-)

<> nathan stratton

On Sat, Feb 25, 2017 at 11:30 AM, Jason Spangler notifications@github.com wrote:

Both packages installed without error for me:

dnf remove openhab2 dnf update dnf install --nogpgcheck openhab2 dnf install --nogpgcheck openhab2-addons

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openhab/openhab-linuxpkg/pull/37#issuecomment-282494889, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMUEirvtdPRhjkBjMFcQ4S-XAEn-iK4ks5rgFdBgaJpZM4MEZeV .

BClark09 commented 7 years ago

Thanks @Stormwind99 and @sipvoip for testing! And thanks @theoweiss for reviewing, I've added the documentation now so will merge and test a gpg signed version!