Bug 274955 - net/gitup: mismatched checksums
Summary: net/gitup: mismatched checksums
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Nuno Teixeira
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-07 16:07 UTC by Denis Shaposhnikov
Modified: 2024-01-20 16:19 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (eduardo)


Attachments
gitup-0.98.14_1.patch (1.10 KB, patch)
2023-12-27 00:46 UTC, takefu
takefu: maintainer-approval+
Details | Diff
gitup-0.98.14.patch2 (540 bytes, patch)
2024-01-03 23:38 UTC, takefu
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Shaposhnikov 2023-11-07 16:07:20 UTC
Hi,

after every update of net/gitup I'm getting

  Checking for packages with mismatched checksums:
  gitup-0.98.14: /usr/local/etc/gitup.conf.sample

I fix it by `pkg check -r gitup`, but after next update I'm getting mismatched checksums again.
Comment 1 Nuno Teixeira freebsd_committer freebsd_triage 2023-11-08 08:48:20 UTC
Hello Denis,

Thanks for let me know about it.

Currently, port is doing a 'pkg-post-install' with sed command to update gitup.sample pkg install fase.

I'm looking for a way to improve this feature avoiding checksum mismatch.

Thanks
Comment 2 Denis Shaposhnikov 2023-12-09 16:40:53 UTC
I think pkg-post-install file should be replaced by something like

#!/bin/sh
osrel=$(${PKG_ROOTDIR}/bin/freebsd-version -u)
releng=${osrel%%-*}
stable=${osrel%%.*}

if [ ! -e "${PKG_PREFIX}/etc/gitup.conf" ]; then
    cp "${PKG_PREFIX}/etc/gitup.conf.sample" "${PKG_PREFIX}/etc/gitup.conf" && \
        sed -i '' -E \
            -e "s,stable/[0-9]+,stable/${stable}," \
            -e "s,releng/[0-9]+.[0-9]+,releng/${releng}," \
            "${PKG_PREFIX}/etc/gitup.conf"
fi

so it creates and updates gitup.conf if it doesn't exists, instead of gitup.conf.sample.
Comment 3 Nuno Teixeira freebsd_committer freebsd_triage 2023-12-10 12:21:16 UTC
(In reply to Denis Shaposhnikov from comment #2)

Hello Denis,

I will try your sugestion since it seems not to be a POLA violation.

Next days I will update port to latest version and includes this approach.

Thanks
Comment 4 Nuno Teixeira freebsd_committer freebsd_triage 2023-12-18 10:15:19 UTC
(In reply to Nuno Teixeira from comment #3)
(...)

Your sugestion is similar to what @sample macro do.

We get 2 issues installing conf.sample:

1:
PLIST_FILES= etc/gitup.conf.sample

=>> Checking for extra files and directories
=>> Error: Files or directories left over:
%%ETCDIR%%.conf
build of net/gitup | gitup-0.99 ended at Mon Dec 18 10:05:42 WET 2023
build time: 00:00:04
!!! build failure encountered !!!
[00:00:12] Error: Build failed in phase: leftovers

2:
PLIST_FILES= "@sample etc/gitup.conf.sample"

pkg-post-install script do nothing, because @sample macro created a gitup.conf already.
Comment 5 takefu 2023-12-27 00:46:59 UTC
Created attachment 247274 [details]
gitup-0.98.14_1.patch

pkg-post-install -> post-patch :-)
Comment 6 Nuno Teixeira freebsd_committer freebsd_triage 2023-12-27 01:22:31 UTC
(In reply to takefu from comment #5)

That is what net/svnup do.
The problem is that OSREL is detected at build time.

Build servers are not the same version of the pkg being built, e.g., 13.2 packages are built on 13.1 OSREL servers.

The feature that we are looking for is to detect OSREL at install time of the pkg. At the moment pkg-post-install script do it right but it causes chksum mismatch (and it makes sense since we changing files after install)

I'm looking for different aproaches like a 'make conf' target like in dns/noip:

conf:
        (cd ${PREFIX}/etc && ${PREFIX}/bin/noip2 -C)
        ${CHOWN} noip:noip ${PREFIX}/etc/no-ip2.conf
        ${CHMOD} 0600 ${PREFIX}/etc/no-ip2.conf

but it only work manually and with ports tree.

Maybe net/gitup could do this feature by itself...
:)
Comment 7 takefu 2024-01-03 23:38:27 UTC
Created attachment 247437 [details]
gitup-0.98.14.patch2

(In reply to Nuno Teixeira from comment #6)

Until a countermeasure is taken upstream, it would be a good idea to write the countermeasure in pkg-messages. :-D
Comment 8 commit-hook freebsd_committer freebsd_triage 2024-01-20 15:54:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5445a794bdb24b84073c5c52d65313092153a31d

commit 5445a794bdb24b84073c5c52d65313092153a31d
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2024-01-20 15:49:27 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-01-20 15:53:04 +0000

    net/gitup: Update to 0.99

    While here:

    - drop pkg-post-install as it causing checksum mismatch on sample file.

    ChangeLog:
    https://github.com/johnmehr/gitup/compare/0.98-14-g5e26080...0.99

    PR:             274955
    MFH:            2024Q1

 net/gitup/Makefile                | 5 ++---
 net/gitup/distinfo                | 6 +++---
 net/gitup/files/pkg-message.in    | 2 +-
 net/gitup/pkg-post-install (gone) | 8 --------
 4 files changed, 6 insertions(+), 15 deletions(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2024-01-20 15:56:05 UTC
A commit in branch 2024Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=df1a57013a2b045dba0f7cac2592e788006762be

commit df1a57013a2b045dba0f7cac2592e788006762be
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2024-01-20 15:49:27 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-01-20 15:54:17 +0000

    net/gitup: Update to 0.99

    While here:

    - drop pkg-post-install as it causing checksum mismatch on sample file.

    ChangeLog:
    https://github.com/johnmehr/gitup/compare/0.98-14-g5e26080...0.99

    PR:             274955
    MFH:            2024Q1
    (cherry picked from commit 5445a794bdb24b84073c5c52d65313092153a31d)

 net/gitup/Makefile                | 5 ++---
 net/gitup/distinfo                | 6 +++---
 net/gitup/files/pkg-message.in    | 2 +-
 net/gitup/pkg-post-install (gone) | 8 --------
 4 files changed, 6 insertions(+), 15 deletions(-)
Comment 10 Nuno Teixeira freebsd_committer freebsd_triage 2024-01-20 16:19:30 UTC
- Drop pkg-post-install script

Committed, thanks!