Bug 182371 - ports-mgmt/pkg_replace: fixup pattrn matching in pkg_glob() function
Summary: ports-mgmt/pkg_replace: fixup pattrn matching in pkg_glob() function
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Alex Kozlov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-25 14:00 UTC by Iouri V. Ivliev
Modified: 2013-09-26 19:10 UTC (History)
1 user (show)

See Also:


Attachments
ports-mgmt__pkg_replace.diff (7.60 KB, patch)
2013-09-25 14:00 UTC, Iouri V. Ivliev
no flags Details | Diff
patch-pkg_replace.txt (2.62 KB, patch)
2013-09-26 01:07 UTC, Ken DEGUCHI
no flags Details | Diff
patch-pkg_replace.txt (13.13 KB, patch)
2013-09-26 01:28 UTC, Ken DEGUCHI
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Iouri V. Ivliev 2013-09-25 14:00:01 UTC
When an old pkg tools used, pkg_replace trying to find an installed
package looking the subdirectories containing the "+CONTENTS" file
in "${PKG_DBDIR}". Shell pattern used to match subdirectory
corresponding the package. However, some packages may not matches
the pattern. IMHO, more accurate results can be obtained using
pkg_info with the extended regular expression (-X key).
Patch in the "Fix:" section replaces shell pattern matching with
"pkg_info -EX <regex>" command. Also this patch fixes use of unset
variabel (preserved_files).

How-To-Repeat: $ pkg_info -Ex pkg_replace
pkg_replace-0.8.0_2
$ for p in python2 liblqr-1 xorg-fonts-75dpi; do echo pkg_replace:; pkg_replace -n $p; echo pkg_info:; pkg_info -EX "^$p-([a-z]?[0-9]+\.)?([a-z]?[0-9]*[a-z]?\.?)*([_,][0-9]+)*\$"; done
pkg_replace:
** No such installed package: python2
pkg_info:
python2-2
pkg_replace:
** No such installed package: liblqr-1
pkg_info:
liblqr-1-0.4.1_5
pkg_replace:
** No such installed package: xorg-fonts-75dpi
pkg_info:
xorg-fonts-75dpi-7.7
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-09-25 14:00:11 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2013-09-25 14:00:11 UTC
Maintainer of ports-mgmt/pkg_replace,

Please note that PR ports/182371 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/182371

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 Ken DEGUCHI 2013-09-26 01:07:33 UTC
Thanks for this patch. Then I made a patch as follows

- Fix pattern matching in pkg_glob function.
- Add support for staging.
- Download patch file from my web site.
Comment 4 Ken DEGUCHI 2013-09-26 01:28:58 UTC
Sorry, I forgot to delete a patch file in "files" directory.
Comment 5 Iouri V. Ivliev 2013-09-26 09:02:17 UTC
On Thu, Sep 26, 2013 at 09:28:58AM +0900, Ken DEGUCHI wrote:
> Sorry, I forgot to delete a patch file in "files" directory.
> diff -Nur pkg_replace.orig/Makefile pkg_replace/Makefile
Thank you, this works for me.
Comment 6 dfilter service freebsd_committer freebsd_triage 2013-09-26 19:00:27 UTC
Author: ak
Date: Thu Sep 26 18:00:18 2013
New Revision: 328399
URL: http://svnweb.freebsd.org/changeset/ports/328399

Log:
  - Support STAGEDIR [1]
  - Move pkgng patch outside of ports tree [1]
  - Fix pattern matching in pkg_glob function [2]
  - Minor Makefile cleanup
  
  PR:	ports/182388 [1]
  PR:	ports/182371 (based on) [2]
  Submitted by:	Ken DEGUCHI <kdeguchi@sz.tokoha-u.ac.jp> (maintainer) [1], Iouri Ivliev <ii@any.com.ru> [2]

Deleted:
  head/ports-mgmt/pkg_replace/files/
Modified:
  head/ports-mgmt/pkg_replace/Makefile
  head/ports-mgmt/pkg_replace/distinfo   (contents, props changed)
  head/ports-mgmt/pkg_replace/pkg-plist

Modified: head/ports-mgmt/pkg_replace/Makefile
==============================================================================
--- head/ports-mgmt/pkg_replace/Makefile	Thu Sep 26 17:30:13 2013	(r328398)
+++ head/ports-mgmt/pkg_replace/Makefile	Thu Sep 26 18:00:18 2013	(r328399)
@@ -3,45 +3,36 @@
 
 PORTNAME=	pkg_replace
 PORTVERSION=	0.8.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE_JP}
-MASTER_SITE_SUBDIR=portutil/22116
+MASTER_SITE_SUBDIR=	portutil/22116
+
+PATCH_SITES=	http://member.tokoha-u.ac.jp/~kdeguchi/download/
+PATCHFILES=	${PKGNAME}.patch
 
 MAINTAINER=	kdeguchi@sz.tokoha-u.ac.jp
 COMMENT=	Utility for upgrading installed packages
 
-USE_BZIP2=	YES
+USE_BZIP2=	yes
 MAKE_ARGS=	PREFIX="${PREFIX}" \
 		PORTSDIR="${PORTSDIR}" PKG_DBDIR="${PKG_DBDIR}"
 
-MAN1=		pkg_replace.1
-MANCOMPRESSED=	maybe
-
-OPTIONS_DEFINE=		ZSH
+OPTIONS_DEFINE=	ZSH
 
 .if empty(WITH_PKGNG)
 OPTIONS_DEFINE+=	PKGDB_FIX
-PKGDB_FIX_DESC=		Fixing tool of installed package dependencies
+PKGDB_FIX_DESC=	Fixing tool of installed package dependencies
 .else
 PLIST_SUB+=	PKGDB_FIX="@comment "
 .endif
 
 OPTIONS_SUB=	yes
 
-NO_STAGE=	yes
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MPKGDB_FIX}
-MAN1+=	pkgdb_fix.1
-.endif
-
 post-patch:
-.if ${PORT_OPTIONS:MPKGDB_FIX}
 	@${REINPLACE_CMD} -e 's/pkg_replace/pkg_replace pkgdb_fix/;' ${WRKSRC}/sbin/Makefile
-.endif
-.if !${PORT_OPTIONS:MZSH}
-	@${REINPLACE_CMD} -e  's/^	sbin \\$$/	sbin/;s/^	share$$//;' ${WRKSRC}/Makefile
-.endif
+
+pre-install:
+	@${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
 
 .include <bsd.port.mk>

Modified: head/ports-mgmt/pkg_replace/distinfo
==============================================================================
--- head/ports-mgmt/pkg_replace/distinfo	Thu Sep 26 17:30:13 2013	(r328398)
+++ head/ports-mgmt/pkg_replace/distinfo	Thu Sep 26 18:00:18 2013	(r328399)
@@ -1,2 +1,4 @@
 SHA256 (pkg_replace-0.8.0.tar.bz2) = 3092f5fc0d18529eb5d38776941c0ee4d0073ecb524ab17671c81ca69c29e214
 SIZE (pkg_replace-0.8.0.tar.bz2) = 17296
+SHA256 (pkg_replace-0.8.0_3.patch) = cfa2adb3643a8684281143e4c241b8597510251730657816d68926701615ae98
+SIZE (pkg_replace-0.8.0_3.patch) = 11125

Modified: head/ports-mgmt/pkg_replace/pkg-plist
==============================================================================
--- head/ports-mgmt/pkg_replace/pkg-plist	Thu Sep 26 17:30:13 2013	(r328398)
+++ head/ports-mgmt/pkg_replace/pkg-plist	Thu Sep 26 18:00:18 2013	(r328399)
@@ -1,6 +1,8 @@
+etc/pkg_replace.conf.sample
+man/man1/pkg_replace.1.gz
 sbin/pkg_replace
+%%PKGDB_FIX%%man/man1/pkgdb_fix.1.gz
 %%PKGDB_FIX%%sbin/pkgdb_fix
-etc/pkg_replace.conf.sample
 %%ZSH%%share/zsh/site-functions/_pkg_replace
-%%ZSH%%@unexec [ -f %D/bin/zsh ] || rmdir %D/share/zsh/site-functions 2>/dev/null || true
+%%ZSH%%@dirrmtry share/zsh/site-functions
 %%ZSH%%@dirrmtry share/zsh
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 7 Alex Kozlov freebsd_committer freebsd_triage 2013-09-26 19:01:59 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ak

I'll take it.
Comment 8 Alex Kozlov freebsd_committer freebsd_triage 2013-09-26 19:02:35 UTC
State Changed
From-To: feedback->closed

Superseded by ports/182388.