From owner-svn-src-head@FreeBSD.ORG Wed May 30 21:11:53 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 372C4106566B; Wed, 30 May 2012 21:11:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 18D4F8FC19; Wed, 30 May 2012 21:11:53 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q4ULBqBo082129; Wed, 30 May 2012 21:11:52 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q4ULBqdu082079; Wed, 30 May 2012 21:11:52 GMT (envelope-from bapt@FreeBSD.org) X-Authentication-Warning: freefall.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f Date: Wed, 30 May 2012 23:11:48 +0200 From: Baptiste Daroussin To: Josh Paetzel Message-ID: <20120530211148.GA85232@ithaqua.etoilebsd.net> References: <201205302101.q4UL16uF076744@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline In-Reply-To: <201205302101.q4UL16uF076744@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r236333 - in head/usr.sbin/pkg_install: add lib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2012 21:11:53 -0000 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 30, 2012 at 09:01:06PM +0000, Josh Paetzel wrote: > Author: jpaetzel > Date: Wed May 30 21:01:06 2012 > New Revision: 236333 > URL: http://svn.freebsd.org/changeset/base/236333 >=20 > Log: > Let pkg_add use the ENV variable PACKAGESUFFIX. This > can be used to override the default .tbz package extension to > .txz .tgz or .tar > =20 > Submitted by: kmoore > Obtained from: PC-BSD > Sponsored by: iXsystems > MFC after: 3 days >=20 > Modified: > head/usr.sbin/pkg_install/add/main.c > head/usr.sbin/pkg_install/add/perform.c > head/usr.sbin/pkg_install/add/pkg_add.1 > head/usr.sbin/pkg_install/lib/file.c > head/usr.sbin/pkg_install/lib/url.c >=20 > Modified: head/usr.sbin/pkg_install/add/main.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/pkg_install/add/main.c Wed May 30 20:56:07 2012 (r23633= 2) > +++ head/usr.sbin/pkg_install/add/main.c Wed May 30 21:01:06 2012 (r23633= 3) > @@ -234,10 +234,17 @@ main(int argc, char **argv) > remotepkg =3D temppackageroot; > if (!((ptr =3D strrchr(remotepkg, '.')) && ptr[1] =3D=3D 't' && > (ptr[2] =3D=3D 'b' || ptr[2] =3D=3D 'g' || ptr[2] =3D=3D 'x') && > - ptr[3] =3D=3D 'z' && !ptr[4])) > - if (strlcat(remotepkg, ".tbz", > - sizeof(temppackageroot)) >=3D sizeof(temppackageroot)) > - errx(1, "package name too long"); > + ptr[3] =3D=3D 'z' && !ptr[4])) { > + if (getenv("PACKAGESUFFIX")) { > + if (strlcat(remotepkg, getenv("PACKAGESUFFIX"), > + sizeof(temppackageroot)) >=3D sizeof(temppackageroot)) > + errx(1, "package name too long"); > + } else { > + if (strlcat(remotepkg, ".tbz", > + sizeof(temppackageroot)) >=3D sizeof(temppackageroot)) > + errx(1, "package name too long"); > + } > + } > } > if (!strcmp(*argv, "-")) /* stdin? */ > pkgs[ch] =3D (char *)"-"; >=20 > Modified: head/usr.sbin/pkg_install/add/perform.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/pkg_install/add/perform.c Wed May 30 20:56:07 2012 (r23= 6332) > +++ head/usr.sbin/pkg_install/add/perform.c Wed May 30 21:01:06 2012 (r23= 6333) > @@ -307,8 +307,12 @@ pkg_do(char *pkg) > *sep =3D '\0'; > strlcat(subpkg, "/All/", sizeof subpkg); > strlcat(subpkg, p->name, sizeof subpkg); > - if ((ext =3D strrchr(pkg, '.')) =3D=3D NULL) > - ext =3D ".tbz"; > + if ((ext =3D strrchr(pkg, '.')) =3D=3D NULL) { > + if (getenv("PACKAGESUFFIX")) > + ext =3D getenv("PACKAGESUFFIX"); > + else > + ext =3D ".tbz"; > + } > strlcat(subpkg, ext, sizeof subpkg); > pkg_do(subpkg); > } > @@ -345,8 +349,13 @@ pkg_do(char *pkg) > const char *ext; > =20 > ext =3D strrchr(pkg_fullname, '.'); > - if (ext =3D=3D NULL) > - ext =3D ".tbz"; > + if (ext =3D=3D NULL) { > + if (getenv("PACKAGESUFFIX")) { > + ext =3D getenv("PACKAGESUFFIX"); > + } else { > + ext =3D ".tbz"; > + } > + } > snprintf(path, FILENAME_MAX, "%s/%s%s", getenv("_TOP"), p->name, e= xt); > if (fexists(path)) > cp =3D path; >=20 > Modified: head/usr.sbin/pkg_install/add/pkg_add.1 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/pkg_install/add/pkg_add.1 Wed May 30 20:56:07 2012 (r23= 6332) > +++ head/usr.sbin/pkg_install/add/pkg_add.1 Wed May 30 21:01:06 2012 (r23= 6333) > @@ -553,6 +553,11 @@ The environment variable > specifies an alternative location to save downloaded packages to when > .Fl K > option is used. > +.Pp > +The environment variable > +.Ev PACKAGESUFFIX > +specifies an alternative file extension to use when fetching remote > +packages. Default is .tbz > .Sh FILES > .Bl -tag -width /var/db/pkg -compact > .It Pa /var/tmp >=20 > Modified: head/usr.sbin/pkg_install/lib/file.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/pkg_install/lib/file.c Wed May 30 20:56:07 2012 (r23633= 2) > +++ head/usr.sbin/pkg_install/lib/file.c Wed May 30 21:01:06 2012 (r23633= 3) > @@ -140,7 +140,7 @@ fileFindByPath(const char *base, const c > { > static char tmp[FILENAME_MAX]; > char *cp; > - const char *suffixes[] =3D {".tbz", ".tgz", ".tar", NULL}; > + const char *suffixes[] =3D {".tbz", ".tgz", ".tar", ".txz", NULL}; > int i; > =20 > if (fexists(fname) && isfile(fname)) { >=20 > Modified: head/usr.sbin/pkg_install/lib/url.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/pkg_install/lib/url.c Wed May 30 20:56:07 2012 (r236332) > +++ head/usr.sbin/pkg_install/lib/url.c Wed May 30 21:01:06 2012 (r236333) > @@ -73,7 +73,10 @@ fileGetURL(const char *base, const char=20 > *(cp + 1) =3D '\0'; > strcat(cp, "All/"); > strcat(cp, spec); > - strcat(cp, ".tbz"); > + if (getenv("PACKAGESUFFIX")) > + strcat(cp, getenv("PACKAGESUFFIX")); > + else > + strcat(cp, ".tbz"); > } > else > return NULL; > @@ -85,7 +88,10 @@ fileGetURL(const char *base, const char=20 > */ > strcpy(fname, hint); > strcat(fname, spec); > - strcat(fname, ".tbz"); > + if (getenv("PACKAGESUFFIX")) > + strcat(fname, getenv("PACKAGESUFFIX")); > + else > + strcat(fname, ".tbz"); > } > } > else pkg_install is under maintainership of portmgr, while we appreciate to see people proposing new features and improving pkg_install, we could appreciate to be asked for reviews. regards, Bapt --AhhlLboLdkugWU4S Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/GjRQACgkQ8kTtMUmk6Ey9ewCggr5oXDM9xWWx/MCr7DC6WoPG AyoAoI42YcPEOfWeDnye8yC4/B1ZTrSe =xzvg -----END PGP SIGNATURE----- --AhhlLboLdkugWU4S--