Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 682076 - www-apps/gitea-1.7.4 - pkg_postinst(): FAILED postinst: 1 * No app.ini found, copying initial config over
Summary: www-apps/gitea-1.7.4 - pkg_postinst(): FAILED postinst: 1 * No app.ini found...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Felix Neumärker
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-30 20:19 UTC by Matthias Hauber
Modified: 2019-07-13 17:12 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Hauber 2019-03-30 20:19:48 UTC
+ emerge -q1 www-apps/gitea --buildpkg=y --getbinpkg=y --usepkg=y --buildpkg-exclude 'virtual/*'
>>> Emerging binary (1 of 1) www-apps/gitea-1.7.4::gentoo
>>> Installing (1 of 1) www-apps/gitea-1.7.4::gentoo
>>> Failed to execute postinst for www-apps/gitea-1.7.4
 * Messages for package www-apps/gitea-1.7.4:
 * FAILED postinst: 1
 * No app.ini found, copying initial config over
 * ERROR: www-apps/gitea-1.7.4::gentoo failed (postinst phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line 124:  Called pkg_postinst
 *   environment, line 1540:  Called die
 * The specific snippet of code:
 *           cp "${FILESDIR}"/app.ini "${EROOT}"/var/lib/gitea/conf/ || die;
 * 
 * If you need support, post the output of `emerge --info '=www-apps/gitea-1.7.4::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-apps/gitea-1.7.4::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/www-apps/gitea-1.7.4/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/www-apps/gitea-1.7.4/temp/environment'.
 * Working directory: '/var/tmp/portage/www-apps/gitea-1.7.4/homedir'
 * S: '/var/tmp/portage/www-apps/gitea-1.7.4/work/gitea-1.7.4'

the ebuild places an app.ini.example into /var/lib/gitea/conf. I deleted the whole postinst part because it looks useless to me.
Before I raise a PR I wanted to ensure why this is in place and if someone has a different view to it.
Comment 1 Tomáš Mózes 2019-03-31 02:45:17 UTC
There is already a PR to bump to 1.7.5 that places the configuration into /etc/gitea: https://github.com/gentoo/gentoo/pull/11387

The app.ini is there so that gitea will start for you, because it needs a configuration. An empty configuration allows you to bootstrap via the installation wizard and adjust to your needs.

Please attach the full build log. Do you have app.ini in your /usr/portage/www-apps/gitea/files dir? Do you have a /var/lib/gitea/conf directory?
Comment 2 Matthias Hauber 2019-03-31 11:48:50 UTC
thx for the reference to the PR but this still copies on pkg_postinst a file referenced from ${FILESDIR} which fails on binary package installation.

Thats exactly the point. In src_install a app.ini.example will be installed into /var/lib/gitea/conf. So why try the same in pkg_postinst instead of just renaming the app.ini.example file into app.ini? Why handling a second file in portage that is already shipped in source code?

The app.ini file is available in /usr/portage/www-apps/gitea/files and I have a /var/lib/gitea/conf directory.
But the point is that ${FILESDIR} is pointing to /var/tmp/portage/www-apps/gitea-1.7.4/files
in pkg_postinst which is not available while installing from binary package.

last but not least copying this file in pkg_postinst ends in an orphaned file that is not handled by portage.

-- build log
gitea ~ # emerge -av gitea --buildpkg=y --getbinpkg=y --usepkg=y --buildpkg-exclude 'virtual/*'

 * IMPORTANT: 14 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


These are the packages that would be merged, in order:

Calculating dependencies... done!
[binary   R   ~] www-apps/gitea-1.7.4::gentoo  0 KiB

Total: 1 package (1 reinstall, 1 binary), Size of downloads: 0 KiB

!!! The following binary packages have been ignored due to non matching USE:

    =sys-libs/pam-1.3.0-r2 -berkdb

NOTE: The --binpkg-respect-use=n option will prevent emerge
      from ignoring these binary packages if possible.
      Using --binpkg-respect-use=y will silence this warning.

Would you like to merge these packages? [Yes/No] 

>>> Emerging binary (1 of 1) www-apps/gitea-1.7.4::gentoo
 * gitea-1.7.4.tbz2 MD5 SHA1 size ;-) ...                                [ ok ]
>>> Extracting info
>>> Extracting www-apps/gitea-1.7.4

>>> Installing (1 of 1) www-apps/gitea-1.7.4::gentoo
 * checking 8 files for package collisions
>>> Merging www-apps/gitea-1.7.4 to /
--- /etc/
--- /etc/conf.d/
>>> /etc/conf.d/gitea
--- /etc/init.d/
>>> /etc/init.d/gitea
--- /var/
--- /var/log/
--- /var/log/gitea/
>>> /var/log/gitea/.keep_www-apps_gitea-0
--- /var/lib/
--- /var/lib/gitea/
>>> /var/lib/gitea/.keep_www-apps_gitea-0
--- /var/lib/gitea/conf/
>>> /var/lib/gitea/conf/app.ini.example
--- /var/lib/gitea/data/
>>> /var/lib/gitea/data/.keep_www-apps_gitea-0
--- /usr/
--- /usr/bin/
>>> /usr/bin/gitea
--- /lib/
--- /lib/systemd/
--- /lib/systemd/system/
>>> /lib/systemd/system/gitea.service
>>> Safely unmerging already-installed instance...
No package files given... Grabbing a set.
--- replaced obj /var/log/gitea/.keep_www-apps_gitea-0
--- replaced dir /var/log/gitea
--- replaced dir /var/log
--- replaced obj /var/lib/gitea/data/.keep_www-apps_gitea-0
--- replaced dir /var/lib/gitea/data
--- replaced obj /var/lib/gitea/conf/app.ini.example
--- replaced dir /var/lib/gitea/conf
--- replaced obj /var/lib/gitea/.keep_www-apps_gitea-0
--- replaced dir /var/lib/gitea
--- replaced dir /var/lib
--- replaced dir /var
--- replaced obj /usr/bin/gitea
--- replaced dir /usr/bin
--- replaced dir /usr
--- replaced obj /lib/systemd/system/gitea.service
--- replaced dir /lib/systemd/system
--- replaced dir /lib/systemd
--- cfgpro   dir /lib
--- replaced obj /etc/init.d/gitea
--- replaced dir /etc/init.d
--- replaced obj /etc/conf.d/gitea
--- replaced dir /etc/conf.d
--- replaced dir /etc
>>> Original instance of package unmerged safely.
 * No app.ini found, copying initial config over
cp: cannot stat '/var/tmp/portage/www-apps/gitea-1.7.4/files/app.ini': No such file or directory
 * ERROR: www-apps/gitea-1.7.4::gentoo failed (postinst phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line 124:  Called pkg_postinst
 *   environment, line 1523:  Called die
 * The specific snippet of code:
 *           cp "${FILESDIR}"/app.ini "${EROOT}"/var/lib/gitea/conf/ || die;
 * 
 * If you need support, post the output of `emerge --info '=www-apps/gitea-1.7.4::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-apps/gitea-1.7.4::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/www-apps/gitea-1.7.4/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/www-apps/gitea-1.7.4/temp/environment'.
 * Working directory: '/var/tmp/portage/www-apps/gitea-1.7.4/homedir'
 * S: '/var/tmp/portage/www-apps/gitea-1.7.4/work/gitea-1.7.4'
 * FAILED postinst: 1

>>> Failed to execute postinst for www-apps/gitea-1.7.4

 * Messages for package www-apps/gitea-1.7.4:

 * FAILED postinst: 1
 * No app.ini found, copying initial config over
 * ERROR: www-apps/gitea-1.7.4::gentoo failed (postinst phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line 124:  Called pkg_postinst
 *   environment, line 1523:  Called die
 * The specific snippet of code:
 *           cp "${FILESDIR}"/app.ini "${EROOT}"/var/lib/gitea/conf/ || die;
 * 
 * If you need support, post the output of `emerge --info '=www-apps/gitea-1.7.4::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-apps/gitea-1.7.4::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/www-apps/gitea-1.7.4/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/www-apps/gitea-1.7.4/temp/environment'.
 * Working directory: '/var/tmp/portage/www-apps/gitea-1.7.4/homedir'
 * S: '/var/tmp/portage/www-apps/gitea-1.7.4/work/gitea-1.7.4'

 * GNU info directory index is up-to-date.

 * IMPORTANT: 14 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
Comment 3 Tomáš Mózes 2019-04-01 14:53:34 UTC
The app.ini in $FILESDIR is a minimalistic config that allows you to bootstrap your gitea installation. The sample is much larger and is changed by upstream. So it's not the same file.

I haven't tested the binary pkg installation, maybe we can replace it with a simple echo.
Comment 4 Matthias Hauber 2019-04-01 16:46:10 UTC
ok so it's not the same file but even with echo portage looses control over this file when it is generated in pkg_postinst. If you feel more comfortable with a minimal config why not shipping it through src_install to /etc/gitea and use CONFIG_PROTECT to ensure it will not overwritten while updating/remerging?
Comment 5 Tomáš Mózes 2019-04-01 18:33:30 UTC
(In reply to Matthias Hauber from comment #4)
> ok so it's not the same file but even with echo portage looses control over
> this file when it is generated in pkg_postinst. If you feel more comfortable
> with a minimal config why not shipping it through src_install to /etc/gitea
> and use CONFIG_PROTECT to ensure it will not overwritten while
> updating/remerging?

It will be populated during your first run wizard. Later, gitea can adjust new settings automatically, but you may copy your own settings if you wish.
Comment 6 Felix Neumärker 2019-07-13 17:12:43 UTC
starting with 1.8.2 app.ini is handled within src_install and `etc-update` takes care of updates.