From allan at archlinux.org Thu Mar 1 01:07:42 2012 From: allan at archlinux.org (Allan McRae) Date: Thu, 01 Mar 2012 16:07:42 +1000 Subject: [pacman-dev] [PATCH] checkupdates: add new contrib script In-Reply-To: References: Message-ID: <4F4F122E.8050000@archlinux.org> On 24/02/12 15:39, keenerd wrote: > checkupdates provides a way of checking for new updates without > touching the local sync database. Based heavily on a script > by Dave Reisner. Ack. Although note there was a line wrap done in the middle of this patch. Did you send using git-send-email? Allan From zmanji at gmail.com Thu Mar 1 02:10:26 2012 From: zmanji at gmail.com (Zameer Manji) Date: Thu, 1 Mar 2012 02:10:26 -0500 Subject: [pacman-dev] Arguments for alpm_initialize Message-ID: Hello, This is my first time posting on this list, so my apologies if this is the incorrect place to ask for help. I've been trying to create a wrapper around libalpm for my own uses and I'm trying to get the project off the ground with a simple program: #include #include int main(void) { enum _alpm_errno_t errno = 0; alpm_handle_t* t = alpm_initialize("/", "/var/lib/pacman", &errno); if(t == NULL) { printf("Got APLM handle"); } else { printf("No Handle"); if(errno == 0) { printf("No Error Code Given"); } } alpm_release(t); return 0; } Currently the program outputs "No Handle" and "No Error Code Given". What can I do inorder to either get the handle correctly or get an error code so I can investigate further? -- - Zameer Manji From allan at archlinux.org Thu Mar 1 02:14:26 2012 From: allan at archlinux.org (Allan McRae) Date: Thu, 01 Mar 2012 17:14:26 +1000 Subject: [pacman-dev] Arguments for alpm_initialize In-Reply-To: References: Message-ID: <4F4F21D2.7060200@archlinux.org> On 01/03/12 17:10, Zameer Manji wrote: > Hello, > > This is my first time posting on this list, so my apologies if this is > the incorrect place to ask for help. I've been trying to create a > wrapper around libalpm for my own uses and I'm trying to get the > project off the ground with a simple program: > > #include > #include > > int main(void) > { > enum _alpm_errno_t errno = 0; > > alpm_handle_t* t = alpm_initialize("/", "/var/lib/pacman", &errno); > > if(t == NULL) alpm_initialize returns NULL on error, not on success. > { > printf("Got APLM handle"); > } > else > { > printf("No Handle"); > > if(errno == 0) > { > printf("No Error Code Given"); > } > } > > alpm_release(t); > return 0; > } > > Currently the program outputs "No Handle" and "No Error Code Given". > What can I do inorder to either get the handle correctly or get an > error code so I can investigate further? > > -- > - Zameer Manji > > > From pierre at archlinux.de Sat Mar 3 10:25:08 2012 From: pierre at archlinux.de (Pierre Schmitz) Date: Sat, 03 Mar 2012 16:25:08 +0100 Subject: [pacman-dev] =?utf-8?q?Why_need_keyrings_to_be_signed=3F?= Message-ID: <67f06ae09675da3dbb2c7589c6369adb@archlinux.de> Hi all, while working on our keyring package again I am still stuck at this question. pacman-key --populate checks if the files to import are signed. The man page tell us: This prevents a potentially malicious repository adding keys to the pacman keyring without the users knowledge. But I don't get the reasoning here at all. If I install a malicious package, it's install function is run as root and can do anything; including bypassing the --populate function and call gpg directly. If I miss anything here please let me know as I couldn't find out. Removing this check would safe me from reinventing the wheel and I don't have to create a script which does exactly what --populate does but without the check. This check prevents us from a simple bootstrap; and we gain no improved security if we let the user do it manually. (think about what a malicious package would do) In details this means removing the call to verify_keyring_input in pacman-key and then remove the now unused functions verify_keyring_input and validate_with_gpg. Greetings, Pierre -- Pierre Schmitz, http://pierre-schmitz.com From allan at archlinux.org Sun Mar 4 00:06:39 2012 From: allan at archlinux.org (Allan McRae) Date: Sun, 04 Mar 2012 15:06:39 +1000 Subject: [pacman-dev] Why need keyrings to be signed? In-Reply-To: <67f06ae09675da3dbb2c7589c6369adb@archlinux.de> References: <67f06ae09675da3dbb2c7589c6369adb@archlinux.de> Message-ID: <4F52F85F.3090500@archlinux.org> On 04/03/12 01:25, Pierre Schmitz wrote: > Hi all, > > while working on our keyring package again I am still stuck at this > question. pacman-key --populate checks if the files to import are > signed. The man page tell us: > > This prevents a potentially malicious repository > adding keys to the pacman keyring without the users knowledge. > > But I don't get the reasoning here at all. If I install a malicious > package, it's install function is run as root and can do anything; > including bypassing the --populate function and call gpg directly. If I > miss anything here please let me know as I couldn't find out. > > Removing this check would safe me from reinventing the wheel and I > don't have to create a script which does exactly what --populate does > but without the check. This check prevents us from a simple bootstrap; > and we gain no improved security if we let the user do it manually. > (think about what a malicious package would do) > > In details this means removing the call to verify_keyring_input in > pacman-key and then remove the now unused functions verify_keyring_input > and validate_with_gpg. I can not think of a situation where you could edit the keyring files but not access the pacman keyring directly... Unless someone else can think of a good reason to keep this, I would agree to removing that requirement. Allan From pierre at archlinux.de Sun Mar 4 07:25:56 2012 From: pierre at archlinux.de (Pierre Schmitz) Date: Sun, 4 Mar 2012 13:25:56 +0100 Subject: [pacman-dev] [PATCH] pacman-key: Remove useless signature verification in --populate command In-Reply-To: <4F52F85F.3090500@archlinux.org> References: <4F52F85F.3090500@archlinux.org> Message-ID: <1330863956-8131-1-git-send-email-pierre@archlinux.de> Verifing the keyring at this point is useless as a malicious package is already installed and as such has several options to bypass this check anyway. Signed-off-by: Pierre Schmitz --- doc/pacman-key.8.txt | 5 ----- scripts/pacman-key.sh.in | 39 --------------------------------------- 2 files changed, 44 deletions(-) diff --git a/doc/pacman-key.8.txt b/doc/pacman-key.8.txt index 1582a3c..3631ec8 100644 --- a/doc/pacman-key.8.txt +++ b/doc/pacman-key.8.txt @@ -129,11 +129,6 @@ any signing", so should be used with prudence. A key being marked as revoked will be disabled in the keyring and no longer treated as valid, so this always takes priority over it's trusted state in any other keyring. -All files are required to be signed (detached) by a trusted PGP key that the -user must manually import to the pacman keyring. This prevents a potentially -malicious repository adding keys to the pacman keyring without the users -knowledge. - See Also -------- diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index c393370..482b56d 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -214,43 +214,6 @@ check_keyring() { fi } -validate_with_gpg() { - msg2 "$(gettext "Verifying %s...")" "$1" - if [[ ! -f "$1.sig" ]]; then - error "$(gettext "File %s is unsigned, cannot continue.")" "$1" - return 1 - elif ! "${GPG_PACMAN[@]}" --verify "$1.sig"; then - error "$(gettext "The signature of file %s is not valid.")" "$1" - return 1 - fi - return 0 -} - -verify_keyring_input() { - local ret=0; - local KEYRING_IMPORT_DIR='@pkgdatadir@/keyrings' - - # Verify signatures of keyring files and trusted/revoked files if they exist - msg "$(gettext "Verifying keyring file signatures...")" - local keyring keyfile - for keyring in "${KEYRINGIDS[@]}"; do - keyfile="${KEYRING_IMPORT_DIR}/${keyring}.gpg" - validate_with_gpg "${keyfile}" || ret=1 - - keyfile="${KEYRING_IMPORT_DIR}/${keyring}-trusted" - if [[ -f "${keyfile}" ]]; then - validate_with_gpg "${keyfile}" || ret=1 - fi - - keyfile="${KEYRING_IMPORT_DIR}/${keyring}-revoked" - if [[ -f "${keyfile}" ]]; then - validate_with_gpg "${keyfile}" || ret=1 - fi - done - - return $ret -} - populate_keyring() { local KEYRING_IMPORT_DIR='@pkgdatadir@/keyrings' @@ -281,8 +244,6 @@ populate_keyring() { exit 1 fi - verify_keyring_input || exit 1 - # Variable used for iterating on keyrings local keys key_id -- 1.7.9.2 From bluewind at xinu.at Sun Mar 4 15:19:43 2012 From: bluewind at xinu.at (Florian Pritz) Date: Sun, 4 Mar 2012 21:19:43 +0100 Subject: [pacman-dev] [PATCH 1/2] makepkg: fix extraction of soname in find_libdepends Message-ID: <1330892384-27104-1-git-send-email-bluewind@xinu.at> libperl.so results in soname="libperl.so.so" which is wrong. This returns the correct string: "libperl.so" Fix-by: Dave Reisner Signed-off-by: Florian Pritz --- This should be applied to both master and maint. scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 6e7a556..9301730 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1071,7 +1071,7 @@ find_libdepends() { for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') do # extract the library name: libfoo.so - soname="${sofile%%\.so\.*}.so" + soname="${sofile%.so?(+(.+([0-9])))}".so # extract the major version: 1 soversion="${sofile##*\.so\.}" if in_array "${soname}" ${depends[@]}; then -- 1.7.9.2 From bluewind at xinu.at Sun Mar 4 15:19:44 2012 From: bluewind at xinu.at (Florian Pritz) Date: Sun, 4 Mar 2012 21:19:44 +0100 Subject: [pacman-dev] [PATCH 2/2] makepkg: fix false error with multiple libdeps In-Reply-To: <1330892384-27104-1-git-send-email-bluewind@xinu.at> References: <1330892384-27104-1-git-send-email-bluewind@xinu.at> Message-ID: <1330892384-27104-2-git-send-email-bluewind@xinu.at> With multiple items in $libdepends this check only worked for the first one, everything after this returned an error. This was probably an issue with \s being treated wrong. Fix-by: Dave Reisner Signed-off-by: Florian Pritz --- This should be applied to both master and maint. scripts/makepkg.sh.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9301730..0ca7513 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1189,7 +1189,8 @@ write_pkginfo() { if [[ $it = *.so ]]; then # check if the entry has been found by find_libdepends # if not, it's unneeded; tell the user so he can remove it - if [[ ! $libdepends =~ (^|\s)${it}=.* ]]; then + printf -v re '(^|\s)%s=.*' "$it" + if [[ ! $libdepends =~ $re ]]; then error "$(gettext "Cannot find library listed in %s: %s")" "'depends'" "$it" return 1 fi -- 1.7.9.2 From brendan at swiftspirit.co.za Sun Mar 4 17:43:50 2012 From: brendan at swiftspirit.co.za (Brendan Hide) Date: Mon, 05 Mar 2012 00:43:50 +0200 Subject: [pacman-dev] Mirroring with Deltas - Established Procedure Message-ID: <4F53F026.7010802@swiftspirit.co.za> Hi all Is there an established procedure to add deltas to an existing rsync-maintained mirror server? The tools that come with pacman (pkgdelta and repo-add) appear to be aimed at maintaining your own repository rather than with mirroring an existing repository. -- __________ Brendan Hide Mobile: +27 83 448 3867 Web Africa - Internet Business Solutions http://www.webafrica.co.za/?AFF1E97 From allan at archlinux.org Sun Mar 4 19:40:22 2012 From: allan at archlinux.org (Allan McRae) Date: Mon, 05 Mar 2012 10:40:22 +1000 Subject: [pacman-dev] Mirroring with Deltas - Established Procedure In-Reply-To: <4F53F026.7010802@swiftspirit.co.za> References: <4F53F026.7010802@swiftspirit.co.za> Message-ID: <4F540B76.2040900@archlinux.org> On 05/03/12 08:43, Brendan Hide wrote: > Hi all > > Is there an established procedure to add deltas to an existing > rsync-maintained mirror server? The tools that come with pacman > (pkgdelta and repo-add) appear to be aimed at maintaining your own > repository rather than with mirroring an existing repository. > There is no established procedure for this. Allan From dan at archlinux.org Mon Mar 5 12:49:21 2012 From: dan at archlinux.org (Dan McGee) Date: Mon, 5 Mar 2012 12:49:21 -0500 (EST) Subject: [pacman-dev] [GIT] The official pacman repository branch, maint, updated. v4.0.2-18-g4ffa040 Message-ID: <20120305174921.BC85D900B4@gerolde.archlinux.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The official pacman repository". The branch, maint has been updated via 4ffa0401d22347332d663f1d400e182d5a181ea2 (commit) via cb64fbeac41308ee8c46384a126195a1fd75a361 (commit) via ea7fc8962a819a04237876995140363a818202d4 (commit) via fbfcd8665086f71b65370e919105194111b4b5f1 (commit) via 986e99a613605985f64f0e3e4c2635717931f77d (commit) via 4b384b7f0b0e840e09e3bffd2dbb59b88bdd4864 (commit) via d1151b5ab9c407732ded462a0fe0259dea8dcc2a (commit) from 78adb71f20ee335dff49e34d33f04817a40002b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4ffa0401d22347332d663f1d400e182d5a181ea2 Author: Dan McGee Date: Thu Feb 23 10:35:38 2012 -0600 Translation updates from Transifex * it updates to all translations * minor fr, pt_BR, de, lt, sk and uk updates * add new strings in pacman translation catalog Signed-off-by: Dan McGee commit cb64fbeac41308ee8c46384a126195a1fd75a361 Author: Allan McRae Date: Fri Feb 24 21:40:20 2012 +1000 Do not dereference symlinks when calculating size Passing the "-L" flag to stat means we get the size of the file being pointed to for symlinks instead of the size of the symlink. Keep "-L" usage in repo-add as we want the actual size of the package/delta/signature there. Signed-off-by: Allan McRae commit ea7fc8962a819a04237876995140363a818202d4 Author: Florian Pritz Date: Sun Mar 4 19:23:25 2012 +0100 makepkg: fix false error with multiple libdeps With multiple items in $libdepends this check only worked for the first one, everything after this returned an error. This was probably an issue with \s being treated wrong. Fix-by: Dave Reisner Signed-off-by: Florian Pritz commit fbfcd8665086f71b65370e919105194111b4b5f1 Author: Florian Pritz Date: Sun Mar 4 19:17:21 2012 +0100 makepkg: fix extraction of soname in find_libdepends libperl.so results in soname="libperl.so.so" which is wrong. This returns the correct string: "libperl.so" Fix-by: Dave Reisner Signed-off-by: Florian Pritz commit 986e99a613605985f64f0e3e4c2635717931f77d Author: Dan McGee Date: Wed Feb 29 16:47:39 2012 -0600 Fix a potential memory leak in filelist creation If we begin to create a file list when loading a package, but abort because of an error to one of our goto labels, the memory used to create the file list will leak. This is because we use a set of local variables to hold the data, and thus _alpm_pkg_free() cannot clean up for us. Use the file list struct on the package object as much as possible to keep state when building the file list, thus allowing _alpm_pkg_free() to clean up any partially built data. Signed-off-by: Dan McGee commit 4b384b7f0b0e840e09e3bffd2dbb59b88bdd4864 Author: Dan McGee Date: Wed Feb 29 16:33:21 2012 -0600 Fix a memory leak when loading an invalid package This is easily triggered via a `pacman -Sc` operation when it attempts to open a delta file as a package- we end up leaking loads of memory due to us never freeing the archive object. When you have upwards of 1200 delta files in your sync database directory, this results in a memory leak of nearly 1.5 MiB. Also fix another memory leak noticed at the same time- we need to call the internal _alpm_pkg_free() function, as without the origin data being set the public free function will do nothing. Signed-off-by: Dan McGee commit d1151b5ab9c407732ded462a0fe0259dea8dcc2a Author: Dan McGee Date: Wed Feb 29 15:51:54 2012 -0600 Database cleanup enhancements Ensure we give database signatures special treatment like we already did for package signatures. Attempt to parse the database name out of them before taking the proper steps to handle their existence. This fixes FS#28714. We also add an unlink_verbose() helper method that displays any errors that occur when unlinking, optionally opting to skip any ENOENT errors from being fatal. Finally, the one prompt per unknown database has been removed, this has no real sound purpose and we don't do this for packages. Simply kill databases we don't know about; other programs shouldn't have random data in this directory anyway. Signed-off-by: Dan McGee ----------------------------------------------------------------------- Summary of changes: configure.ac | 6 +- lib/libalpm/be_package.c | 38 ++++++---- lib/libalpm/po/it.po | 76 ++++++++++--------- scripts/makepkg.sh.in | 5 +- scripts/po/it.po | 185 +++++++++++++++++++++------------------------- scripts/po/sk.po | 10 +- scripts/po/uk.po | 23 +++--- scripts/repo-add.sh.in | 6 +- src/pacman/po/de.po | 42 ++++++----- src/pacman/po/en_GB.po | 41 ++++++---- src/pacman/po/fi.po | 18 ++--- src/pacman/po/fr.po | 45 ++++++------ src/pacman/po/it.po | 127 +++++++++++++++++-------------- src/pacman/po/lt.po | 171 ++++++++++++++++++++++--------------------- src/pacman/po/pacman.pot | 22 ++--- src/pacman/po/pt_BR.po | 62 ++++++++-------- src/pacman/po/uk.po | 41 +++++----- src/pacman/sync.c | 71 +++++++++++------- 18 files changed, 514 insertions(+), 475 deletions(-) hooks/post-receive -- The official pacman repository From brendan at swiftspirit.co.za Tue Mar 6 02:12:47 2012 From: brendan at swiftspirit.co.za (Brendan Hide) Date: Tue, 06 Mar 2012 09:12:47 +0200 Subject: [pacman-dev] Mirroring with Deltas - Established Procedure In-Reply-To: <4F540B76.2040900@archlinux.org> References: <4F53F026.7010802@swiftspirit.co.za> <4F540B76.2040900@archlinux.org> Message-ID: <4F55B8EF.2030301@swiftspirit.co.za> On 03/05/12 02:40, Allan McRae wrote: > On 05/03/12 08:43, Brendan Hide wrote: >> Hi all >> >> Is there an established procedure to add deltas to an existing >> rsync-maintained mirror server? The tools that come with pacman >> (pkgdelta and repo-add) appear to be aimed at maintaining your own >> repository rather than with mirroring an existing repository. >> > There is no established procedure for this. > > Allan > Thanks, Allan I've added a starter page on the wiki which I'll be fleshing out in the next few weeks. Comments/suggestions/changes welcome: https://wiki.archlinux.org/index.php/User:Zatricky/DeltaMirrorFromNonDelta -- __________ Brendan Hide Mobile: +27 83 448 3867 Web Africa - Internet Business Solutions http://www.webafrica.co.za/?AFF1E97 From dan at archlinux.org Thu Mar 8 18:14:21 2012 From: dan at archlinux.org (Dan McGee) Date: Thu, 8 Mar 2012 17:14:21 -0600 Subject: [pacman-dev] [PATCH 1/2] Allow alpm_depend_t to have a description Message-ID: <1331248462-20808-1-git-send-email-dan@archlinux.org> This is the first step in parsing and handling optdepends. There is no behavior change introduced in this commit; however, depends that contain a ": " string will now be parsed as having a description and it will be stored in the depend structure. Later patches will utilize this new field as appropriate. This is heavily based on the work of Benedikt, who did something similar but introduced a new type for this rather than only a new field to the existing type. Heavily-influenced-by: Benedikt Morbach Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 1 + lib/libalpm/deps.c | 44 +++++++++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 5f587d3..8a418dc 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -136,6 +136,7 @@ typedef struct __alpm_trans_t alpm_trans_t; typedef struct _alpm_depend_t { char *name; char *version; + char *desc; unsigned long name_hash; alpm_depmod_t mod; } alpm_depend_t; diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index eda0648..6069f5e 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -39,6 +39,7 @@ void _alpm_dep_free(alpm_depend_t *dep) { FREE(dep->name); FREE(dep->version); + FREE(dep->desc); FREE(dep); } @@ -409,7 +410,7 @@ int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep) alpm_depend_t *_alpm_splitdep(const char *depstring) { alpm_depend_t *depend; - const char *ptr, *version; + const char *ptr, *version, *desc; size_t deplen; if(depstring == NULL) { @@ -417,7 +418,17 @@ alpm_depend_t *_alpm_splitdep(const char *depstring) } MALLOC(depend, sizeof(alpm_depend_t), return NULL); - deplen = strlen(depstring); + + /* Note the extra space in ": " to avoid matching the epoch */ + if((desc = strstr(depstring, ": ")) != NULL) { + STRDUP(depend->desc, desc + 2, return NULL); + deplen = desc - depstring; + } else { + /* no description- point desc at NULL at end of string for later use */ + depend->desc = NULL; + deplen = strlen(depstring); + desc = depstring + deplen; + } /* Find a version comparator if one exists. If it does, set the type and * increment the ptr accordingly so we can copy the right strings. */ @@ -442,21 +453,18 @@ alpm_depend_t *_alpm_splitdep(const char *depstring) depend->mod = ALPM_DEP_MOD_EQ; version = ptr + 1; } else { - /* no version specified, leave ptr NULL and set version to NULL */ + /* no version specified, set ptr to end of string and version to NULL */ + ptr = depstring + deplen; depend->mod = ALPM_DEP_MOD_ANY; depend->version = NULL; version = NULL; } /* copy the right parts to the right places */ - if(ptr) { - STRNDUP(depend->name, depstring, ptr - depstring, return NULL); - } else { - STRDUP(depend->name, depstring, return NULL); - } + STRNDUP(depend->name, depstring, ptr - depstring, return NULL); depend->name_hash = _alpm_hash_sdbm(depend->name); if(version) { - STRDUP(depend->version, version, return NULL); + STRNDUP(depend->version, version, desc - version, return NULL); } return depend; @@ -468,8 +476,9 @@ alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep) CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL); STRDUP(newdep->name, dep->name, return NULL); - newdep->name_hash = dep->name_hash; STRDUP(newdep->version, dep->version, return NULL); + STRDUP(newdep->desc, dep->desc, return NULL); + newdep->name_hash = dep->name_hash; newdep->mod = dep->mod; return newdep; @@ -792,7 +801,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, */ char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep) { - const char *name, *opr, *ver; + const char *name, *opr, *ver, *desc_delim, *desc; char *str; size_t len; @@ -834,12 +843,21 @@ char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep) ver = ""; } + if(dep->desc) { + desc_delim = ": "; + desc = dep->desc; + } else { + desc_delim = ""; + desc = ""; + } + /* we can always compute len and print the string like this because opr * and ver will be empty when ALPM_DEP_MOD_ANY is the depend type. the * reassignments above also ensure we do not do a strlen(NULL). */ - len = strlen(name) + strlen(opr) + strlen(ver) + 1; + len = strlen(name) + strlen(opr) + strlen(ver) + + strlen(desc_delim) + strlen(desc) + 1; MALLOC(str, len, return NULL); - snprintf(str, len, "%s%s%s", name, opr, ver); + snprintf(str, len, "%s%s%s%s%s", name, opr, ver, desc_delim, desc); return str; } -- 1.7.9.3 From dan at archlinux.org Thu Mar 8 18:14:22 2012 From: dan at archlinux.org (Dan McGee) Date: Thu, 8 Mar 2012 17:14:22 -0600 Subject: [pacman-dev] [PATCH 2/2] Hook new optdepend structures up In-Reply-To: <1331248462-20808-1-git-send-email-dan@archlinux.org> References: <1331248462-20808-1-git-send-email-dan@archlinux.org> Message-ID: <1331248462-20808-2-git-send-email-dan@archlinux.org> From: Benedikt Morbach No new behaviour introduced, everything should work exactly as before. Dan: refactored to use the single alpm_depend_t structure. Signed-off-by: Benedikt Morbach Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 2 +- lib/libalpm/be_local.c | 6 ++-- lib/libalpm/be_package.c | 5 +-- lib/libalpm/be_sync.c | 2 +- lib/libalpm/package.c | 4 +-- src/pacman/package.c | 18 +++++++++-- src/pacman/util.c | 79 +++++++++++++++++++++++++++++++++++++++------- 7 files changed, 94 insertions(+), 22 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 8a418dc..a6b7c78 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -820,7 +820,7 @@ alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg); /** Returns the list of package optional dependencies. * @param pkg a pointer to package - * @return a reference to an internal list of strings. + * @return a reference to an internal list of alpm_depend_t structures. */ alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg); diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 20b7895..0d423fa 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -611,7 +611,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) } else if(strcmp(line, "%DEPENDS%") == 0) { READ_AND_SPLITDEP(info->depends); } else if(strcmp(line, "%OPTDEPENDS%") == 0) { - READ_AND_STORE_ALL(info->optdepends); + READ_AND_SPLITDEP(info->optdepends); } else if(strcmp(line, "%CONFLICTS%") == 0) { READ_AND_SPLITDEP(info->conflicts); } else if(strcmp(line, "%PROVIDES%") == 0) { @@ -829,7 +829,9 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq if(info->optdepends) { fputs("%OPTDEPENDS%\n", fp); for(lp = info->optdepends; lp; lp = lp->next) { - fprintf(fp, "%s\n", (char *)lp->data); + char *optstring = alpm_dep_compute_string(lp->data); + fprintf(fp, "%s\n", optstring); + free(optstring); } fprintf(fp, "\n"); } diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 4008195..c076f61 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -36,7 +36,7 @@ #include "log.h" #include "handle.h" #include "package.h" -#include "deps.h" /* _alpm_splitdep */ +#include "deps.h" struct package_changelog { struct archive *archive; @@ -214,7 +214,8 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t * alpm_depend_t *dep = _alpm_splitdep(ptr); newpkg->depends = alpm_list_add(newpkg->depends, dep); } else if(strcmp(key, "optdepend") == 0) { - newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr)); + alpm_depend_t *optdep = _alpm_splitdep(ptr); + newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep); } else if(strcmp(key, "conflict") == 0) { alpm_depend_t *conflict = _alpm_splitdep(ptr); newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict); diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index b7b2acd..c403203 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -566,7 +566,7 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, } else if(strcmp(line, "%DEPENDS%") == 0) { READ_AND_SPLITDEP(pkg->depends); } else if(strcmp(line, "%OPTDEPENDS%") == 0) { - READ_AND_STORE_ALL(pkg->optdepends); + READ_AND_SPLITDEP(pkg->optdepends); } else if(strcmp(line, "%CONFLICTS%") == 0) { READ_AND_SPLITDEP(pkg->conflicts); } else if(strcmp(line, "%PROVIDES%") == 0) { diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index f66c307..5b07563 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -522,7 +522,7 @@ int _alpm_pkg_dup(alpm_pkg_t *pkg, alpm_pkg_t **new_ptr) newpkg->backup = alpm_list_add(newpkg->backup, _alpm_backup_dup(i->data)); } newpkg->depends = list_depdup(pkg->depends); - newpkg->optdepends = alpm_list_strdup(pkg->optdepends); + newpkg->optdepends = list_depdup(pkg->optdepends); newpkg->conflicts = list_depdup(pkg->conflicts); newpkg->provides = list_depdup(pkg->provides); for(i = pkg->deltas; i; i = i->next) { @@ -597,7 +597,7 @@ void _alpm_pkg_free(alpm_pkg_t *pkg) alpm_list_free_inner(pkg->backup, (alpm_list_fn_free)_alpm_backup_free); alpm_list_free(pkg->backup); free_deplist(pkg->depends); - FREELIST(pkg->optdepends); + free_deplist(pkg->optdepends); free_deplist(pkg->conflicts); free_deplist(pkg->provides); alpm_list_free_inner(pkg->deltas, (alpm_list_fn_free)_alpm_delta_free); diff --git a/src/pacman/package.c b/src/pacman/package.c index bef91e2..54c035c 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -38,7 +38,6 @@ /** Turn a depends list into a text list. * @param deps a list with items of type alpm_depend_t - * @return a string list, must be freed */ static void deplist_display(const char *title, alpm_list_t *deps) @@ -52,6 +51,21 @@ static void deplist_display(const char *title, FREELIST(text); } +/** Turn a optdepends list into a text list. + * @param optdeps a list with items of type alpm_optdepend_t + */ +static void optdeplist_display(const char *title, + alpm_list_t *optdeps) +{ + alpm_list_t *i, *text = NULL; + for(i = optdeps; i; i = alpm_list_next(i)) { + alpm_depend_t *optdep = i->data; + text = alpm_list_add(text, alpm_dep_compute_string(optdep)); + } + list_display_linebreak(title, text); + FREELIST(text); +} + /** * Display the details of a package. * Extra information entails 'required by' info for sync packages and backup @@ -111,7 +125,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra) list_display(_("Groups :"), alpm_pkg_get_groups(pkg)); deplist_display(_("Provides :"), alpm_pkg_get_provides(pkg)); deplist_display(_("Depends On :"), alpm_pkg_get_depends(pkg)); - list_display_linebreak(_("Optional Deps :"), alpm_pkg_get_optdepends(pkg)); + optdeplist_display(_("Optional Deps :"), alpm_pkg_get_optdepends(pkg)); if(extra || from == PKG_FROM_LOCALDB) { list_display(_("Required By :"), requiredby); } diff --git a/src/pacman/util.c b/src/pacman/util.c index 1d9049e..7be3dc5 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1151,32 +1151,87 @@ void print_packages(const alpm_list_t *packages) } } -/* Helper function for comparing strings using the - * alpm "compare func" signature */ -int str_cmp(const void *s1, const void *s2) +/** + * Helper function for comparing depends using the alpm "compare func" + * signature. The function descends through the structure in the following + * comparison order: name, modifier (e.g., '>', '='), version, description. + * @param d1 the first depend structure + * @param d2 the second depend structure + * @return -1, 0, or 1 if first is <, ==, or > second + */ +static int depend_cmp(const void *d1, const void *d2) { - return strcmp(s1, s2); + const alpm_depend_t *dep1 = d1; + const alpm_depend_t *dep2 = d2; + int ret; + + ret = strcmp(dep1->name, dep2->name); + if(ret == 0) { + ret = dep1->mod - dep2->mod; + } + if(ret == 0) { + if(dep1->version && dep2->version) { + ret = strcmp(dep1->version, dep2->version); + } else if(!dep1->version && dep2->version) { + ret = -1; + } else if(dep1->version && !dep2->version) { + ret = 1; + } + } + if(ret == 0) { + if(dep1->desc && dep2->desc) { + ret = strcmp(dep1->desc, dep2->desc); + } else if(!dep1->desc && dep2->desc) { + ret = -1; + } else if(dep1->desc && !dep2->desc) { + ret = 1; + } + } + + return ret; } void display_new_optdepends(alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg) { - alpm_list_t *old = alpm_pkg_get_optdepends(oldpkg); - alpm_list_t *new = alpm_pkg_get_optdepends(newpkg); - alpm_list_t *optdeps = alpm_list_diff(new,old,str_cmp); - if(optdeps) { + alpm_list_t *i, *old, *new, *optdeps, *optstrings = NULL; + + old = alpm_pkg_get_optdepends(oldpkg); + new = alpm_pkg_get_optdepends(newpkg); + optdeps = alpm_list_diff(new, old, depend_cmp); + + /* turn optdepends list into a text list */ + for(i = optdeps; i; i = alpm_list_next(i)) { + alpm_depend_t *optdep = i->data; + optstrings = alpm_list_add(optstrings, alpm_dep_compute_string(optdep)); + } + + if(optstrings) { printf(_("New optional dependencies for %s\n"), alpm_pkg_get_name(newpkg)); - list_display_linebreak(" ", optdeps); + list_display_linebreak(" ", optstrings); } + alpm_list_free(optdeps); + FREELIST(optstrings); } void display_optdepends(alpm_pkg_t *pkg) { - alpm_list_t *optdeps = alpm_pkg_get_optdepends(pkg); - if(optdeps) { + alpm_list_t *i, *optdeps, *optstrings = NULL; + + optdeps = alpm_pkg_get_optdepends(pkg); + + /* turn optdepends list into a text list */ + for(i = optdeps; i; i = alpm_list_next(i)) { + alpm_depend_t *optdep = i->data; + optstrings = alpm_list_add(optstrings, alpm_dep_compute_string(optdep)); + } + + if(optstrings) { printf(_("Optional dependencies for %s\n"), alpm_pkg_get_name(pkg)); - list_display_linebreak(" ", optdeps); + list_display_linebreak(" ", optstrings); } + + FREELIST(optstrings); } static void display_repo_list(const char *dbname, alpm_list_t *list) -- 1.7.9.3 From dan at archlinux.org Thu Mar 8 18:19:39 2012 From: dan at archlinux.org (Dan McGee) Date: Thu, 8 Mar 2012 17:19:39 -0600 Subject: [pacman-dev] [PATCH] pacman-optimize: standardize on openssl usage, only touch local/ Message-ID: <1331248779-29336-1-git-send-email-dan@archlinux.org> The rest of our scripts have been using `openssl dgst` rather than tools like `md5sum` for some time, so convert this one too. We also make the following other adjustments: * Use a `find -print0 | xargs -0` pipeline so paths with spaces and or newlines don't totally kill us. * Ensure the files we write out contain only paths relative to the database root, where we know the filenames should all be sane. * Remove use of `diff`, this was the only time we used it in scripts and we can get a cheap substitute by comparing file checksums instead. * Only touch the local/ part of the database. It makes little sense to do anything to the sync/ directory anymore as they are compressed single files that should be regularly written out in full and won't be fragmented on any sane filesystem. Signed-off-by: Dan McGee --- scripts/pacman-optimize.sh.in | 45 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/scripts/pacman-optimize.sh.in b/scripts/pacman-optimize.sh.in index d80435c..4a84c0b 100644 --- a/scripts/pacman-optimize.sh.in +++ b/scripts/pacman-optimize.sh.in @@ -88,9 +88,8 @@ if [[ -n $1 ]]; then dbroot="$1" fi -# make sure diff is installed -if ! type diff >/dev/null 2>&1; then - die "$(gettext "diff tool was not found, please install diffutils.")" +if ! type -p openssl >/dev/null; then + die "$(gettext "Cannot find the %s binary required for verifying integrity.")" "openssl" fi if [[ ! -d $dbroot || ! -d $dbroot/local ]]; then @@ -103,8 +102,8 @@ fi # strip any trailing slash from our dbroot dbroot="${dbroot%/}" -# form the path to our lockfile location lockfile="${dbroot}/db.lck" +localdb="${dbroot}/local" # make sure pacman isn't running if [[ -f $lockfile ]]; then @@ -118,37 +117,39 @@ workdir=$(mktemp -d "${TMPDIR:-/tmp}/pacman-optimize.XXXXXXXXXX") || # step 1: sum the old db msg "$(gettext "MD5sum'ing the old database...")" -find "$dbroot" -type f | sort | xargs md5sum > "$workdir/pacsums.old" +(cd "$localdb" && find . -type f -print0 | \ + xargs -0 openssl dgst -md5 | sort > "$workdir/pacsums.old") # step 2: tar it up -msg "$(gettext "Tar'ing up %s...")" "$dbroot" -bsdtar -czf "$workdir/pacman-db.tar.gz" -C "$dbroot" ./ +msg "$(gettext "Tar'ing up %s...")" "$localdb" +bsdtar -czf "$workdir/pacman-db.tar.gz" -C "$localdb" ./ if (( $? )); then rm -rf "$workdir" - die_r "$(gettext "Tar'ing up %s failed.")" "$dbroot" + die_r "$(gettext "Tar'ing up %s failed.")" "$localdb" fi # step 3: make and sum the new db side-by-side with the old msg "$(gettext "Making and MD5sum'ing the new database...")" -mkdir "$dbroot.new" -bsdtar -xpf "$workdir/pacman-db.tar.gz" -C "$dbroot.new" +mkdir "$localdb.new" +bsdtar -xpf "$workdir/pacman-db.tar.gz" -C "$localdb.new" if (( $? )); then rm -rf "$workdir" - die_r "$(gettext "Untar'ing %s failed.")" "$dbroot" + die_r "$(gettext "Untar'ing %s failed.")" "$localdb" fi # immediate sync following extraction should get it written continuously on HDD msg "$(gettext "Syncing database to disk...")" sync -find "$dbroot.new" -type f | sort | \ - xargs md5sum | sed 's#.new##' > "$workdir/pacsums.new" +(cd "$localdb.new" && find . -type f -print0 | \ + xargs -0 openssl dgst -md5 | sort > "$workdir/pacsums.new") # step 4: compare the sums msg "$(gettext "Checking integrity...")" -diff "$workdir/pacsums.old" "$workdir/pacsums.new" >/dev/null 2>&1 -if (( $? )); then +read -ra old_dgst < <(openssl dgst -md5 < "$workdir/pacsums.old") +read -ra new_dgst < <(openssl dgst -md5 < "$workdir/pacsums.new") +if [[ ${old_dgst[@]:(-1)} != ${new_dgst[@]:(-1)} ]]; then # failed # leave our pacman-optimize tmpdir for checking to see what doesn't match up - rm -rf "$dbroot.new" + rm -rf "$localdb.new" die_r "$(gettext "Integrity check FAILED, reverting to old database.")" fi @@ -156,15 +157,15 @@ fi msg "$(gettext "Rotating database into place...")" fail=0 -mv "$dbroot" "$dbroot.old" || fail=1 -mv "$dbroot.new" "$dbroot" || fail=1 -chmod --reference="$dbroot.old" "$dbroot" || fail=1 -chown --reference="$dbroot.old" "$dbroot" || fail=1 +mv "$localdb" "$localdb.old" || fail=1 +mv "$localdb.new" "$localdb" || fail=1 +chmod --reference="$localdb.old" "$localdb" || fail=1 +chown --reference="$localdb.old" "$localdb" || fail=1 if (( fail )); then # failure with our directory shuffle - die_r "$(gettext "New database substitution failed. Check for $dbroot,\n$dbroot.old, and $dbroot.new directories.")" + die_r "$(gettext "New database substitution failed. Check for %s, %s, and %s directories.")" "$localdb" "$localdb.old" "$localdb.new" fi -rm -rf "$dbroot.old" +rm -rf "$localdb.old" # remove the lock file and our working directory with sums and tarfile rm -f "$lockfile" -- 1.7.9.3 From dan at archlinux.org Thu Mar 8 19:09:24 2012 From: dan at archlinux.org (Dan McGee) Date: Thu, 8 Mar 2012 19:09:24 -0500 (EST) Subject: [pacman-dev] [GIT] The official pacman repository branch, maint, updated. v4.0.2-20-g1a8c3e5 Message-ID: <20120309000924.E80C890094@gerolde.archlinux.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The official pacman repository". The branch, maint has been updated via 1a8c3e52d70bfa21ba108aa77179adf90401949d (commit) via 1fe6cabc4d3868510427e32b60c9aa869886acab (commit) from 4ffa0401d22347332d663f1d400e182d5a181ea2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1a8c3e52d70bfa21ba108aa77179adf90401949d Author: Dave Reisner Date: Fri Mar 2 19:25:15 2012 -0500 makepkg: exit via default signal handler in trap_exit Similar to how we manage receipt of SIGINT in pacman's internal downloader, catch the signal and invoke our own trap handler before unsetting it and calling the default. This requires a slight modification to the arguments passed to trap_exit so we can pass the raised signal to trap_exit (note that we substitue USR1 for ERR since the latter is unique to bash). Fixes FS#28491. Signed-off-by: Dave Reisner Signed-off-by: Dan McGee commit 1fe6cabc4d3868510427e32b60c9aa869886acab Author: Pierre Schmitz Date: Sun Mar 4 13:25:56 2012 +0100 pacman-key: Remove useless signature verification in --populate command Verifing the keyring at this point is useless as a malicious package is already installed and as such has several options to bypass this check anyway. Signed-off-by: Pierre Schmitz Signed-off-by: Dan McGee ----------------------------------------------------------------------- Summary of changes: doc/pacman-key.8.txt | 5 ----- scripts/makepkg.sh.in | 13 +++++++++---- scripts/pacman-key.sh.in | 39 --------------------------------------- 3 files changed, 9 insertions(+), 48 deletions(-) hooks/post-receive -- The official pacman repository From dan at archlinux.org Thu Mar 8 19:09:28 2012 From: dan at archlinux.org (Dan McGee) Date: Thu, 8 Mar 2012 19:09:28 -0500 (EST) Subject: [pacman-dev] [GIT] The official pacman repository branch, master, updated. v4.0.2-169-g8de0631 Message-ID: <20120309000929.3552390099@gerolde.archlinux.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The official pacman repository". The branch, master has been updated via 8de0631edbd1fd7681f6a924f5e166621328c13f (commit) via 1a8c3e52d70bfa21ba108aa77179adf90401949d (commit) via f34864cc9e4e755f2add7581419f4ec1c2525fe0 (commit) via 4773c6b66ef618f4c6345a99d9c246045e9c723b (commit) via 5c404268d965d9ca012e4819ac0c2f289a4c768c (commit) via bc311a24ce536fbf30cc2356a62b08a6c0938ea9 (commit) via 8d26df5ee53d9fb4d2c7be97b7f099e3e8402186 (commit) via 708a227578a8d27bb84dd150fec9c2ebc1afd117 (commit) via 82abe079ab67bb39c6276105449a2d553bf31660 (commit) via 09a93b2e0e8d603328c484a92cad90a1558c6f89 (commit) via e85e77e6f9f0979a16d69cd93ee6ea35583e9bfb (commit) via 00f29cbc14ec24f1e432eadaf35742857285a01a (commit) via 6a636b2b6ec92046b010b7a4a593d3aabe253ef8 (commit) via 1fe6cabc4d3868510427e32b60c9aa869886acab (commit) via 4ffa0401d22347332d663f1d400e182d5a181ea2 (commit) via cb64fbeac41308ee8c46384a126195a1fd75a361 (commit) via ea7fc8962a819a04237876995140363a818202d4 (commit) via fbfcd8665086f71b65370e919105194111b4b5f1 (commit) via 986e99a613605985f64f0e3e4c2635717931f77d (commit) via 4b384b7f0b0e840e09e3bffd2dbb59b88bdd4864 (commit) via d1151b5ab9c407732ded462a0fe0259dea8dcc2a (commit) from 687f7b6ba833db836d8d8387c5b728238b0eac5d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8de0631edbd1fd7681f6a924f5e166621328c13f Merge: f34864c 1a8c3e5 Author: Dan McGee Date: Thu Mar 8 18:08:15 2012 -0600 Merge branch 'maint' Conflicts: lib/libalpm/be_package.c commit f34864cc9e4e755f2add7581419f4ec1c2525fe0 Author: Allan McRae Date: Mon Feb 20 15:02:38 2012 +1000 Simplify package validation info output for sync packages Unify the output for local and sync packages by only printing a list of possible validation types for sync packages. This also has the advantage of not printing the very long sha256 checksum which line wrapped on a standard width terminal. Signed-off-by: Allan McRae commit 4773c6b66ef618f4c6345a99d9c246045e9c723b Author: Allan McRae Date: Mon Feb 20 14:24:35 2012 +1000 Remove _alpm_csum The enum alpm_pkgvalidation_t is essentially a more generic version of _alpm_csum, so use it instead. Signed-off-by: Allan McRae commit 5c404268d965d9ca012e4819ac0c2f289a4c768c Author: Allan McRae Date: Sat Feb 18 16:31:37 2012 +1000 Add information on how an installed package was validated When installing a package, store information on which validation method was used and output this on "pacman -Qi" operations. e.g. Validated By : SHA256 Sum Possible values are Unknown, None, MD5 Sum, SHA256 Sum, Signature. Dan: just a few very minor tweaks. Signed-off-by: Allan McRae Signed-off-by: Dan McGee commit bc311a24ce536fbf30cc2356a62b08a6c0938ea9 Author: Dave Reisner Date: Wed Feb 29 21:56:40 2012 -0500 makepkg: use array instead of string Signed-off-by: Dave Reisner commit 8d26df5ee53d9fb4d2c7be97b7f099e3e8402186 Author: Dave Reisner Date: Wed Feb 29 21:55:44 2012 -0500 makepkg: avoid use of eval in run_pacman Signed-off-by: Dave Reisner commit 708a227578a8d27bb84dd150fec9c2ebc1afd117 Author: Dave Reisner Date: Wed Feb 15 00:01:45 2012 -0500 makepkg: enforce decimal format for pkgrel Signed-off-by: Dave Reisner commit 82abe079ab67bb39c6276105449a2d553bf31660 Author: Allan McRae Date: Sat Feb 25 15:57:29 2012 +1000 Point python shebangs at python2 Python PEP-394 states that all python code should point at the python2 or python3 symlinks at maintain cross-distro compatibility. Note that this does not matter when calling these scripts using "make check" as they are explictly called using the detected python version. As this only affects manually calling these scripts, I have not had configure/make replace the shebangs. Signed-off-by: Allan McRae commit 09a93b2e0e8d603328c484a92cad90a1558c6f89 Author: Christian Hesse Date: Sat Feb 11 19:48:59 2012 +1000 makepkg: allow specifying compression options Adds the ability to override the commands used to compressing compiled and source packages. This is useful for those wanting to use alternative implementations of the compression tools or non-default compression options. Allan: documented options in man page Signed-off-by: Allan McRae commit e85e77e6f9f0979a16d69cd93ee6ea35583e9bfb Author: Benedikt Morbach Date: Mon Jul 18 01:54:06 2011 +0200 Hook new optdepend structures up No new behaviour introduced, everything should work exactly as before. Dan: refactored to use the single alpm_depend_t structure. Signed-off-by: Benedikt Morbach Signed-off-by: Dan McGee commit 00f29cbc14ec24f1e432eadaf35742857285a01a Author: Dan McGee Date: Mon Dec 12 13:34:48 2011 -0600 Allow alpm_depend_t to have a description This is the first step in parsing and handling optdepends. There is no behavior change introduced in this commit; however, depends that contain a ": " string will now be parsed as having a description and it will be stored in the depend structure. Later patches will utilize this new field as appropriate. This is heavily based on the work of Benedikt, who did something similar but introduced a new type for this rather than only a new field to the existing type. Heavily-influenced-by: Benedikt Morbach Signed-off-by: Dan McGee commit 6a636b2b6ec92046b010b7a4a593d3aabe253ef8 Author: Dan McGee Date: Sat Mar 3 13:02:25 2012 -0600 pacman-optimize: standardize on openssl usage, only touch local/ The rest of our scripts have been using `openssl dgst` rather than tools like `md5sum` for some time, so convert this one too. We also make the following other adjustments: * Use a `find -print0 | xargs -0` pipeline so paths with spaces and or newlines don't totally kill us. * Ensure the files we write out contain only paths relative to the database root, where we know the filenames should all be sane. * Remove use of `diff`, this was the only time we used it in scripts and we can get a cheap substitute by comparing file checksums instead. * Only touch the local/ part of the database. It makes little sense to do anything to the sync/ directory anymore as they are compressed single files that should be regularly written out in full and won't be fragmented on any sane filesystem. Signed-off-by: Dan McGee ----------------------------------------------------------------------- Summary of changes: configure.ac | 6 +- doc/makepkg.conf.5.txt | 4 + doc/pacman-key.8.txt | 5 - etc/makepkg.conf.in | 10 ++ lib/libalpm/alpm.h | 18 ++++- lib/libalpm/be_local.c | 49 +++++++++++- lib/libalpm/be_package.c | 64 ++++++++++---- lib/libalpm/be_sync.c | 26 ++++++- lib/libalpm/deps.c | 44 +++++++--- lib/libalpm/package.c | 15 +++- lib/libalpm/package.h | 4 +- lib/libalpm/po/it.po | 76 +++++++++-------- lib/libalpm/sync.c | 10 ++- lib/libalpm/util.c | 6 +- lib/libalpm/util.h | 7 +-- scripts/makepkg.sh.in | 46 ++++++----- scripts/pacman-key.sh.in | 39 --------- scripts/pacman-optimize.sh.in | 45 +++++----- scripts/po/it.po | 185 +++++++++++++++++++---------------------- scripts/po/sk.po | 10 +- scripts/po/uk.po | 23 +++-- scripts/repo-add.sh.in | 6 +- src/pacman/package.c | 48 +++++++++-- src/pacman/po/de.po | 42 +++++----- src/pacman/po/en_GB.po | 41 ++++++---- src/pacman/po/fi.po | 18 ++-- src/pacman/po/fr.po | 45 +++++----- src/pacman/po/it.po | 127 ++++++++++++++++------------- src/pacman/po/lt.po | 171 +++++++++++++++++++------------------- src/pacman/po/pacman.pot | 22 ++--- src/pacman/po/pt_BR.po | 62 +++++++------- src/pacman/po/uk.po | 41 +++++----- src/pacman/sync.c | 71 ++++++++++------ src/pacman/util.c | 79 +++++++++++++++--- test/pacman/pactest.py | 2 +- test/pacman/pmdb.py | 2 +- test/pacman/pmenv.py | 2 +- test/pacman/pmfile.py | 2 +- test/pacman/pmpkg.py | 2 +- test/pacman/pmrule.py | 2 +- test/pacman/pmtest.py | 2 +- test/pacman/util.py | 2 +- 42 files changed, 858 insertions(+), 623 deletions(-) hooks/post-receive -- The official pacman repository From allan at archlinux.org Fri Mar 9 01:03:54 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 16:03:54 +1000 Subject: [pacman-dev] [PATCH] makepkg: append pkgbase to BUILDDIR if specified Message-ID: <1331273034-4269-1-git-send-email-allan@archlinux.org> This means multiple packages can be build using the same BUILDDIR without their source files all ending up extracted in the same directory. Fixes FS#28417. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 89cd118..8763ffb 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2061,8 +2061,6 @@ if [[ ! -w $BUILDDIR ]]; then plain "$(gettext "Aborting...")" exit 1 fi -srcdir="$BUILDDIR/src" -pkgdir="$BUILDDIR/pkg" PKGDEST=${_PKGDEST:-$PKGDEST} PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined @@ -2159,6 +2157,14 @@ fi pkgbase=${pkgbase:-${pkgname[0]}} epoch=${epoch:-0} +if [[ $BUILDDIR = "$startdir" ]]; then + srcdir="$BUILDDIR/src" + pkgdir="$BUILDDIR/pkg" +else + srcdir="$BUILDDIR/$pkgbase/src" + pkgdir="$BUILDDIR/$pkgbase/pkg" +fi + if (( GENINTEG )); then mkdir -p "$srcdir" chmod a-s "$srcdir" -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 02:59:03 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 17:59:03 +1000 Subject: [pacman-dev] [PATCH 0/6] fix some safety issues in makepkg Message-ID: <1331279949-9642-1-git-send-email-allan@archlinux.org> With the upcoming makepkg-lobotomy (removing the error trap apart from in the actual packaging steps), we need to add some more error checking and be as safe as possible when potentially dealing with strange variable contents. Some of these are a bit unnecessary (e.g. using printf to output variables that almost certainly cannot start with a "-n"), but there is no harm in applying them globally. Allan McRae (6): makepkg: the rhs in string comparisons should be quoted makepkg: use printf rather than echo to output variable makepkg: prevent issues with files starting with a hyphen makepkg: abort when failing to create BUILDDIR makepkg: quote removed filename as it can have spaces makepkg: safely change directories scripts/makepkg.sh.in | 147 ++++++++++++++++++++++++++----------------------- 1 file changed, 79 insertions(+), 68 deletions(-) -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 02:59:04 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 17:59:04 +1000 Subject: [pacman-dev] [PATCH 1/6] makepkg: the rhs in string comparisons should be quoted In-Reply-To: <1331279949-9642-1-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> Message-ID: <1331279949-9642-2-git-send-email-allan@archlinux.org> Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 8763ffb..601c7e2 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -311,7 +311,7 @@ in_opt_array() { local opt for opt in "$@"; do - if [[ $opt = $needle ]]; then + if [[ $opt = "$needle" ]]; then echo 'y' # Enabled return elif [[ $opt = "!$needle" ]]; then @@ -333,7 +333,7 @@ in_array() { local needle=$1; shift local item for item in "$@"; do - [[ $item = $needle ]] && return 0 # Found + [[ $item = "$needle" ]] && return 0 # Found done return 1 # Not Found } @@ -357,7 +357,7 @@ get_downloadclient() { local i for i in "${DLAGENTS[@]}"; do local handler="${i%%::*}" - if [[ $proto = $handler ]]; then + if [[ $proto = "$handler" ]]; then local agent="${i##*::}" break fi @@ -557,7 +557,7 @@ download_sources() { local url=$(get_url "$netfile") # if we get here, check to make sure it was a URL, else fail - if [[ $file = $url ]]; then + if [[ $file = "$url" ]]; then error "$(gettext "%s was not found in the build directory and is not a URL.")" "$file" exit 1 # $E_MISSING_FILE fi @@ -683,7 +683,7 @@ check_checksums() { local expectedsum=$(tr '[:upper:]' '[:lower:]' <<< "${integrity_sums[$idx]}") local realsum="$(openssl dgst -${integ} "$file")" realsum="${realsum##* }" - if [[ $expectedsum = $realsum ]]; then + if [[ $expectedsum = "$realsum" ]]; then printf -- "$(gettext "Passed")\n" >&2 else printf -- "$(gettext "FAILED")\n" >&2 @@ -842,7 +842,7 @@ extract_sources() { local ret=0 msg2 "$(gettext "Extracting %s with %s")" "$file" "$cmd" - if [[ $cmd = bsdtar ]]; then + if [[ $cmd = "bsdtar" ]]; then $cmd -xf "$file" || ret=$? else rm -f "${file%.*}" @@ -981,7 +981,7 @@ tidy_install() { msg2 "$(gettext "Purging unwanted files...")" local pt for pt in "${PURGE_TARGETS[@]}"; do - if [[ ${pt} = ${pt//\/} ]]; then + if [[ ${pt} = "${pt//\/}" ]]; then find . -type f -name "${pt}" -exec rm -f -- '{}' \; else rm -f ${pt} @@ -1025,7 +1025,7 @@ tidy_install() { done fi - if [[ $(check_option strip) = y ]]; then + if [[ $(check_option strip) = "y" ]]; then msg2 "$(gettext "Stripping unneeded symbols from binaries and libraries...")" # make sure library stripping variables are defined to prevent excess stripping [[ -z ${STRIP_SHARED+x} ]] && STRIP_SHARED="-S" @@ -1207,7 +1207,7 @@ write_pkginfo() { for it in "${packaging_options[@]}"; do local ret="$(check_option $it)" if [[ $ret != "?" ]]; then - if [[ $ret = y ]]; then + if [[ $ret = "y" ]]; then echo "makepkgopt = $it" else echo "makepkgopt = !$it" @@ -1370,7 +1370,7 @@ create_srcpackage() { local file for file in "${source[@]}"; do - if [[ "$file" == $(get_filename "$file") ]] || (( SOURCEONLY == 2 )); then + if [[ "$file" = "$(get_filename "$file")" ]] || (( SOURCEONLY == 2 )); then local absfile absfile=$(get_filepath "$file") || missing_source_file "$file" msg2 "$(gettext "Adding %s...")" "${absfile##*/}" @@ -1580,7 +1580,7 @@ check_sanity() { known=0 # check if option matches a known option or its inverse for kopt in ${packaging_options[@]} ${other_options[@]}; do - if [[ ${i} = ${kopt} || ${i} = "!${kopt}" ]]; then + if [[ ${i} = "${kopt}" || ${i} = "!${kopt}" ]]; then known=1 fi done @@ -1704,7 +1704,7 @@ devel_check() { # Do not update pkgver if --holdver is set, when building a source package, repackaging, # reading PKGBUILD from pipe (-f), or if we cannot write to the file (-w) if (( HOLDVER || SOURCEONLY || REPKG )) || - [[ ! -f $BUILDFILE || ! -w $BUILDFILE || $BUILDFILE = /dev/stdin ]]; then + [[ ! -f $BUILDFILE || ! -w $BUILDFILE || $BUILDFILE = "/dev/stdin" ]]; then return fi -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 02:59:05 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 17:59:05 +1000 Subject: [pacman-dev] [PATCH 2/6] makepkg: use printf rather than echo to output variable In-Reply-To: <1331279949-9642-1-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> Message-ID: <1331279949-9642-3-git-send-email-allan@archlinux.org> Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 601c7e2..384e142 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -211,7 +211,7 @@ get_filepath() { return 1 fi - echo "$file" + printf "%s\n" "$file" } # Print 'source not found' error message and exit makepkg @@ -226,13 +226,13 @@ get_filename() { # if a filename is specified, use it local filename="${1%%::*}" # if it is just an URL, we only keep the last component - echo "${filename##*/}" + printf "%s\n" "${filename##*/}" } # extract the URL from a source entry get_url() { # strip an eventual filename - echo "${1#*::}" + printf "%s\n" "${1#*::}" } ## @@ -242,9 +242,9 @@ get_url() { get_full_version() { if [[ -z $1 ]]; then if [[ $epoch ]] && (( ! $epoch )); then - echo $pkgver-$pkgrel + printf "%s\n" $pkgver-$pkgrel else - echo $epoch:$pkgver-$pkgrel + printf "%s\n" $epoch:$pkgver-$pkgrel fi else for i in pkgver pkgrel epoch; do @@ -253,9 +253,9 @@ get_full_version() { [[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\" done if (( ! $epoch_override )); then - echo $pkgver_override-$pkgrel_override + printf "%s\n" $pkgver_override-$pkgrel_override else - echo $epoch_override:$pkgver_override-$pkgrel_override + printf "%s\n" $epoch_override:$pkgver_override-$pkgrel_override fi fi } @@ -272,14 +272,14 @@ get_full_version() { check_option() { local ret=$(in_opt_array "$1" ${options[@]}) if [[ $ret != '?' ]]; then - echo $ret + printf "%s\n" "$ret" return fi # fall back to makepkg.conf options ret=$(in_opt_array "$1" ${OPTIONS[@]}) if [[ $ret != '?' ]]; then - echo $ret + printf "%s\n" "$ret" return fi @@ -379,7 +379,7 @@ get_downloadclient() { exit 1 # $E_MISSING_PROGRAM fi - echo "$agent" + printf "%s\n" "$agent" } download_file() { @@ -446,7 +446,7 @@ check_deps() { set -E if (( ret == 127 )); then #unresolved deps - echo "$pmout" + printf "%s\n" "$pmout" elif (( ret )); then error "$(gettext "'%s' returned a fatal error (%i): %s")" "$PACMAN" "$ret" "$pmout" return "$ret" @@ -594,9 +594,9 @@ get_integlist() { done if (( ${#integlist[@]} > 0 )); then - echo ${integlist[@]} + printf "%s\n" ${integlist[@]} else - echo ${INTEGRITY_CHECK[@]} + printf "%s\n" ${INTEGRITY_CHECK[@]} fi } @@ -627,7 +627,7 @@ generate_checksums() { local ct=0 local numsrc=${#source[@]} - echo -n "${integ}sums=(" + printf "%s" "${integ}sums=(" local i local indent='' @@ -641,8 +641,8 @@ generate_checksums() { file="$(get_filepath "$netfile")" || missing_source_file "$netfile" local sum="$(openssl dgst -${integ} "$file")" sum=${sum##* } - (( ct )) && echo -n "$indent" - echo -n "'$sum'" + (( ct )) && printf "%s" "$indent" + printf "%s" "'$sum'" ct=$(($ct+1)) (( $ct < $numsrc )) && echo done @@ -668,7 +668,7 @@ check_checksums() { for file in "${source[@]}"; do local found=1 file="$(get_filename "$file")" - echo -n " $file ... " >&2 + printf "%s" " $file ... " >&2 if ! file="$(get_filepath "$file")"; then printf -- "$(gettext "NOT FOUND")\n" >&2 @@ -1082,7 +1082,7 @@ find_libdepends() { if in_array "${soname}" ${depends[@]}; then if ! in_array "${soname}=${soversion}-${soarch}" ${libdepends[@]}; then # libfoo.so=1-64 - echo "${soname}=${soversion}-${soarch}" + printf "%s" "${soname}=${soversion}-${soarch}" libdepends=(${libdepends[@]} "${soname}=${soversion}-${soarch}") fi fi @@ -1137,7 +1137,7 @@ find_libprovides() { fi done - echo ${libprovides[@]} + printf "%s" ${libprovides[@]} } check_license() { @@ -1164,15 +1164,15 @@ write_pkginfo() { echo "# using $(fakeroot -v)" fi echo "# $(LC_ALL=C date -u)" - echo "pkgname = $1" + printf "pkgname = %s\n" "$1" (( SPLITPKG )) && echo pkgbase = $pkgbase echo "pkgver = $(get_full_version)" - echo "pkgdesc = $pkgdesc" - echo "url = $url" - echo "builddate = $builddate" - echo "packager = $packager" - echo "size = $size" - echo "arch = $PKGARCH" + printf "pkgdesc = %s\n" "$pkgdesc" + printf "url = %s\n" "$url" + printf "builddate = %s\n" "$builddate" + printf "packager = %s\n" "$packager" + printf "size = %s\n" "$size" + printf "arch = %s\n" "$PKGARCH" [[ $license ]] && printf "license = %s\n" "${license[@]}" [[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}" @@ -1200,7 +1200,7 @@ write_pkginfo() { return 1 fi else - echo "depend = $it" + printf "depend = %s\n" "$it" fi done @@ -1208,9 +1208,9 @@ write_pkginfo() { local ret="$(check_option $it)" if [[ $ret != "?" ]]; then if [[ $ret = "y" ]]; then - echo "makepkgopt = $it" + printf "makepkgopt = %s\n" "$it" else - echo "makepkgopt = !$it" + printf "makepkgopt = %s\n" "!$it" fi fi done @@ -1851,7 +1851,7 @@ canonicalize_path() { pwd -P ) else - echo "$path" + printf "%s\n" "$path" fi } @@ -1916,7 +1916,7 @@ There is NO WARRANTY, to the extent permitted by law.\n")" # determine whether we have gettext; make it a no-op if we do not if ! type -p gettext >/dev/null; then gettext() { - echo "$@" + printf "%s\n" "$@" } fi -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 02:59:06 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 17:59:06 +1000 Subject: [pacman-dev] [PATCH 3/6] makepkg: prevent issues with files starting with a hyphen In-Reply-To: <1331279949-9642-1-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> Message-ID: <1331279949-9642-4-git-send-email-allan@archlinux.org> Most places in makepkg deal with full file paths, but a few use the file name only. Protect from potential issues when a file name starts with a hyphen. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 384e142..8dd2d39 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -833,7 +833,7 @@ extract_sources() { esac ;; *) # See if bsdtar can recognize the file - if bsdtar -tf "$file" -q '*' &>/dev/null; then + if bsdtar -tf "./$file" -q '*' &>/dev/null; then cmd="bsdtar" else continue @@ -843,10 +843,10 @@ extract_sources() { local ret=0 msg2 "$(gettext "Extracting %s with %s")" "$file" "$cmd" if [[ $cmd = "bsdtar" ]]; then - $cmd -xf "$file" || ret=$? + $cmd -xf "./$file" || ret=$? else - rm -f "${file%.*}" - $cmd -dcf "$file" > "${file%.*}" || ret=$? + rm -f -- "${file%.*}" + $cmd -dcf "./$file" > "${file%.*}" || ret=$? fi if (( ret )); then error "$(gettext "Failed to extract %s")" "$file" @@ -974,7 +974,7 @@ tidy_install() { if [[ $(check_option docs) = "n" && -n ${DOC_DIRS[*]} ]]; then msg2 "$(gettext "Removing doc files...")" - rm -rf ${DOC_DIRS[@]} + rm -rf -- ${DOC_DIRS[@]} fi if [[ $(check_option purge) = "y" && -n ${PURGE_TARGETS[*]} ]]; then @@ -1001,7 +1001,7 @@ tidy_install() { find ${MAN_DIRS[@]} -lname "$file" 2>/dev/null | while read link ; do rm -f "$link" "${link}.gz" - ln -s "${file}.gz" "${link}.gz" + ln -s -- "${file}.gz" "${link}.gz" done # check file still exists (potentially already compressed due to hardlink) -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 02:59:07 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 17:59:07 +1000 Subject: [pacman-dev] [PATCH 4/6] makepkg: abort when failing to create BUILDDIR In-Reply-To: <1331279949-9642-1-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> Message-ID: <1331279949-9642-5-git-send-email-allan@archlinux.org> Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 8dd2d39..9cd8af8 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2052,8 +2052,11 @@ readonly ALL_OFF BOLD BLUE GREEN RED YELLOW BUILDDIR=${_BUILDDIR:-$BUILDDIR} BUILDDIR=${BUILDDIR:-$startdir} #default to $startdir if undefined if [[ ! -d $BUILDDIR ]]; then - mkdir -p "$BUILDDIR" || - error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" + if ! mkdir -p "$BUILDDIR"; then + error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" + plain "$(gettext "Aborting...")" + exit 1 + fi chmod a-s "$BUILDDIR" fi if [[ ! -w $BUILDDIR ]]; then -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 02:59:08 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 17:59:08 +1000 Subject: [pacman-dev] [PATCH 5/6] makepkg: quote removed filename as it can have spaces In-Reply-To: <1331279949-9642-1-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> Message-ID: <1331279949-9642-6-git-send-email-allan@archlinux.org> Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9cd8af8..534f6f8 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -170,7 +170,7 @@ clean_up() { for pkg in ${pkgname[@]}; do for file in ${pkg}-*-*-${CARCH}{${PKGEXT},${SRCEXT}}; do if [[ -h $file && ! -e $file ]]; then - rm -f $file + rm -f "$file" fi done done -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 02:59:09 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 17:59:09 +1000 Subject: [pacman-dev] [PATCH 6/6] makepkg: safely change directories In-Reply-To: <1331279949-9642-1-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> Message-ID: <1331279949-9642-7-git-send-email-allan@archlinux.org> In preparation for the removal of the global error trap we need a way to ensure changing directories succeeds. Add a "cd_safe" wrapper that performs the necessary check. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 534f6f8..f21c638 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -874,6 +874,14 @@ error_function() { exit 2 # $E_BUILD_FAILED } +cd_safe() { + if ! cd "$1"; then + error "$(gettext "Failed to change to directory %s")" "$1" + plain "$(gettext "Aborting...")" + exit 1 + fi +} + run_function() { if [[ -z $1 ]]; then return 1 @@ -891,7 +899,7 @@ run_function() { fi msg "$(gettext "Starting %s()...")" "$pkgfunc" - cd "$srcdir" + cd_safe "$srcdir" # ensure all necessary build variables are exported export CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST @@ -969,7 +977,7 @@ run_package() { } tidy_install() { - cd "$pkgdir" + cd_safe "$pkgdir" msg "$(gettext "Tidying install...")" if [[ $(check_option docs) = "n" && -n ${DOC_DIRS[*]} ]]; then @@ -1219,7 +1227,7 @@ write_pkginfo() { } check_package() { - cd "$pkgdir" + cd_safe "$pkgdir" # check existence of backup files local file @@ -1248,7 +1256,7 @@ create_package() { check_package - cd "$pkgdir" + cd_safe "$pkgdir" msg "$(gettext "Creating package...")" local nameofpkg @@ -1407,7 +1415,7 @@ create_srcpackage() { # tar it up msg2 "$(gettext "Compressing source package...")" - cd "${srclinks}" + cd_safe "${srclinks}" if ! bsdtar -c${TAR_OPT}Lf "$pkg_file" ${pkgbase}; then error "$(gettext "Failed to create source package file.")" exit 1 # TODO: error code @@ -1423,7 +1431,7 @@ create_srcpackage() { warning "$(gettext "Failed to create symlink to source package file.")" fi - cd "${startdir}" + cd_safe "${startdir}" rm -rf "${srclinks}" } @@ -1757,7 +1765,7 @@ devel_check() { fi msg "$(gettext "Determining latest %s revision...")" 'hg' if [[ -d ./src/$_hgrepo ]] ; then - cd ./src/$_hgrepo + cd_safe ./src/$_hgrepo local ret=0 hg pull || ret=$? if (( ! ret )); then @@ -1768,10 +1776,10 @@ devel_check() { else [[ ! -d ./src/ ]] && mkdir ./src/ hg clone $_hgroot/$_hgrepo ./src/$_hgrepo - cd ./src/$_hgrepo + cd_safe ./src/$_hgrepo fi newpkgver=$(hg tip --template "{rev}") - cd ../../ + cd_safe ../../ fi if [[ -n $newpkgver ]]; then @@ -1847,7 +1855,7 @@ canonicalize_path() { if [[ -d $path ]]; then ( - cd "$path" + cd_safe "$path" pwd -P ) else @@ -2171,7 +2179,7 @@ fi if (( GENINTEG )); then mkdir -p "$srcdir" chmod a-s "$srcdir" - cd "$srcdir" + cd_safe "$srcdir" download_sources generate_checksums exit 0 # $E_OK @@ -2321,14 +2329,14 @@ if (( SOURCEONLY )); then # Get back to our src directory so we can begin with sources. mkdir -p "$srcdir" chmod a-s "$srcdir" - cd "$srcdir" + cd_safe "$srcdir" if ( (( ! SKIPCHECKSUMS )) || \ ( (( ! SKIPPGPCHECK )) && source_has_signatures ) ) || \ (( SOURCEONLY == 2 )); then download_sources fi check_source_integrity - cd "$startdir" + cd_safe "$startdir" # if we are root or if fakeroot is not enabled, then we don't use it if [[ $(check_buildenv fakeroot) != "y" ]] || (( EUID == 0 )); then @@ -2384,7 +2392,7 @@ umask 0022 # get back to our src directory so we can begin with sources mkdir -p "$srcdir" chmod a-s "$srcdir" -cd "$srcdir" +cd_safe "$srcdir" if (( NOEXTRACT )); then warning "$(gettext "Skipping source retrieval -- using existing %s tree")" "src/" @@ -2420,7 +2428,7 @@ else fi mkdir -p "$pkgdir" chmod a-s "$pkgdir" - cd "$startdir" + cd_safe "$startdir" # if we are root or if fakeroot is not enabled, then we don't use it if [[ $(check_buildenv fakeroot) != "y" ]] || (( EUID == 0 )); then @@ -2450,7 +2458,7 @@ else devel_update (( BUILDFUNC )) && run_build (( CHECKFUNC )) && run_check - cd "$startdir" + cd_safe "$startdir" fi enter_fakeroot -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 06:26:47 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 21:26:47 +1000 Subject: [pacman-dev] [PATCH] makepkg: deal with overriden package arch properly Message-ID: <1331292407-27073-1-git-send-email-allan@archlinux.org> This fixes a lot of checks done by makepkg (e.g. to see if a package is already built and choosing which package to install). Previously, if a package had both "i686" and "any" versions, the "i686" one always took precidence regardless of the value of "arch" in the PKGBUILD for that package. Fixes FS#27204. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 51 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index f21c638..8abd69c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -168,7 +168,7 @@ clean_up() { # clean up dangling symlinks to packages for pkg in ${pkgname[@]}; do - for file in ${pkg}-*-*-${CARCH}{${PKGEXT},${SRCEXT}}; do + for file in ${pkg}-*-*-*{${PKGEXT},${SRCEXT}}; do if [[ -h $file && ! -e $file ]]; then rm -f "$file" fi @@ -261,6 +261,28 @@ get_full_version() { } ## +# usage : get_pkg_arch( [$pkgname] ) +# return : architecture of the package +## +get_pkg_arch() { + if [[ -z $1 ]]; then + if [[ $arch = "any" ]]; then + printf "%s\n" "any" + else + printf "%s\n" "$CARCH" + fi + else + local arch_override + eval $(declare -f package_$1 | sed -n 's/\(^[[:space:]]*arch=\)/arch_override=/p') + if [[ $arch_override = "any" ]]; then + printf "%s\n" "any" + else + printf "%s\n" "$CARCH" + fi + fi +} + +## # Checks to see if options are present in makepkg.conf or PKGBUILD; # PKGBUILD options always take precedence. # @@ -1180,7 +1202,7 @@ write_pkginfo() { printf "builddate = %s\n" "$builddate" printf "packager = %s\n" "$packager" printf "size = %s\n" "$size" - printf "arch = %s\n" "$PKGARCH" + printf "arch = %s\n" "$pkgarch" [[ $license ]] && printf "license = %s\n" "${license[@]}" [[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}" @@ -1266,11 +1288,7 @@ create_package() { nameofpkg="$1" fi - if [[ $arch = "any" ]]; then - PKGARCH="any" - else - PKGARCH=$CARCH - fi + pkgarch=$(get_pkg_arch) write_pkginfo $nameofpkg > .PKGINFO @@ -1292,7 +1310,7 @@ create_package() { msg2 "$(gettext "Compressing package...")" local fullver=$(get_full_version) - local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${PKGARCH}${PKGEXT}" + local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${pkgarch}${PKGEXT}" local ret=0 [[ -f $pkg_file ]] && rm -f "$pkg_file" @@ -1446,12 +1464,9 @@ install_package() { local fullver pkg pkglist for pkg in ${pkgname[@]}; do - fullver=$(get_full_version $pkg) - if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT} ]]; then - pkglist+=" $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT}" - else - pkglist+=" $PKGDEST/${pkg}-${fullver}-any${PKGEXT}" - fi + local fullver=$(get_full_version $pkg) + local pkgarch=$(get_pkg_arch $pkg) + pkglist+=" $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}" done if ! run_pacman -U $pkglist; then @@ -2239,8 +2254,8 @@ fi if (( ! SPLITPKG )); then fullver=$(get_full_version) - if [[ -f $PKGDEST/${pkgname}-${fullver}-${CARCH}${PKGEXT} \ - || -f $PKGDEST/${pkgname}-${fullver}-any${PKGEXT} ]] \ + pkgarch=$(get_pkg_arch) + if [[ -f $PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT} ]] \ && ! (( FORCE || SOURCEONLY || NOBUILD )); then if (( INSTALL )); then warning "$(gettext "A package has already been built, installing existing package...")" @@ -2256,8 +2271,8 @@ else somepkgbuilt=0 for pkg in ${pkgname[@]}; do fullver=$(get_full_version $pkg) - if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT} \ - || -f $PKGDEST/${pkg}-${fullver}-any${PKGEXT} ]]; then + pkgarch=$(get_pkg_arch $pkg) + if [[ -f $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT} ]]; then somepkgbuilt=1 else allpkgbuilt=0 -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 08:20:03 2012 From: allan at archlinux.org (Allan McRae) Date: Fri, 9 Mar 2012 23:20:03 +1000 Subject: [pacman-dev] [PATCH] Skip special files when cleaning package cache Message-ID: <1331299203-26886-1-git-send-email-allan@archlinux.org> Ignore .sig, *.db*, and *.src.tar* when cleaning the package cache. Fixes FS#25166. Signed-off-by: Allan McRae --- I am bad at regex... so I am sure some of these could be tightened up. src/pacman/sync.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index e69ca58..c617e0b 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -170,6 +171,7 @@ static int sync_cleancache(int level) alpm_db_t *db_local = alpm_get_localdb(config->handle); alpm_list_t *cachedirs = alpm_option_get_cachedirs(config->handle); int ret = 0; + regex_t sigreg, dbreg, srcpkgreg; for(i = cachedirs; i; i = alpm_list_next(i)) { printf(_("Cache directory: %s\n"), (const char *)i->data); @@ -199,6 +201,10 @@ static int sync_cleancache(int level) printf(_("removing all files from cache...\n")); } + regcomp(&sigreg, "\\.sig$", REG_EXTENDED | REG_NEWLINE); + regcomp(&dbreg, "\\.db(\\.tar[^[:space:]]*)?$", REG_EXTENDED | REG_NEWLINE); + regcomp(&srcpkgreg, "\\.src\\.tar", REG_EXTENDED | REG_NEWLINE); + for(i = cachedirs; i; i = alpm_list_next(i)) { const char *cachedir = i->data; DIR *dir = opendir(cachedir); @@ -222,6 +228,22 @@ static int sync_cleancache(int level) if(strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } + + /* skip signature files - they are removed with their package file */ + if(regexec(&sigreg, ent->d_name, 0, 0, 0) == 0) { + continue; + } + + /* skip package database within the cache directory */ + if(regexec(&dbreg, ent->d_name, 0, 0, 0) == 0) { + continue; + } + + /* skip source packages withing the cache directory */ + if(regexec(&srcpkgreg, ent->d_name, 0, 0, 0) == 0) { + continue; + } + /* build the full filepath */ snprintf(path, PATH_MAX, "%s%s", cachedir, ent->d_name); -- 1.7.9.3 From d at falconindy.com Fri Mar 9 09:01:07 2012 From: d at falconindy.com (Dave Reisner) Date: Fri, 9 Mar 2012 09:01:07 -0500 Subject: [pacman-dev] [PATCH 3/6] makepkg: prevent issues with files starting with a hyphen In-Reply-To: <1331279949-9642-4-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-4-git-send-email-allan@archlinux.org> Message-ID: <20120309140107.GI838@rampage> On Fri, Mar 09, 2012 at 05:59:06PM +1000, Allan McRae wrote: > Most places in makepkg deal with full file paths, but a few use the > file name only. Protect from potential issues when a file name > starts with a hyphen. How sure are we that these will always be relative paths and never ever absolute? > Signed-off-by: Allan McRae > --- > scripts/makepkg.sh.in | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 384e142..8dd2d39 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -833,7 +833,7 @@ extract_sources() { > esac ;; > *) > # See if bsdtar can recognize the file > - if bsdtar -tf "$file" -q '*' &>/dev/null; then > + if bsdtar -tf "./$file" -q '*' &>/dev/null; then not necessary. "$file" is an argument to the -f flag, so we don't need to work around this: $ bsdtar -czf --foo.tar.gz ~/.bash* $ ls -l -- --foo.tar.gz -rw-r--r-- 1 noclaf users 57856 Mar 9 08:52 --foo.tar.gz > cmd="bsdtar" > else > continue > @@ -843,10 +843,10 @@ extract_sources() { > local ret=0 > msg2 "$(gettext "Extracting %s with %s")" "$file" "$cmd" > if [[ $cmd = "bsdtar" ]]; then > - $cmd -xf "$file" || ret=$? > + $cmd -xf "./$file" || ret=$? same here. > else > - rm -f "${file%.*}" > - $cmd -dcf "$file" > "${file%.*}" || ret=$? > + rm -f -- "${file%.*}" > + $cmd -dcf "./$file" > "${file%.*}" || ret=$? same here (the rm wants it, though) > fi > if (( ret )); then > error "$(gettext "Failed to extract %s")" "$file" > @@ -974,7 +974,7 @@ tidy_install() { > > if [[ $(check_option docs) = "n" && -n ${DOC_DIRS[*]} ]]; then > msg2 "$(gettext "Removing doc files...")" > - rm -rf ${DOC_DIRS[@]} > + rm -rf -- ${DOC_DIRS[@]} i hate that we can't quote this. > fi > > if [[ $(check_option purge) = "y" && -n ${PURGE_TARGETS[*]} ]]; then > @@ -1001,7 +1001,7 @@ tidy_install() { > find ${MAN_DIRS[@]} -lname "$file" 2>/dev/null | > while read link ; do > rm -f "$link" "${link}.gz" > - ln -s "${file}.gz" "${link}.gz" > + ln -s -- "${file}.gz" "${link}.gz" No love for the rm? I admit it would be an extremely nonstandard case, but the same applies for the ln call. > done > > # check file still exists (potentially already compressed due to hardlink) > -- > 1.7.9.3 > > From archlinux at cryptocrack.de Fri Mar 9 09:08:37 2012 From: archlinux at cryptocrack.de (Lukas Fleischer) Date: Fri, 9 Mar 2012 15:08:37 +0100 Subject: [pacman-dev] [PATCH] Skip special files when cleaning package cache In-Reply-To: <1331299203-26886-1-git-send-email-allan@archlinux.org> References: <1331299203-26886-1-git-send-email-allan@archlinux.org> Message-ID: <20120309140837.GA20498@blizzard> On Fri, Mar 09, 2012 at 11:20:03PM +1000, Allan McRae wrote: > Ignore .sig, *.db*, and *.src.tar* when cleaning the package cache. > > Fixes FS#25166. > > Signed-off-by: Allan McRae > --- > > I am bad at regex... so I am sure some of these could be tightened up. Why use regular expressions at all? "*foo*"-style patterns can be easily matched using strstr(), "foo$" might require some more work but I'm pretty sure it can be implemented as a str*() one-liner as well (e.g. using strlen() and strcmp()). > > src/pacman/sync.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/src/pacman/sync.c b/src/pacman/sync.c > index e69ca58..c617e0b 100644 > --- a/src/pacman/sync.c > +++ b/src/pacman/sync.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -170,6 +171,7 @@ static int sync_cleancache(int level) > alpm_db_t *db_local = alpm_get_localdb(config->handle); > alpm_list_t *cachedirs = alpm_option_get_cachedirs(config->handle); > int ret = 0; > + regex_t sigreg, dbreg, srcpkgreg; > > for(i = cachedirs; i; i = alpm_list_next(i)) { > printf(_("Cache directory: %s\n"), (const char *)i->data); > @@ -199,6 +201,10 @@ static int sync_cleancache(int level) > printf(_("removing all files from cache...\n")); > } > > + regcomp(&sigreg, "\\.sig$", REG_EXTENDED | REG_NEWLINE); > + regcomp(&dbreg, "\\.db(\\.tar[^[:space:]]*)?$", REG_EXTENDED | REG_NEWLINE); > + regcomp(&srcpkgreg, "\\.src\\.tar", REG_EXTENDED | REG_NEWLINE); > + > for(i = cachedirs; i; i = alpm_list_next(i)) { > const char *cachedir = i->data; > DIR *dir = opendir(cachedir); > @@ -222,6 +228,22 @@ static int sync_cleancache(int level) > if(strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { > continue; > } > + > + /* skip signature files - they are removed with their package file */ > + if(regexec(&sigreg, ent->d_name, 0, 0, 0) == 0) { > + continue; > + } > + > + /* skip package database within the cache directory */ > + if(regexec(&dbreg, ent->d_name, 0, 0, 0) == 0) { > + continue; > + } > + > + /* skip source packages withing the cache directory */ > + if(regexec(&srcpkgreg, ent->d_name, 0, 0, 0) == 0) { > + continue; > + } > + > /* build the full filepath */ > snprintf(path, PATH_MAX, "%s%s", cachedir, ent->d_name); > > -- > 1.7.9.3 From d at falconindy.com Fri Mar 9 09:12:25 2012 From: d at falconindy.com (Dave Reisner) Date: Fri, 9 Mar 2012 09:12:25 -0500 Subject: [pacman-dev] [PATCH] Skip special files when cleaning package cache In-Reply-To: <20120309140837.GA20498@blizzard> References: <1331299203-26886-1-git-send-email-allan@archlinux.org> <20120309140837.GA20498@blizzard> Message-ID: <20120309141225.GJ838@rampage> On Fri, Mar 09, 2012 at 03:08:37PM +0100, Lukas Fleischer wrote: > On Fri, Mar 09, 2012 at 11:20:03PM +1000, Allan McRae wrote: > > Ignore .sig, *.db*, and *.src.tar* when cleaning the package cache. > > > > Fixes FS#25166. > > > > Signed-off-by: Allan McRae > > --- > > > > I am bad at regex... so I am sure some of these could be tightened up. > > Why use regular expressions at all? "*foo*"-style patterns can be easily > matched using strstr(), "foo$" might require some more work but I'm > pretty sure it can be implemented as a str*() one-liner as well (e.g. > using strlen() and strcmp()). I think you mean fnmatch here, and I agree. > > > > src/pacman/sync.c | 22 ++++++++++++++++++++++ > > 1 file changed, 22 insertions(+) > > > > diff --git a/src/pacman/sync.c b/src/pacman/sync.c > > index e69ca58..c617e0b 100644 > > --- a/src/pacman/sync.c > > +++ b/src/pacman/sync.c > > @@ -26,6 +26,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -170,6 +171,7 @@ static int sync_cleancache(int level) > > alpm_db_t *db_local = alpm_get_localdb(config->handle); > > alpm_list_t *cachedirs = alpm_option_get_cachedirs(config->handle); > > int ret = 0; > > + regex_t sigreg, dbreg, srcpkgreg; > > > > for(i = cachedirs; i; i = alpm_list_next(i)) { > > printf(_("Cache directory: %s\n"), (const char *)i->data); > > @@ -199,6 +201,10 @@ static int sync_cleancache(int level) > > printf(_("removing all files from cache...\n")); > > } > > > > + regcomp(&sigreg, "\\.sig$", REG_EXTENDED | REG_NEWLINE); > > + regcomp(&dbreg, "\\.db(\\.tar[^[:space:]]*)?$", REG_EXTENDED | REG_NEWLINE); > > + regcomp(&srcpkgreg, "\\.src\\.tar", REG_EXTENDED | REG_NEWLINE); > > + > > for(i = cachedirs; i; i = alpm_list_next(i)) { > > const char *cachedir = i->data; > > DIR *dir = opendir(cachedir); > > @@ -222,6 +228,22 @@ static int sync_cleancache(int level) > > if(strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { > > continue; > > } > > + > > + /* skip signature files - they are removed with their package file */ > > + if(regexec(&sigreg, ent->d_name, 0, 0, 0) == 0) { > > + continue; > > + } > > + > > + /* skip package database within the cache directory */ > > + if(regexec(&dbreg, ent->d_name, 0, 0, 0) == 0) { > > + continue; > > + } > > + > > + /* skip source packages withing the cache directory */ > > + if(regexec(&srcpkgreg, ent->d_name, 0, 0, 0) == 0) { > > + continue; > > + } > > + > > /* build the full filepath */ > > snprintf(path, PATH_MAX, "%s%s", cachedir, ent->d_name); > > > > -- > > 1.7.9.3 > From d at falconindy.com Fri Mar 9 10:18:50 2012 From: d at falconindy.com (Dave Reisner) Date: Fri, 9 Mar 2012 10:18:50 -0500 Subject: [pacman-dev] [PATCH 1/6] makepkg: the rhs in string comparisons should be quoted In-Reply-To: <1331279949-9642-2-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-2-git-send-email-allan@archlinux.org> Message-ID: <20120309151850.GK838@rampage> On Fri, Mar 09, 2012 at 05:59:04PM +1000, Allan McRae wrote: > Signed-off-by: Allan McRae > --- ack. > scripts/makepkg.sh.in | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 8763ffb..601c7e2 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -311,7 +311,7 @@ in_opt_array() { > > local opt > for opt in "$@"; do > - if [[ $opt = $needle ]]; then > + if [[ $opt = "$needle" ]]; then > echo 'y' # Enabled > return > elif [[ $opt = "!$needle" ]]; then > @@ -333,7 +333,7 @@ in_array() { > local needle=$1; shift > local item > for item in "$@"; do > - [[ $item = $needle ]] && return 0 # Found > + [[ $item = "$needle" ]] && return 0 # Found > done > return 1 # Not Found > } > @@ -357,7 +357,7 @@ get_downloadclient() { > local i > for i in "${DLAGENTS[@]}"; do > local handler="${i%%::*}" > - if [[ $proto = $handler ]]; then > + if [[ $proto = "$handler" ]]; then > local agent="${i##*::}" > break > fi > @@ -557,7 +557,7 @@ download_sources() { > local url=$(get_url "$netfile") > > # if we get here, check to make sure it was a URL, else fail > - if [[ $file = $url ]]; then > + if [[ $file = "$url" ]]; then > error "$(gettext "%s was not found in the build directory and is not a URL.")" "$file" > exit 1 # $E_MISSING_FILE > fi > @@ -683,7 +683,7 @@ check_checksums() { > local expectedsum=$(tr '[:upper:]' '[:lower:]' <<< "${integrity_sums[$idx]}") > local realsum="$(openssl dgst -${integ} "$file")" > realsum="${realsum##* }" > - if [[ $expectedsum = $realsum ]]; then > + if [[ $expectedsum = "$realsum" ]]; then > printf -- "$(gettext "Passed")\n" >&2 > else > printf -- "$(gettext "FAILED")\n" >&2 > @@ -842,7 +842,7 @@ extract_sources() { > > local ret=0 > msg2 "$(gettext "Extracting %s with %s")" "$file" "$cmd" > - if [[ $cmd = bsdtar ]]; then > + if [[ $cmd = "bsdtar" ]]; then > $cmd -xf "$file" || ret=$? > else > rm -f "${file%.*}" > @@ -981,7 +981,7 @@ tidy_install() { > msg2 "$(gettext "Purging unwanted files...")" > local pt > for pt in "${PURGE_TARGETS[@]}"; do > - if [[ ${pt} = ${pt//\/} ]]; then > + if [[ ${pt} = "${pt//\/}" ]]; then > find . -type f -name "${pt}" -exec rm -f -- '{}' \; > else > rm -f ${pt} > @@ -1025,7 +1025,7 @@ tidy_install() { > done > fi > > - if [[ $(check_option strip) = y ]]; then > + if [[ $(check_option strip) = "y" ]]; then > msg2 "$(gettext "Stripping unneeded symbols from binaries and libraries...")" > # make sure library stripping variables are defined to prevent excess stripping > [[ -z ${STRIP_SHARED+x} ]] && STRIP_SHARED="-S" > @@ -1207,7 +1207,7 @@ write_pkginfo() { > for it in "${packaging_options[@]}"; do > local ret="$(check_option $it)" > if [[ $ret != "?" ]]; then > - if [[ $ret = y ]]; then > + if [[ $ret = "y" ]]; then > echo "makepkgopt = $it" > else > echo "makepkgopt = !$it" > @@ -1370,7 +1370,7 @@ create_srcpackage() { > > local file > for file in "${source[@]}"; do > - if [[ "$file" == $(get_filename "$file") ]] || (( SOURCEONLY == 2 )); then > + if [[ "$file" = "$(get_filename "$file")" ]] || (( SOURCEONLY == 2 )); then > local absfile > absfile=$(get_filepath "$file") || missing_source_file "$file" > msg2 "$(gettext "Adding %s...")" "${absfile##*/}" > @@ -1580,7 +1580,7 @@ check_sanity() { > known=0 > # check if option matches a known option or its inverse > for kopt in ${packaging_options[@]} ${other_options[@]}; do > - if [[ ${i} = ${kopt} || ${i} = "!${kopt}" ]]; then > + if [[ ${i} = "${kopt}" || ${i} = "!${kopt}" ]]; then > known=1 > fi > done > @@ -1704,7 +1704,7 @@ devel_check() { > # Do not update pkgver if --holdver is set, when building a source package, repackaging, > # reading PKGBUILD from pipe (-f), or if we cannot write to the file (-w) > if (( HOLDVER || SOURCEONLY || REPKG )) || > - [[ ! -f $BUILDFILE || ! -w $BUILDFILE || $BUILDFILE = /dev/stdin ]]; then > + [[ ! -f $BUILDFILE || ! -w $BUILDFILE || $BUILDFILE = "/dev/stdin" ]]; then > return > fi > > -- > 1.7.9.3 > > From d at falconindy.com Fri Mar 9 10:20:00 2012 From: d at falconindy.com (Dave Reisner) Date: Fri, 9 Mar 2012 10:20:00 -0500 Subject: [pacman-dev] [PATCH 2/6] makepkg: use printf rather than echo to output variable In-Reply-To: <1331279949-9642-3-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-3-git-send-email-allan@archlinux.org> Message-ID: <20120309152000.GL838@rampage> On Fri, Mar 09, 2012 at 05:59:05PM +1000, Allan McRae wrote: > Signed-off-by: Allan McRae > --- > scripts/makepkg.sh.in | 62 ++++++++++++++++++++++++------------------------- > 1 file changed, 31 insertions(+), 31 deletions(-) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 601c7e2..384e142 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -211,7 +211,7 @@ get_filepath() { > return 1 > fi > > - echo "$file" > + printf "%s\n" "$file" > } > > # Print 'source not found' error message and exit makepkg > @@ -226,13 +226,13 @@ get_filename() { > # if a filename is specified, use it > local filename="${1%%::*}" > # if it is just an URL, we only keep the last component > - echo "${filename##*/}" > + printf "%s\n" "${filename##*/}" > } > > # extract the URL from a source entry > get_url() { > # strip an eventual filename > - echo "${1#*::}" > + printf "%s\n" "${1#*::}" > } > > ## > @@ -242,9 +242,9 @@ get_url() { > get_full_version() { > if [[ -z $1 ]]; then > if [[ $epoch ]] && (( ! $epoch )); then > - echo $pkgver-$pkgrel > + printf "%s\n" $pkgver-$pkgrel There's a few instances of these var expansions being unquoted. Can we fix that while we're touching these lines? > else > - echo $epoch:$pkgver-$pkgrel > + printf "%s\n" $epoch:$pkgver-$pkgrel > fi > else > for i in pkgver pkgrel epoch; do > @@ -253,9 +253,9 @@ get_full_version() { > [[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\" > done > if (( ! $epoch_override )); then > - echo $pkgver_override-$pkgrel_override > + printf "%s\n" $pkgver_override-$pkgrel_override > else > - echo $epoch_override:$pkgver_override-$pkgrel_override > + printf "%s\n" $epoch_override:$pkgver_override-$pkgrel_override > fi > fi > } > @@ -272,14 +272,14 @@ get_full_version() { > check_option() { > local ret=$(in_opt_array "$1" ${options[@]}) > if [[ $ret != '?' ]]; then > - echo $ret > + printf "%s\n" "$ret" > return > fi > > # fall back to makepkg.conf options > ret=$(in_opt_array "$1" ${OPTIONS[@]}) > if [[ $ret != '?' ]]; then > - echo $ret > + printf "%s\n" "$ret" > return > fi > > @@ -379,7 +379,7 @@ get_downloadclient() { > exit 1 # $E_MISSING_PROGRAM > fi > > - echo "$agent" > + printf "%s\n" "$agent" > } > > download_file() { > @@ -446,7 +446,7 @@ check_deps() { > set -E > > if (( ret == 127 )); then #unresolved deps > - echo "$pmout" > + printf "%s\n" "$pmout" > elif (( ret )); then > error "$(gettext "'%s' returned a fatal error (%i): %s")" "$PACMAN" "$ret" "$pmout" > return "$ret" > @@ -594,9 +594,9 @@ get_integlist() { > done > > if (( ${#integlist[@]} > 0 )); then > - echo ${integlist[@]} > + printf "%s\n" ${integlist[@]} > else > - echo ${INTEGRITY_CHECK[@]} > + printf "%s\n" ${INTEGRITY_CHECK[@]} > fi > } > > @@ -627,7 +627,7 @@ generate_checksums() { > > local ct=0 > local numsrc=${#source[@]} > - echo -n "${integ}sums=(" > + printf "%s" "${integ}sums=(" > > local i > local indent='' > @@ -641,8 +641,8 @@ generate_checksums() { > file="$(get_filepath "$netfile")" || missing_source_file "$netfile" > local sum="$(openssl dgst -${integ} "$file")" > sum=${sum##* } > - (( ct )) && echo -n "$indent" > - echo -n "'$sum'" > + (( ct )) && printf "%s" "$indent" > + printf "%s" "'$sum'" > ct=$(($ct+1)) > (( $ct < $numsrc )) && echo > done > @@ -668,7 +668,7 @@ check_checksums() { > for file in "${source[@]}"; do > local found=1 > file="$(get_filename "$file")" > - echo -n " $file ... " >&2 > + printf "%s" " $file ... " >&2 > > if ! file="$(get_filepath "$file")"; then > printf -- "$(gettext "NOT FOUND")\n" >&2 > @@ -1082,7 +1082,7 @@ find_libdepends() { > if in_array "${soname}" ${depends[@]}; then > if ! in_array "${soname}=${soversion}-${soarch}" ${libdepends[@]}; then > # libfoo.so=1-64 > - echo "${soname}=${soversion}-${soarch}" > + printf "%s" "${soname}=${soversion}-${soarch}" > libdepends=(${libdepends[@]} "${soname}=${soversion}-${soarch}") > fi > fi > @@ -1137,7 +1137,7 @@ find_libprovides() { > fi > done > > - echo ${libprovides[@]} > + printf "%s" ${libprovides[@]} > } > > check_license() { > @@ -1164,15 +1164,15 @@ write_pkginfo() { > echo "# using $(fakeroot -v)" > fi > echo "# $(LC_ALL=C date -u)" > - echo "pkgname = $1" > + printf "pkgname = %s\n" "$1" > (( SPLITPKG )) && echo pkgbase = $pkgbase > echo "pkgver = $(get_full_version)" > - echo "pkgdesc = $pkgdesc" > - echo "url = $url" > - echo "builddate = $builddate" > - echo "packager = $packager" > - echo "size = $size" > - echo "arch = $PKGARCH" > + printf "pkgdesc = %s\n" "$pkgdesc" > + printf "url = %s\n" "$url" > + printf "builddate = %s\n" "$builddate" > + printf "packager = %s\n" "$packager" > + printf "size = %s\n" "$size" > + printf "arch = %s\n" "$PKGARCH" > > [[ $license ]] && printf "license = %s\n" "${license[@]}" > [[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}" > @@ -1200,7 +1200,7 @@ write_pkginfo() { > return 1 > fi > else > - echo "depend = $it" > + printf "depend = %s\n" "$it" > fi > done > > @@ -1208,9 +1208,9 @@ write_pkginfo() { > local ret="$(check_option $it)" > if [[ $ret != "?" ]]; then > if [[ $ret = "y" ]]; then > - echo "makepkgopt = $it" > + printf "makepkgopt = %s\n" "$it" > else > - echo "makepkgopt = !$it" > + printf "makepkgopt = %s\n" "!$it" > fi > fi > done > @@ -1851,7 +1851,7 @@ canonicalize_path() { > pwd -P > ) > else > - echo "$path" > + printf "%s\n" "$path" > fi > } > > @@ -1916,7 +1916,7 @@ There is NO WARRANTY, to the extent permitted by law.\n")" > # determine whether we have gettext; make it a no-op if we do not > if ! type -p gettext >/dev/null; then > gettext() { > - echo "$@" > + printf "%s\n" "$@" > } > fi > > -- > 1.7.9.3 > > From d at falconindy.com Fri Mar 9 10:21:49 2012 From: d at falconindy.com (Dave Reisner) Date: Fri, 9 Mar 2012 10:21:49 -0500 Subject: [pacman-dev] [PATCH 4/6] makepkg: abort when failing to create BUILDDIR In-Reply-To: <1331279949-9642-5-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-5-git-send-email-allan@archlinux.org> Message-ID: <20120309152149.GM838@rampage> On Fri, Mar 09, 2012 at 05:59:07PM +1000, Allan McRae wrote: > Signed-off-by: Allan McRae > --- > scripts/makepkg.sh.in | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 8dd2d39..9cd8af8 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -2052,8 +2052,11 @@ readonly ALL_OFF BOLD BLUE GREEN RED YELLOW > BUILDDIR=${_BUILDDIR:-$BUILDDIR} > BUILDDIR=${BUILDDIR:-$startdir} #default to $startdir if undefined > if [[ ! -d $BUILDDIR ]]; then > - mkdir -p "$BUILDDIR" || > - error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" > + if ! mkdir -p "$BUILDDIR"; then > + error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" Hrmmm, permissions is only one possible reason for mkdir to fail. the manpage for the syscall and library wrapper list a bunch more. Since mkdir will happily report the error for us (with localization), should we just ditch our own possibly-inaccurate error messaging? > + plain "$(gettext "Aborting...")" > + exit 1 > + fi > chmod a-s "$BUILDDIR" > fi > if [[ ! -w $BUILDDIR ]]; then > -- > 1.7.9.3 > > From d at falconindy.com Fri Mar 9 10:23:18 2012 From: d at falconindy.com (Dave Reisner) Date: Fri, 9 Mar 2012 10:23:18 -0500 Subject: [pacman-dev] [PATCH 6/6] makepkg: safely change directories In-Reply-To: <1331279949-9642-7-git-send-email-allan@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-7-git-send-email-allan@archlinux.org> Message-ID: <20120309152318.GN838@rampage> On Fri, Mar 09, 2012 at 05:59:09PM +1000, Allan McRae wrote: > In preparation for the removal of the global error trap we need a > way to ensure changing directories succeeds. Add a "cd_safe" > wrapper that performs the necessary check. > > Signed-off-by: Allan McRae > --- > scripts/makepkg.sh.in | 40 ++++++++++++++++++++++++---------------- > 1 file changed, 24 insertions(+), 16 deletions(-) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 534f6f8..f21c638 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -874,6 +874,14 @@ error_function() { > exit 2 # $E_BUILD_FAILED > } > > +cd_safe() { > + if ! cd "$1"; then Do we want to write stdout to /dev/null here? It _should_ be quiet since we unset CDPATH early on... > + error "$(gettext "Failed to change to directory %s")" "$1" > + plain "$(gettext "Aborting...")" > + exit 1 > + fi > +} > + > run_function() { > if [[ -z $1 ]]; then > return 1 > @@ -891,7 +899,7 @@ run_function() { > fi > > msg "$(gettext "Starting %s()...")" "$pkgfunc" > - cd "$srcdir" > + cd_safe "$srcdir" > > # ensure all necessary build variables are exported > export CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST > @@ -969,7 +977,7 @@ run_package() { > } > > tidy_install() { > - cd "$pkgdir" > + cd_safe "$pkgdir" > msg "$(gettext "Tidying install...")" > > if [[ $(check_option docs) = "n" && -n ${DOC_DIRS[*]} ]]; then > @@ -1219,7 +1227,7 @@ write_pkginfo() { > } > > check_package() { > - cd "$pkgdir" > + cd_safe "$pkgdir" > > # check existence of backup files > local file > @@ -1248,7 +1256,7 @@ create_package() { > > check_package > > - cd "$pkgdir" > + cd_safe "$pkgdir" > msg "$(gettext "Creating package...")" > > local nameofpkg > @@ -1407,7 +1415,7 @@ create_srcpackage() { > > # tar it up > msg2 "$(gettext "Compressing source package...")" > - cd "${srclinks}" > + cd_safe "${srclinks}" > if ! bsdtar -c${TAR_OPT}Lf "$pkg_file" ${pkgbase}; then > error "$(gettext "Failed to create source package file.")" > exit 1 # TODO: error code > @@ -1423,7 +1431,7 @@ create_srcpackage() { > warning "$(gettext "Failed to create symlink to source package file.")" > fi > > - cd "${startdir}" > + cd_safe "${startdir}" > rm -rf "${srclinks}" > } > > @@ -1757,7 +1765,7 @@ devel_check() { > fi > msg "$(gettext "Determining latest %s revision...")" 'hg' > if [[ -d ./src/$_hgrepo ]] ; then > - cd ./src/$_hgrepo > + cd_safe ./src/$_hgrepo > local ret=0 > hg pull || ret=$? > if (( ! ret )); then > @@ -1768,10 +1776,10 @@ devel_check() { > else > [[ ! -d ./src/ ]] && mkdir ./src/ > hg clone $_hgroot/$_hgrepo ./src/$_hgrepo > - cd ./src/$_hgrepo > + cd_safe ./src/$_hgrepo > fi > newpkgver=$(hg tip --template "{rev}") > - cd ../../ > + cd_safe ../../ > fi > > if [[ -n $newpkgver ]]; then > @@ -1847,7 +1855,7 @@ canonicalize_path() { > > if [[ -d $path ]]; then > ( > - cd "$path" > + cd_safe "$path" > pwd -P > ) > else > @@ -2171,7 +2179,7 @@ fi > if (( GENINTEG )); then > mkdir -p "$srcdir" > chmod a-s "$srcdir" > - cd "$srcdir" > + cd_safe "$srcdir" > download_sources > generate_checksums > exit 0 # $E_OK > @@ -2321,14 +2329,14 @@ if (( SOURCEONLY )); then > # Get back to our src directory so we can begin with sources. > mkdir -p "$srcdir" > chmod a-s "$srcdir" > - cd "$srcdir" > + cd_safe "$srcdir" > if ( (( ! SKIPCHECKSUMS )) || \ > ( (( ! SKIPPGPCHECK )) && source_has_signatures ) ) || \ > (( SOURCEONLY == 2 )); then > download_sources > fi > check_source_integrity > - cd "$startdir" > + cd_safe "$startdir" > > # if we are root or if fakeroot is not enabled, then we don't use it > if [[ $(check_buildenv fakeroot) != "y" ]] || (( EUID == 0 )); then > @@ -2384,7 +2392,7 @@ umask 0022 > # get back to our src directory so we can begin with sources > mkdir -p "$srcdir" > chmod a-s "$srcdir" > -cd "$srcdir" > +cd_safe "$srcdir" > > if (( NOEXTRACT )); then > warning "$(gettext "Skipping source retrieval -- using existing %s tree")" "src/" > @@ -2420,7 +2428,7 @@ else > fi > mkdir -p "$pkgdir" > chmod a-s "$pkgdir" > - cd "$startdir" > + cd_safe "$startdir" > > # if we are root or if fakeroot is not enabled, then we don't use it > if [[ $(check_buildenv fakeroot) != "y" ]] || (( EUID == 0 )); then > @@ -2450,7 +2458,7 @@ else > devel_update > (( BUILDFUNC )) && run_build > (( CHECKFUNC )) && run_check > - cd "$startdir" > + cd_safe "$startdir" > fi > > enter_fakeroot > -- > 1.7.9.3 > > From dan at archlinux.org Fri Mar 9 14:44:44 2012 From: dan at archlinux.org (Dan McGee) Date: Fri, 9 Mar 2012 13:44:44 -0600 Subject: [pacman-dev] [PATCH] Remove unnecessary path check from local database Message-ID: <1331322284-27767-1-git-send-email-dan@archlinux.org> This removes a call to _alpm_local_db_pkgpath() as well as an access() call when reading the local database. This appears to be code from 2006 that has stuck around. We don't need it because: 1) We never use this path except to check it via access(); however, we are already in a readdir() loop so it exists, or at least did at the time of the call. 2) The fopen() and other calls will fail on accessing the database files anyway, and we need to check those for errors. Signed-off-by: Dan McGee --- lib/libalpm/be_local.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 51721d1..16c794e 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -405,7 +405,7 @@ static int local_db_populate(alpm_db_t *db) rewinddir(dbdir); } if(est_count >= 2) { - /* subtract the two extra pointers to get # of children */ + /* subtract the '.' and '..' pointers to get # of children */ est_count -= 2; } @@ -526,7 +526,6 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) { FILE *fp = NULL; char line[1024]; - char *pkgpath; alpm_db_t *db = info->origin_data.db; /* bitmask logic here: @@ -545,18 +544,10 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) return -1; } - _alpm_log(db->handle, ALPM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n", + _alpm_log(db->handle, ALPM_LOG_FUNCTION, + "loading package data for %s : level=0x%x\n", info->name, inforeq); - pkgpath = _alpm_local_db_pkgpath(db, info, NULL); - if(!pkgpath || access(pkgpath, F_OK)) { - /* directory doesn't exist or can't be opened */ - _alpm_log(db->handle, ALPM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n", - info->name, info->version, db->treename); - goto error; - } - free(pkgpath); - /* clear out 'line', to be certain - and to make valgrind happy */ memset(line, 0, sizeof(line)); -- 1.7.9.3 From dan at archlinux.org Fri Mar 9 15:11:08 2012 From: dan at archlinux.org (Dan McGee) Date: Fri, 9 Mar 2012 14:11:08 -0600 Subject: [pacman-dev] [PATCH] Extract a write_deps function from local database writing Message-ID: <1331323868-9261-1-git-send-email-dan@archlinux.org> This reduces a lot of code duplication in the write function, which cleans it up a bit. Signed-off-by: Dan McGee --- lib/libalpm/be_local.c | 67 ++++++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 16c794e..7cce022 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -749,6 +749,22 @@ int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info) return retval; } +void write_deps(FILE *fp, const char *header, alpm_list_t *deplist) +{ + alpm_list_t *lp; + if(!deplist) { + return; + } + fputs(header, fp); + fputc('\n', fp); + for(lp = deplist; lp; lp = lp->next) { + char *depstring = alpm_dep_compute_string(lp->data); + fprintf(fp, "%s\n", depstring); + free(depstring); + } + fputc('\n', fp); +} + int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq) { FILE *fp = NULL; @@ -790,15 +806,6 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq } fprintf(fp, "\n"); } - if(info->replaces) { - fputs("%REPLACES%\n", fp); - for(lp = info->replaces; lp; lp = lp->next) { - char *depstring = alpm_dep_compute_string(lp->data); - fprintf(fp, "%s\n", depstring); - free(depstring); - } - fprintf(fp, "\n"); - } if(info->url) { fprintf(fp, "%%URL%%\n" "%s\n\n", info->url); @@ -851,42 +858,12 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq } fprintf(fp, "\n"); } - if(info->depends) { - fputs("%DEPENDS%\n", fp); - for(lp = info->depends; lp; lp = lp->next) { - char *depstring = alpm_dep_compute_string(lp->data); - fprintf(fp, "%s\n", depstring); - free(depstring); - } - fprintf(fp, "\n"); - } - if(info->optdepends) { - fputs("%OPTDEPENDS%\n", fp); - for(lp = info->optdepends; lp; lp = lp->next) { - char *optstring = alpm_dep_compute_string(lp->data); - fprintf(fp, "%s\n", optstring); - free(optstring); - } - fprintf(fp, "\n"); - } - if(info->conflicts) { - fputs("%CONFLICTS%\n", fp); - for(lp = info->conflicts; lp; lp = lp->next) { - char *depstring = alpm_dep_compute_string(lp->data); - fprintf(fp, "%s\n", depstring); - free(depstring); - } - fprintf(fp, "\n"); - } - if(info->provides) { - fputs("%PROVIDES%\n", fp); - for(lp = info->provides; lp; lp = lp->next) { - char *depstring = alpm_dep_compute_string(lp->data); - fprintf(fp, "%s\n", depstring); - free(depstring); - } - fprintf(fp, "\n"); - } + + write_deps(fp, "%REPLACES%", info->replaces); + write_deps(fp, "%DEPENDS%", info->depends); + write_deps(fp, "%OPTDEPENDS%", info->optdepends); + write_deps(fp, "%CONFLICTS%", info->conflicts); + write_deps(fp, "%PROVIDES%", info->provides); fclose(fp); fp = NULL; -- 1.7.9.3 From d at falconindy.com Fri Mar 9 15:16:01 2012 From: d at falconindy.com (Dave Reisner) Date: Fri, 9 Mar 2012 15:16:01 -0500 Subject: [pacman-dev] [PATCH] Extract a write_deps function from local database writing In-Reply-To: <1331323868-9261-1-git-send-email-dan@archlinux.org> References: <1331323868-9261-1-git-send-email-dan@archlinux.org> Message-ID: <20120309201601.GO838@rampage> On Fri, Mar 09, 2012 at 02:11:08PM -0600, Dan McGee wrote: > This reduces a lot of code duplication in the write function, which > cleans it up a bit. > > Signed-off-by: Dan McGee > --- > lib/libalpm/be_local.c | 67 ++++++++++++++++-------------------------------- > 1 file changed, 22 insertions(+), 45 deletions(-) > > diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c > index 16c794e..7cce022 100644 > --- a/lib/libalpm/be_local.c > +++ b/lib/libalpm/be_local.c > @@ -749,6 +749,22 @@ int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info) > return retval; > } > > +void write_deps(FILE *fp, const char *header, alpm_list_t *deplist) static? > +{ > + alpm_list_t *lp; > + if(!deplist) { > + return; > + } > + fputs(header, fp); > + fputc('\n', fp); > + for(lp = deplist; lp; lp = lp->next) { > + char *depstring = alpm_dep_compute_string(lp->data); > + fprintf(fp, "%s\n", depstring); if you're going to use the fputs/fputc combo above for the header, why not here as well? > + free(depstring); > + } > + fputc('\n', fp); > +} > + > int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq) > { > FILE *fp = NULL; > @@ -790,15 +806,6 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq > } > fprintf(fp, "\n"); > } > - if(info->replaces) { > - fputs("%REPLACES%\n", fp); > - for(lp = info->replaces; lp; lp = lp->next) { > - char *depstring = alpm_dep_compute_string(lp->data); > - fprintf(fp, "%s\n", depstring); > - free(depstring); > - } > - fprintf(fp, "\n"); > - } > if(info->url) { > fprintf(fp, "%%URL%%\n" > "%s\n\n", info->url); > @@ -851,42 +858,12 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq > } > fprintf(fp, "\n"); > } > - if(info->depends) { > - fputs("%DEPENDS%\n", fp); > - for(lp = info->depends; lp; lp = lp->next) { > - char *depstring = alpm_dep_compute_string(lp->data); > - fprintf(fp, "%s\n", depstring); > - free(depstring); > - } > - fprintf(fp, "\n"); > - } > - if(info->optdepends) { > - fputs("%OPTDEPENDS%\n", fp); > - for(lp = info->optdepends; lp; lp = lp->next) { > - char *optstring = alpm_dep_compute_string(lp->data); > - fprintf(fp, "%s\n", optstring); > - free(optstring); > - } > - fprintf(fp, "\n"); > - } > - if(info->conflicts) { > - fputs("%CONFLICTS%\n", fp); > - for(lp = info->conflicts; lp; lp = lp->next) { > - char *depstring = alpm_dep_compute_string(lp->data); > - fprintf(fp, "%s\n", depstring); > - free(depstring); > - } > - fprintf(fp, "\n"); > - } > - if(info->provides) { > - fputs("%PROVIDES%\n", fp); > - for(lp = info->provides; lp; lp = lp->next) { > - char *depstring = alpm_dep_compute_string(lp->data); > - fprintf(fp, "%s\n", depstring); > - free(depstring); > - } > - fprintf(fp, "\n"); > - } > + > + write_deps(fp, "%REPLACES%", info->replaces); > + write_deps(fp, "%DEPENDS%", info->depends); > + write_deps(fp, "%OPTDEPENDS%", info->optdepends); > + write_deps(fp, "%CONFLICTS%", info->conflicts); > + write_deps(fp, "%PROVIDES%", info->provides); > > fclose(fp); > fp = NULL; > -- > 1.7.9.3 > > From dpmcgee at gmail.com Fri Mar 9 15:26:13 2012 From: dpmcgee at gmail.com (Dan McGee) Date: Fri, 9 Mar 2012 14:26:13 -0600 Subject: [pacman-dev] [PATCH] Extract a write_deps function from local database writing In-Reply-To: <20120309201601.GO838@rampage> References: <1331323868-9261-1-git-send-email-dan@archlinux.org> <20120309201601.GO838@rampage> Message-ID: On Fri, Mar 9, 2012 at 2:16 PM, Dave Reisner wrote: > On Fri, Mar 09, 2012 at 02:11:08PM -0600, Dan McGee wrote: >> This reduces a lot of code duplication in the write function, which >> cleans it up a bit. >> >> Signed-off-by: Dan McGee >> --- >> ?lib/libalpm/be_local.c | ? 67 ++++++++++++++++-------------------------------- >> ?1 file changed, 22 insertions(+), 45 deletions(-) >> >> diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c >> index 16c794e..7cce022 100644 >> --- a/lib/libalpm/be_local.c >> +++ b/lib/libalpm/be_local.c >> @@ -749,6 +749,22 @@ int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info) >> ? ? ? return retval; >> ?} >> >> +void write_deps(FILE *fp, const char *header, alpm_list_t *deplist) > > static? Yes, good catch, thanks. >> +{ >> + ? ? alpm_list_t *lp; >> + ? ? if(!deplist) { >> + ? ? ? ? ? ? return; >> + ? ? } >> + ? ? fputs(header, fp); >> + ? ? fputc('\n', fp); >> + ? ? for(lp = deplist; lp; lp = lp->next) { >> + ? ? ? ? ? ? char *depstring = alpm_dep_compute_string(lp->data); >> + ? ? ? ? ? ? fprintf(fp, "%s\n", depstring); > > if you're going to use the fputs/fputc combo above for the header, why > not here as well? Agreed; I have another patch that converts a number of fprintf() calls to simpler fputs/fputc calls that don't require %% escaping. -Dan From dan at archlinux.org Fri Mar 9 15:26:46 2012 From: dan at archlinux.org (Dan McGee) Date: Fri, 9 Mar 2012 14:26:46 -0600 Subject: [pacman-dev] [PATCH] Prefer fputs/fputc over fprintf when writing local database In-Reply-To: References: Message-ID: <1331324806-31551-1-git-send-email-dan@archlinux.org> Using fputs should be faster as no format string parsing is required. It also prevents silly errors related to unescaped '%' signs, and removes the need to double them up in a lot of places. Signed-off-by: Dan McGee --- lib/libalpm/be_local.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 55d949f..9090c81 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -759,7 +759,8 @@ static void write_deps(FILE *fp, const char *header, alpm_list_t *deplist) fputc('\n', fp); for(lp = deplist; lp; lp = lp->next) { char *depstring = alpm_dep_compute_string(lp->data); - fprintf(fp, "%s\n", depstring); + fputs(depstring, fp); + fputc('\n', fp); free(depstring); } fputc('\n', fp); @@ -802,9 +803,10 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq if(info->groups) { fputs("%GROUPS%\n", fp); for(lp = info->groups; lp; lp = lp->next) { - fprintf(fp, "%s\n", (char *)lp->data); + fputs(lp->data, fp); + fputc('\n', fp); } - fprintf(fp, "\n"); + fputc('\n', fp); } if(info->url) { fprintf(fp, "%%URL%%\n" @@ -813,9 +815,10 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq if(info->licenses) { fputs("%LICENSE%\n", fp); for(lp = info->licenses; lp; lp = lp->next) { - fprintf(fp, "%s\n", (char *)lp->data); + fputs(lp->data, fp); + fputc('\n', fp); } - fprintf(fp, "\n"); + fputc('\n', fp); } if(info->arch) { fprintf(fp, "%%ARCH%%\n" @@ -856,7 +859,7 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq if(info->validation & ALPM_PKG_VALIDATION_SIGNATURE) { fputs("pgp\n", fp); } - fprintf(fp, "\n"); + fputc('\n', fp); } write_deps(fp, "%REPLACES%", info->replaces); @@ -885,20 +888,21 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq free(path); if(info->files.count) { size_t i; - fprintf(fp, "%%FILES%%\n"); + fputs("%FILES%\n", fp); for(i = 0; i < info->files.count; i++) { const alpm_file_t *file = info->files.files + i; - fprintf(fp, "%s\n", file->name); + fputs(file->name, fp); + fputc('\n', fp); } - fprintf(fp, "\n"); + fputc('\n', fp); } if(info->backup) { - fprintf(fp, "%%BACKUP%%\n"); + fputs("%BACKUP%\n", fp); for(lp = info->backup; lp; lp = lp->next) { const alpm_backup_t *backup = lp->data; fprintf(fp, "%s\t%s\n", backup->name, backup->hash); } - fprintf(fp, "\n"); + fputc('\n', fp); } fclose(fp); fp = NULL; -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 18:32:04 2012 From: allan at archlinux.org (Allan McRae) Date: Sat, 10 Mar 2012 09:32:04 +1000 Subject: [pacman-dev] [PATCH 3/6] makepkg: prevent issues with files starting with a hyphen In-Reply-To: <20120309140107.GI838@rampage> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-4-git-send-email-allan@archlinux.org> <20120309140107.GI838@rampage> Message-ID: <4F5A92F4.1040409@archlinux.org> On 10/03/12 00:01, Dave Reisner wrote: > On Fri, Mar 09, 2012 at 05:59:06PM +1000, Allan McRae wrote: >> Most places in makepkg deal with full file paths, but a few use the >> file name only. Protect from potential issues when a file name >> starts with a hyphen. > > How sure are we that these will always be relative paths and never ever > absolute? I'm not sure what you are meaning there? Are you asking why I did not fix the ones I determined to use the absolute path? In all other cases the files are either prefixed $srcdir, $pkgdir, $startdir or are from get_filepath which returns a full path. >> Signed-off-by: Allan McRae >> --- >> scripts/makepkg.sh.in | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >> index 384e142..8dd2d39 100644 >> --- a/scripts/makepkg.sh.in >> +++ b/scripts/makepkg.sh.in >> @@ -833,7 +833,7 @@ extract_sources() { >> esac ;; >> *) >> # See if bsdtar can recognize the file >> - if bsdtar -tf "$file" -q '*' &>/dev/null; then >> + if bsdtar -tf "./$file" -q '*' &>/dev/null; then > > not necessary. "$file" is an argument to the -f flag, so we don't need > to work around this: > > $ bsdtar -czf --foo.tar.gz ~/.bash* > $ ls -l -- --foo.tar.gz > -rw-r--r-- 1 noclaf users 57856 Mar 9 08:52 --foo.tar.gz Ah... good point... >> cmd="bsdtar" >> else >> continue >> @@ -843,10 +843,10 @@ extract_sources() { >> local ret=0 >> msg2 "$(gettext "Extracting %s with %s")" "$file" "$cmd" >> if [[ $cmd = "bsdtar" ]]; then >> - $cmd -xf "$file" || ret=$? >> + $cmd -xf "./$file" || ret=$? > > same here. > >> else >> - rm -f "${file%.*}" >> - $cmd -dcf "$file" > "${file%.*}" || ret=$? >> + rm -f -- "${file%.*}" >> + $cmd -dcf "./$file" > "${file%.*}" || ret=$? > > same here (the rm wants it, though) > >> fi >> if (( ret )); then >> error "$(gettext "Failed to extract %s")" "$file" >> @@ -974,7 +974,7 @@ tidy_install() { >> >> if [[ $(check_option docs) = "n" && -n ${DOC_DIRS[*]} ]]; then >> msg2 "$(gettext "Removing doc files...")" >> - rm -rf ${DOC_DIRS[@]} >> + rm -rf -- ${DOC_DIRS[@]} > > i hate that we can't quote this. > >> fi >> >> if [[ $(check_option purge) = "y" && -n ${PURGE_TARGETS[*]} ]]; then >> @@ -1001,7 +1001,7 @@ tidy_install() { >> find ${MAN_DIRS[@]} -lname "$file" 2>/dev/null | >> while read link ; do >> rm -f "$link" "${link}.gz" >> - ln -s "${file}.gz" "${link}.gz" >> + ln -s -- "${file}.gz" "${link}.gz" > > No love for the rm? I admit it would be an extremely nonstandard case, > but the same applies for the ln call. Look at what is being rm'ed and what is being ln'ed. One is a full path. >> done >> >> # check file still exists (potentially already compressed due to hardlink) >> -- >> 1.7.9.3 >> >> > > > From allan at archlinux.org Fri Mar 9 18:36:59 2012 From: allan at archlinux.org (Allan McRae) Date: Sat, 10 Mar 2012 09:36:59 +1000 Subject: [pacman-dev] [PATCH 6/6] makepkg: safely change directories In-Reply-To: <20120309152318.GN838@rampage> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-7-git-send-email-allan@archlinux.org> <20120309152318.GN838@rampage> Message-ID: <4F5A941B.9090405@archlinux.org> On 10/03/12 01:23, Dave Reisner wrote: > On Fri, Mar 09, 2012 at 05:59:09PM +1000, Allan McRae wrote: >> In preparation for the removal of the global error trap we need a >> way to ensure changing directories succeeds. Add a "cd_safe" >> wrapper that performs the necessary check. >> >> Signed-off-by: Allan McRae >> --- >> scripts/makepkg.sh.in | 40 ++++++++++++++++++++++++---------------- >> 1 file changed, 24 insertions(+), 16 deletions(-) >> >> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >> index 534f6f8..f21c638 100644 >> --- a/scripts/makepkg.sh.in >> +++ b/scripts/makepkg.sh.in >> @@ -874,6 +874,14 @@ error_function() { >> exit 2 # $E_BUILD_FAILED >> } >> >> +cd_safe() { >> + if ! cd "$1"; then > > Do we want to write stdout to /dev/null here? It _should_ be quiet since > we unset CDPATH early on... I am happy not doing that at the moment, mainly because it was never there before and I would like to know if something breaks our assumption that it should be quiet... From allan at archlinux.org Fri Mar 9 20:04:20 2012 From: allan at archlinux.org (Allan McRae) Date: Sat, 10 Mar 2012 11:04:20 +1000 Subject: [pacman-dev] [PATCH v2] Skip special files when cleaning package cache Message-ID: <1331341460-10662-1-git-send-email-allan@archlinux.org> Ignore *.sig, *.db*, and *.src.tar* when cleaning the package cache. Fixes FS#25166. Signed-off-by: Allan McRae --- Why didn't I know about fnmatch before... so much easier than the regex stuff I was doing before! src/pacman/sync.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index e69ca58..1df2a6f 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -222,6 +223,23 @@ static int sync_cleancache(int level) if(strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } + + /* skip signature files - they are removed with their package file */ + if(fnmatch("*.sig", ent->d_name, 0) == 0) { + continue; + } + + /* skip package database within the cache directory */ + if(fnmatch("*.db*", ent->d_name, 0) == 0) { + continue; + } + + /* skip source packages withing the cache directory */ + if(fnmatch("*.src.tar*", ent->d_name, 0) == 0) { + continue; + } + + /* build the full filepath */ snprintf(path, PATH_MAX, "%s%s", cachedir, ent->d_name); -- 1.7.9.3 From allan at archlinux.org Fri Mar 9 20:43:46 2012 From: allan at archlinux.org (Allan McRae) Date: Sat, 10 Mar 2012 11:43:46 +1000 Subject: [pacman-dev] [PATCH 1/2] makepkg: fix extraction of soname in find_libdepends In-Reply-To: <1330892384-27104-1-git-send-email-bluewind@xinu.at> References: <1330892384-27104-1-git-send-email-bluewind@xinu.at> Message-ID: <4F5AB1D2.7060303@archlinux.org> On 05/03/12 06:19, Florian Pritz wrote: > libperl.so results in soname="libperl.so.so" which is wrong. > > This returns the correct string: "libperl.so" > > Fix-by: Dave Reisner > Signed-off-by: Florian Pritz > --- > This should be applied to both master and maint. Ugh.. I didn't review this but the patch is entirely broken on the first file I tried it on. > scripts/makepkg.sh.in | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 6e7a556..9301730 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -1071,7 +1071,7 @@ find_libdepends() { > for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') > do > # extract the library name: libfoo.so > - soname="${sofile%%\.so\.*}.so" > + soname="${sofile%.so?(+(.+([0-9])))}".so Broken: > LC_ALL=C readelf -d /usr/lib/libalpm.so.7.0.2 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p' libcurl.so.4 libarchive.so.12 libcrypto.so.1.0.0 libgpgme.so.11 libc.so.6 > sofile="libcrypto.so.1.0.0" > echo "${sofile%.so?(+(.+([0-9])))}".so libcrypto.so.1.0.0.so Why not just: soname="${sofile%%\.so*}.so" I suppose that would not correctly work for... foo.so.bar.so.9 Allan From allan at archlinux.org Fri Mar 9 20:55:33 2012 From: allan at archlinux.org (Allan McRae) Date: Sat, 10 Mar 2012 11:55:33 +1000 Subject: [pacman-dev] [PATCH 1/2] makepkg: fix extraction of soname in find_libdepends In-Reply-To: <4F5AB1D2.7060303@archlinux.org> References: <1330892384-27104-1-git-send-email-bluewind@xinu.at> <4F5AB1D2.7060303@archlinux.org> Message-ID: <4F5AB495.8070900@archlinux.org> On 10/03/12 11:43, Allan McRae wrote: > On 05/03/12 06:19, Florian Pritz wrote: >> libperl.so results in soname="libperl.so.so" which is wrong. >> >> This returns the correct string: "libperl.so" >> >> Fix-by: Dave Reisner >> Signed-off-by: Florian Pritz >> --- >> This should be applied to both master and maint. > > Ugh.. I didn't review this but the patch is entirely broken on the > first file I tried it on. Ignore me... I was testing without extglob enabled. From allan at archlinux.org Sat Mar 10 06:13:30 2012 From: allan at archlinux.org (Allan McRae) Date: Sat, 10 Mar 2012 21:13:30 +1000 Subject: [pacman-dev] [PATCH 2/6] makepkg: use printf rather than echo to output variable In-Reply-To: <20120309152000.GL838@rampage> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-3-git-send-email-allan@archlinux.org> <20120309152000.GL838@rampage> Message-ID: <4F5B375A.4050103@archlinux.org> On 10/03/12 01:20, Dave Reisner wrote: > On Fri, Mar 09, 2012 at 05:59:05PM +1000, Allan McRae wrote: >> Signed-off-by: Allan McRae >> --- >> scripts/makepkg.sh.in | 62 ++++++++++++++++++++++++------------------------- >> 1 file changed, 31 insertions(+), 31 deletions(-) >> >> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >> index 601c7e2..384e142 100644 >> >> ## >> @@ -242,9 +242,9 @@ get_url() { >> get_full_version() { >> if [[ -z $1 ]]; then >> if [[ $epoch ]] && (( ! $epoch )); then >> - echo $pkgver-$pkgrel >> + printf "%s\n" $pkgver-$pkgrel > > There's a few instances of these var expansions being unquoted. Can we > fix that while we're touching these lines? > Done, and throughout makepkg. On my working branch. Allan From allan at archlinux.org Sat Mar 10 06:17:52 2012 From: allan at archlinux.org (Allan McRae) Date: Sat, 10 Mar 2012 21:17:52 +1000 Subject: [pacman-dev] [PATCH 4/6] makepkg: abort when failing to create BUILDDIR In-Reply-To: <20120309152149.GM838@rampage> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-5-git-send-email-allan@archlinux.org> <20120309152149.GM838@rampage> Message-ID: <4F5B3860.5050502@archlinux.org> On 10/03/12 01:21, Dave Reisner wrote: > On Fri, Mar 09, 2012 at 05:59:07PM +1000, Allan McRae wrote: >> Signed-off-by: Allan McRae >> --- >> scripts/makepkg.sh.in | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >> index 8dd2d39..9cd8af8 100644 >> --- a/scripts/makepkg.sh.in >> +++ b/scripts/makepkg.sh.in >> @@ -2052,8 +2052,11 @@ readonly ALL_OFF BOLD BLUE GREEN RED YELLOW >> BUILDDIR=${_BUILDDIR:-$BUILDDIR} >> BUILDDIR=${BUILDDIR:-$startdir} #default to $startdir if undefined >> if [[ ! -d $BUILDDIR ]]; then >> - mkdir -p "$BUILDDIR" || >> - error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" >> + if ! mkdir -p "$BUILDDIR"; then >> + error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" > > Hrmmm, permissions is only one possible reason for mkdir to fail. the > manpage for the syscall and library wrapper list a bunch more. Since > mkdir will happily report the error for us (with localization), should > we just ditch our own possibly-inaccurate error messaging? > I guess mkdir is one of the functions we want a safe wrapper for and we could have a generic "Failed to create directory: %s" type message there. So I will just fix the bug for now under the assumption a bigger fix is coming... Allan From dpmcgee at gmail.com Mon Mar 12 11:24:45 2012 From: dpmcgee at gmail.com (Dan McGee) Date: Mon, 12 Mar 2012 11:24:45 -0400 Subject: [pacman-dev] [PATCH 3/6] makepkg: prevent issues with files starting with a hyphen In-Reply-To: <20120309140107.GI838@rampage> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-4-git-send-email-allan@archlinux.org> <20120309140107.GI838@rampage> Message-ID: On Fri, Mar 9, 2012 at 9:01 AM, Dave Reisner wrote: > On Fri, Mar 09, 2012 at 05:59:06PM +1000, Allan McRae wrote: >> Most places in makepkg deal with full file paths, but a few use the >> file name only. ?Protect from potential issues when a file name >> starts with a hyphen. > > How sure are we that these will always be relative paths and never ever > absolute? > >> Signed-off-by: Allan McRae >> --- >> ?scripts/makepkg.sh.in | ? 12 ++++++------ >> ?1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >> index 384e142..8dd2d39 100644 >> --- a/scripts/makepkg.sh.in >> +++ b/scripts/makepkg.sh.in >> @@ -833,7 +833,7 @@ extract_sources() { >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? esac ;; >> ? ? ? ? ? ? ? ? ? ? ? *) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? # See if bsdtar can recognize the file >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? if bsdtar -tf "$file" -q '*' &>/dev/null; then >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? if bsdtar -tf "./$file" -q '*' &>/dev/null; then > > not necessary. "$file" is an argument to the -f flag, so we don't need > to work around this: > > ?$ bsdtar -czf --foo.tar.gz ~/.bash* > ?$ ls -l -- --foo.tar.gz > ?-rw-r--r-- ?1 noclaf users ? 57856 Mar ?9 08:52 --foo.tar.gz I would definitely prefer to not have to do this, or at least use the -- option in preference to file path manipulation. However, I don't know that we could get away with that in all cases you fixed here. I do agree with Dave on the -f option though- I've never seen a tar program allow the argument for that to come anywhere except directly after the flag. -Dan From thomas at archlinux.org Mon Mar 12 11:40:38 2012 From: thomas at archlinux.org (=?ISO-8859-15?Q?Thomas_B=E4chler?=) Date: Mon, 12 Mar 2012 16:40:38 +0100 Subject: [pacman-dev] [PATCH 3/6] makepkg: prevent issues with files starting with a hyphen In-Reply-To: <20120309140107.GI838@rampage> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-4-git-send-email-allan@archlinux.org> <20120309140107.GI838@rampage> Message-ID: <4F5E18F6.6010500@archlinux.org> Am 09.03.2012 15:01, schrieb Dave Reisner: >> @@ -974,7 +974,7 @@ tidy_install() { >> >> if [[ $(check_option docs) = "n" && -n ${DOC_DIRS[*]} ]]; then >> msg2 "$(gettext "Removing doc files...")" >> - rm -rf ${DOC_DIRS[@]} >> + rm -rf -- ${DOC_DIRS[@]} > > i hate that we can't quote this. We can't? Why? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From d at falconindy.com Mon Mar 12 11:55:51 2012 From: d at falconindy.com (Dave Reisner) Date: Mon, 12 Mar 2012 11:55:51 -0400 Subject: [pacman-dev] [PATCH 3/6] makepkg: prevent issues with files starting with a hyphen In-Reply-To: <4F5E18F6.6010500@archlinux.org> References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-4-git-send-email-allan@archlinux.org> <20120309140107.GI838@rampage> <4F5E18F6.6010500@archlinux.org> Message-ID: <20120312155551.GS838@rampage> On Mon, Mar 12, 2012 at 04:40:38PM +0100, Thomas B?chler wrote: > Am 09.03.2012 15:01, schrieb Dave Reisner: > >> @@ -974,7 +974,7 @@ tidy_install() { > >> > >> if [[ $(check_option docs) = "n" && -n ${DOC_DIRS[*]} ]]; then > >> msg2 "$(gettext "Removing doc files...")" > >> - rm -rf ${DOC_DIRS[@]} > >> + rm -rf -- ${DOC_DIRS[@]} > > > > i hate that we can't quote this. > > We can't? Why? > Check out /etc/makepkg.conf. We put globs in DOC_DIRS, and we want them to expand when they're passed to find. It's "luck" that they don't expand. You could definitely break this if you created the right file hierarchy in the build directory, forcing the glob to expand at the time when /etc/makepkg.conf is sourced. d From allan at archlinux.org Mon Mar 12 12:13:43 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 02:13:43 +1000 Subject: [pacman-dev] [PATCH 3/6] makepkg: prevent issues with files starting with a hyphen In-Reply-To: References: <1331279949-9642-1-git-send-email-allan@archlinux.org> <1331279949-9642-4-git-send-email-allan@archlinux.org> <20120309140107.GI838@rampage> Message-ID: <4F5E20B7.1020203@archlinux.org> On 13/03/12 01:24, Dan McGee wrote: > On Fri, Mar 9, 2012 at 9:01 AM, Dave Reisner wrote: >> On Fri, Mar 09, 2012 at 05:59:06PM +1000, Allan McRae wrote: >>> Most places in makepkg deal with full file paths, but a few use the >>> file name only. Protect from potential issues when a file name >>> starts with a hyphen. >> >> How sure are we that these will always be relative paths and never ever >> absolute? >> >>> Signed-off-by: Allan McRae >>> --- >>> scripts/makepkg.sh.in | 12 ++++++------ >>> 1 file changed, 6 insertions(+), 6 deletions(-) >>> >>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >>> index 384e142..8dd2d39 100644 >>> --- a/scripts/makepkg.sh.in >>> +++ b/scripts/makepkg.sh.in >>> @@ -833,7 +833,7 @@ extract_sources() { >>> esac ;; >>> *) >>> # See if bsdtar can recognize the file >>> - if bsdtar -tf "$file" -q '*' &>/dev/null; then >>> + if bsdtar -tf "./$file" -q '*' &>/dev/null; then >> >> not necessary. "$file" is an argument to the -f flag, so we don't need >> to work around this: >> >> $ bsdtar -czf --foo.tar.gz ~/.bash* >> $ ls -l -- --foo.tar.gz >> -rw-r--r-- 1 noclaf users 57856 Mar 9 08:52 --foo.tar.gz > > I would definitely prefer to not have to do this, or at least use the > -- option in preference to file path manipulation. However, I don't > know that we could get away with that in all cases you fixed here. I > do agree with Dave on the -f option though- I've never seen a tar > program allow the argument for that to come anywhere except directly > after the flag. Note that the "--" option is not possible there. Or at least I could not get the -q '*' bit working if given earlier in the command. Anyway, the ./ prefixing is killed in my working branch. Allan From dgbaley27 at 0x01b.net Mon Mar 12 14:53:09 2012 From: dgbaley27 at 0x01b.net (dgbaley27 at 0x01b.net) Date: Mon, 12 Mar 2012 12:53:09 -0600 Subject: [pacman-dev] [PATCH 0/6] VCS versioning modifications Message-ID: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> From: Matthew Monaco I've been bothered by makepkg automatically adjusting pkgver if a package doesn't have the correct -git/svn/etc suffix. The first 4 patches might be useful regardless. They allow for multiple sets of _vcs variables in a PKGBUILD and use the package's name to clear up any ambiguity. The 5th patch changes the current semantics of makepkg. The 6th patch provides a new option to force the old semantics. An alternative might be to sanitize the --forcever option so that it may be used from the command line as well as internally. Matthew Monaco (6): makepkg: remove unused variable makepkg: devel_check(): determine vcs makepkg: devel_check(): consolidate common code makepkg: devel_check(): set newpkgver (cleanup) makepkg: devel_check(): only work for -vcs pkgnames makepkg: add --devver option for SCM packages doc/PKGBUILD.5.txt | 3 +- doc/makepkg.8.txt | 4 ++ scripts/makepkg.sh.in | 126 +++++++++++++++++++++++++++---------------------- 3 files changed, 75 insertions(+), 58 deletions(-) -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 14:53:11 2012 From: dgbaley27 at 0x01b.net (dgbaley27 at 0x01b.net) Date: Mon, 12 Mar 2012 12:53:11 -0600 Subject: [pacman-dev] [PATCH 2/6] makepkg: devel_check(): determine vcs In-Reply-To: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> Message-ID: <1331578395-11782-3-git-send-email-dgbaley27@0x01b.net> From: Matthew Monaco Rather than prioritizing an arbitrary VCS, collect all development directives. If there is more than one, use the package name as a hint. If that doesn't work, abort. --- scripts/makepkg.sh.in | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 05a611d..1eb62ca 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1714,6 +1714,27 @@ devel_check() { # calls to makepkg via fakeroot will explicitly pass the version # number to avoid having to determine the version number twice. # Also do a check to make sure we have the VCS tool available. + local vcs=() + + [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] && vcs+=("darcs") + [[ -n ${_cvsroot} && -n ${_cvsmod} ]] && vcs+=("cvs") + [[ -n ${_gitroot} && -n ${_gitname} ]] && vcs+=("git") + [[ -n ${_svntrunk} && -n ${_svnmod} ]] && vcs+=("svn") + [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] && vcs+=("bzr") + [[ -n ${_hgroot} && -n ${_hgrepo} ]] && vcs+=("hg") + + if [[ ${#vcs[@]} -eq 0 ]]; then + return + elif [[ ${#vcs[@]} -ge 2 ]]; then + local vcslen=${#vcs[@]} + vcs=(${vcs[@]/${pkgname##*-}/}) + if [[ ${#vcs[@]} -eq $vcslen ]]; then + warning "$(gettext "Ambiguous VCS package. Cannot pick from: %s.")" "${vcs[*]}" + return 0 + fi + vcs=${pkgname##*-} + fi + if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then if ! type -p darcs >/dev/null; then warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 14:53:10 2012 From: dgbaley27 at 0x01b.net (dgbaley27 at 0x01b.net) Date: Mon, 12 Mar 2012 12:53:10 -0600 Subject: [pacman-dev] [PATCH 1/6] makepkg: remove unused variable In-Reply-To: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> Message-ID: <1331578395-11782-2-git-send-email-dgbaley27@0x01b.net> From: Matthew Monaco --- scripts/makepkg.sh.in | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 89cd118..05a611d 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1714,7 +1714,6 @@ devel_check() { # calls to makepkg via fakeroot will explicitly pass the version # number to avoid having to determine the version number twice. # Also do a check to make sure we have the VCS tool available. - oldpkgver=$pkgver if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then if ! type -p darcs >/dev/null; then warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 14:53:12 2012 From: dgbaley27 at 0x01b.net (dgbaley27 at 0x01b.net) Date: Mon, 12 Mar 2012 12:53:12 -0600 Subject: [pacman-dev] [PATCH 3/6] makepkg: devel_check(): consolidate common code In-Reply-To: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> Message-ID: <1331578395-11782-4-git-send-email-dgbaley27@0x01b.net> From: Matthew Monaco --- scripts/makepkg.sh.in | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 1eb62ca..c5259c9 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1735,47 +1735,24 @@ devel_check() { vcs=${pkgname##*-} fi + if ! type -p "$vcs" >/dev/null; then + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "$vcs" "$vcs" + return 0 + fi + + msg "$(gettext "Determining latest %s revision...")" "$vcs" + if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then - if ! type -p darcs >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'darcs' newpkgver=$(date +%Y%m%d) elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then - if ! type -p cvs >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "cvs" "cvs" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'cvs' newpkgver=$(date +%Y%m%d) elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then - if ! type -p git >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "git" "git" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'git' newpkgver=$(date +%Y%m%d) elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then - if ! type -p svn >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "svn" "svn" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'svn' newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then - if ! type -p bzr >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "bzr" "bzr" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'bzr' newpkgver=$(bzr revno ${_bzrtrunk}) elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then - if ! type -p hg >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "hg" "hg" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'hg' if [[ -d ./src/$_hgrepo ]] ; then cd ./src/$_hgrepo local ret=0 -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 14:53:13 2012 From: dgbaley27 at 0x01b.net (dgbaley27 at 0x01b.net) Date: Mon, 12 Mar 2012 12:53:13 -0600 Subject: [pacman-dev] [PATCH 4/6] makepkg: devel_check(): set newpkgver (cleanup) In-Reply-To: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> Message-ID: <1331578395-11782-5-git-send-email-dgbaley27@0x01b.net> From: Matthew Monaco The case structure allows the syntax to focus on what's actually being done here. --- scripts/makepkg.sh.in | 61 +++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c5259c9..d4798ca 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1742,34 +1742,41 @@ devel_check() { msg "$(gettext "Determining latest %s revision...")" "$vcs" - if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then - newpkgver=$(date +%Y%m%d) - elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then - newpkgver=$(date +%Y%m%d) - elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then - newpkgver=$(date +%Y%m%d) - elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then - newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') - elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then - newpkgver=$(bzr revno ${_bzrtrunk}) - elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then - if [[ -d ./src/$_hgrepo ]] ; then - cd ./src/$_hgrepo - local ret=0 - hg pull || ret=$? - if (( ! ret )); then - hg update - elif (( ret != 1 )); then - return 1 + case "$vcs" in + darcs) + newpkgver=$(date +%Y%m%d) + ;; + cvs) + newpkgver=$(date +%Y%m%d) + ;; + git) + newpkgver=$(date +%Y%m%d) + ;; + svn) + newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') + ;; + bzr) + newpkgver=$(bzr revno ${_bzrtrunk}) + ;; + hg) + if [[ -d ./src/$_hgrepo ]] ; then + cd ./src/$_hgrepo + local ret=0 + hg pull || ret=$? + if (( ! ret )); then + hg update + elif (( ret != 1 )); then + return 1 + fi + else + [[ ! -d ./src/ ]] && mkdir ./src/ + hg clone $_hgroot/$_hgrepo ./src/$_hgrepo + cd ./src/$_hgrepo fi - else - [[ ! -d ./src/ ]] && mkdir ./src/ - hg clone $_hgroot/$_hgrepo ./src/$_hgrepo - cd ./src/$_hgrepo - fi - newpkgver=$(hg tip --template "{rev}") - cd ../../ - fi + newpkgver=$(hg tip --template "{rev}") + cd ../../ + ;; + esac if [[ -n $newpkgver ]]; then msg2 "$(gettext "Version found: %s")" "$newpkgver" -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 14:53:14 2012 From: dgbaley27 at 0x01b.net (dgbaley27 at 0x01b.net) Date: Mon, 12 Mar 2012 12:53:14 -0600 Subject: [pacman-dev] [PATCH 5/6] makepkg: devel_check(): only work for -vcs pkgnames In-Reply-To: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> Message-ID: <1331578395-11782-6-git-send-email-dgbaley27@0x01b.net> From: Matthew Monaco If the package's name does not end in -git/svn/etc, then don't touch the pkgver or pkgrel. This changes the current semantics of makepkg, but it shouldn't be too mind blowing. Currently in core/extra there are two vcs packages (svn) which use _svntrunk and _svnmod. They also use -svn in the pkgname so they won't be affected (mplayer-svn, seom-svn). In addition, vim uses the _hg directives but with a double underscore (presumably to avoid automatic versioning despite not being vim-git). In community there are a few packages which use the vcs directives but do not have a -vcs name. Most of these appear to never want an automatic version number (blender, boinc, bti, cfml, go, lorcon, sfml). The exceptions in community are: fusion-icon, ldc, notion, opencollada. --- doc/PKGBUILD.5.txt | 3 ++- scripts/makepkg.sh.in | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index a21c1df..7459521 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -389,7 +389,8 @@ makepkg supports building development versions of packages without having to manually update the pkgver in the PKGBUILD. This was formerly done using the separate utility 'versionpkg'. In order to utilize this functionality, your PKGBUILD must use correct variable names depending on the SCM being fetched -from (e.g., 'makepkg-git', 'mplayer-svn'). +from *and* the name of the package must end in -SCM (e.g., 'makepkg-git', +'mplayer-svn'). *CVS*:: The generated pkgver will be the date the package is built. diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d4798ca..dd545c6 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1735,6 +1735,11 @@ devel_check() { vcs=${pkgname##*-} fi + if [[ "$vcs" != "${pkgname##*-}" ]]; then + warning "$(gettext "The pkgname does not end in -%s, skipping automatic versioning.")" "$vcs" + return 0 + fi + if ! type -p "$vcs" >/dev/null; then warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "$vcs" "$vcs" return 0 -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 14:53:15 2012 From: dgbaley27 at 0x01b.net (dgbaley27 at 0x01b.net) Date: Mon, 12 Mar 2012 12:53:15 -0600 Subject: [pacman-dev] [PATCH 6/6] makepkg: add --devver option for SCM packages In-Reply-To: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> Message-ID: <1331578395-11782-7-git-send-email-dgbaley27@0x01b.net> From: Matthew Monaco This will allow packages to be built with an automatic development version even if the package's name does not end in -git/svn/etc. --- doc/makepkg.8.txt | 4 ++++ scripts/makepkg.sh.in | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index df41e18..e0255d0 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -58,6 +58,10 @@ Options will break the build process if all of the dependencies are not installed. +*--devver*:: + Force makepkg to automatically bump pkgver if a package uses VCS directives + but does not have a name that ends in -vcs. + *-e, \--noextract*:: Do not extract source files; use whatever source already exists in the src/ directory. This is handy if you want to go into src/ and manually diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index dd545c6..aa68dc5 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -70,6 +70,7 @@ LOGGING=0 SOURCEONLY=0 IGNOREARCH=0 HOLDVER=0 +DEVVER=0 BUILDFUNC=0 CHECKFUNC=0 PKGFUNC=0 @@ -1735,8 +1736,8 @@ devel_check() { vcs=${pkgname##*-} fi - if [[ "$vcs" != "${pkgname##*-}" ]]; then - warning "$(gettext "The pkgname does not end in -%s, skipping automatic versioning.")" "$vcs" + if [[ "$vcs" != "${pkgname##*-}" ]] && (( ! DEVVER )); then + warning "$(gettext "The pkgname does not end in -%s, use --devver to force automatic versioning.")" "$vcs" return 0 fi @@ -1892,6 +1893,7 @@ usage() { printf -- "$(gettext " --asroot Allow %s to run as root user")\n" "makepkg" printf -- "$(gettext " --check Run the %s function in the %s")\n" "check()" "$BUILDSCRIPT" printf -- "$(gettext " --config Use an alternate config file (instead of '%s')")\n" "$confdir/makepkg.conf" + printf -- "$(gettext " --devver Force automatic version bumping for development %ss")\n" "$BUILDSCRIPT" printf -- "$(gettext " --holdver Prevent automatic version bumping for development %ss")\n" "$BUILDSCRIPT" printf -- "$(gettext " --key Specify a key to use for %s signing instead of the default")\n" "gpg" printf -- "$(gettext " --nocheck Do not run the %s function in the %s")\n" "check()" "$BUILDSCRIPT" @@ -1933,7 +1935,7 @@ ARGLIST=("$@") # Parse Command Line Options. OPT_SHORT="AcdefFghiLmop:rRsSV" -OPT_LONG="allsource,asroot,ignorearch,check,clean,nodeps" +OPT_LONG="allsource,asroot,ignorearch,check,clean,nodeps,devver" OPT_LONG+=",noextract,force,forcever:,geninteg,help,holdver,skippgpcheck" OPT_LONG+=",install,key:,log,nocolor,nobuild,nocheck,nosign,pkg:,rmdeps" OPT_LONG+=",repackage,skipchecksums,skipinteg,skippgpcheck,sign,source,syncdeps" @@ -1961,6 +1963,7 @@ while true; do --check) RUN_CHECK='y' ;; --config) shift; MAKEPKG_CONF=$1 ;; -d|--nodeps) NODEPS=1 ;; + --devver) DEVVER=1 ;; -e|--noextract) NOEXTRACT=1 ;; -f|--force) FORCE=1 ;; #hidden opt used by fakeroot call for svn/cvs/etc PKGBUILDs to set pkgver -- 1.7.9.3 From d at falconindy.com Mon Mar 12 15:13:54 2012 From: d at falconindy.com (Dave Reisner) Date: Mon, 12 Mar 2012 15:13:54 -0400 Subject: [pacman-dev] [PATCH 2/6] makepkg: devel_check(): determine vcs In-Reply-To: <1331578395-11782-3-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-3-git-send-email-dgbaley27@0x01b.net> Message-ID: <20120312191354.GT838@rampage> On Mon, Mar 12, 2012 at 12:53:11PM -0600, dgbaley27 at 0x01b.net wrote: > From: Matthew Monaco > > Rather than prioritizing an arbitrary VCS, collect all development > directives. If there is more than one, use the package name as a hint. > If that doesn't work, abort. > --- I'm not really sure I understand the need for this. In what use case are multiple VCS definitions needed? > scripts/makepkg.sh.in | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 05a611d..1eb62ca 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -1714,6 +1714,27 @@ devel_check() { > # calls to makepkg via fakeroot will explicitly pass the version > # number to avoid having to determine the version number twice. > # Also do a check to make sure we have the VCS tool available. > + local vcs=() > + > + [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] && vcs+=("darcs") > + [[ -n ${_cvsroot} && -n ${_cvsmod} ]] && vcs+=("cvs") > + [[ -n ${_gitroot} && -n ${_gitname} ]] && vcs+=("git") > + [[ -n ${_svntrunk} && -n ${_svnmod} ]] && vcs+=("svn") > + [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] && vcs+=("bzr") > + [[ -n ${_hgroot} && -n ${_hgrepo} ]] && vcs+=("hg") > + > + if [[ ${#vcs[@]} -eq 0 ]]; then We generally use arithmetic contexts elsewhere for numeric comparison. > + return > + elif [[ ${#vcs[@]} -ge 2 ]]; then > + local vcslen=${#vcs[@]} > + vcs=(${vcs[@]/${pkgname##*-}/}) I think you're intentionally performing whitespace splitting here to avoid counting problems. Even if that isn't the reason, it's not kosher. > + if [[ ${#vcs[@]} -eq $vcslen ]]; then > + warning "$(gettext "Ambiguous VCS package. Cannot pick from: %s.")" "${vcs[*]}" > + return 0 > + fi > + vcs=${pkgname##*-} And after all that array business, vcs is now treated as a string. I appreciate bash's "dynamic" typing, but I rarely seek to abuse it. > + fi > + > if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then > if ! type -p darcs >/dev/null; then > warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" > -- > 1.7.9.3 > > From d at falconindy.com Mon Mar 12 15:19:45 2012 From: d at falconindy.com (Dave Reisner) Date: Mon, 12 Mar 2012 15:19:45 -0400 Subject: [pacman-dev] [PATCH 4/6] makepkg: devel_check(): set newpkgver (cleanup) In-Reply-To: <1331578395-11782-5-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-5-git-send-email-dgbaley27@0x01b.net> Message-ID: <20120312191945.GU838@rampage> On Mon, Mar 12, 2012 at 12:53:13PM -0600, dgbaley27 at 0x01b.net wrote: > From: Matthew Monaco > > The case structure allows the syntax to focus on what's actually being > done here. > --- > scripts/makepkg.sh.in | 61 +++++++++++++++++++++++++++---------------------- > 1 file changed, 34 insertions(+), 27 deletions(-) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index c5259c9..d4798ca 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -1742,34 +1742,41 @@ devel_check() { > > msg "$(gettext "Determining latest %s revision...")" "$vcs" > > - if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then > - newpkgver=$(date +%Y%m%d) > - elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then > - newpkgver=$(date +%Y%m%d) > - elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then > - newpkgver=$(date +%Y%m%d) > - elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then > - newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') > - elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then > - newpkgver=$(bzr revno ${_bzrtrunk}) > - elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then > - if [[ -d ./src/$_hgrepo ]] ; then > - cd ./src/$_hgrepo > - local ret=0 > - hg pull || ret=$? > - if (( ! ret )); then > - hg update > - elif (( ret != 1 )); then > - return 1 > + case "$vcs" in > + darcs) > + newpkgver=$(date +%Y%m%d) > + ;; > + cvs) > + newpkgver=$(date +%Y%m%d) > + ;; > + git) > + newpkgver=$(date +%Y%m%d) > + ;; > + svn) > + newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') > + ;; > + bzr) > + newpkgver=$(bzr revno ${_bzrtrunk}) > + ;; > + hg) > + if [[ -d ./src/$_hgrepo ]] ; then > + cd ./src/$_hgrepo If we're going to be changing this, please use pushd/popd, quote properly, and check for errors. > + local ret=0 > + hg pull || ret=$? > + if (( ! ret )); then > + hg update > + elif (( ret != 1 )); then > + return 1 > + fi > + else > + [[ ! -d ./src/ ]] && mkdir ./src/ > + hg clone $_hgroot/$_hgrepo ./src/$_hgrepo > + cd ./src/$_hgrepo > fi > - else > - [[ ! -d ./src/ ]] && mkdir ./src/ > - hg clone $_hgroot/$_hgrepo ./src/$_hgrepo > - cd ./src/$_hgrepo > - fi > - newpkgver=$(hg tip --template "{rev}") > - cd ../../ > - fi > + newpkgver=$(hg tip --template "{rev}") > + cd ../../ > + ;; > + esac > > if [[ -n $newpkgver ]]; then > msg2 "$(gettext "Version found: %s")" "$newpkgver" > -- > 1.7.9.3 > > From dgbaley27 at 0x01b.net Mon Mar 12 15:22:20 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 13:22:20 -0600 Subject: [pacman-dev] [PATCH 2/6] makepkg: devel_check(): determine vcs In-Reply-To: <20120312191354.GT838@rampage> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-3-git-send-email-dgbaley27@0x01b.net> <20120312191354.GT838@rampage> Message-ID: <4F5E4CEC.9070209@0x01b.net> On 03/12/2012 01:13 PM, Dave Reisner wrote: > On Mon, Mar 12, 2012 at 12:53:11PM -0600, dgbaley27 at 0x01b.net wrote: >> From: Matthew Monaco >> >> Rather than prioritizing an arbitrary VCS, collect all development >> directives. If there is more than one, use the package name as a hint. >> If that doesn't work, abort. >> --- > > I'm not really sure I understand the need for this. In what use case > are multiple VCS definitions needed? > I've only seen multiples when a project is transitioning to a new system. Either way, I think that splitting the check for the which vcs is being used and setting the new version might be useful. >> scripts/makepkg.sh.in | 21 +++++++++++++++++++++ >> 1 file changed, 21 insertions(+) >> >> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >> index 05a611d..1eb62ca 100644 >> --- a/scripts/makepkg.sh.in >> +++ b/scripts/makepkg.sh.in >> @@ -1714,6 +1714,27 @@ devel_check() { >> # calls to makepkg via fakeroot will explicitly pass the version >> # number to avoid having to determine the version number twice. >> # Also do a check to make sure we have the VCS tool available. >> + local vcs=() >> + >> + [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] && vcs+=("darcs") >> + [[ -n ${_cvsroot} && -n ${_cvsmod} ]] && vcs+=("cvs") >> + [[ -n ${_gitroot} && -n ${_gitname} ]] && vcs+=("git") >> + [[ -n ${_svntrunk} && -n ${_svnmod} ]] && vcs+=("svn") >> + [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] && vcs+=("bzr") >> + [[ -n ${_hgroot} && -n ${_hgrepo} ]] && vcs+=("hg") >> + >> + if [[ ${#vcs[@]} -eq 0 ]]; then > > We generally use arithmetic contexts elsewhere for numeric comparison. > ok >> + return >> + elif [[ ${#vcs[@]} -ge 2 ]]; then >> + local vcslen=${#vcs[@]} >> + vcs=(${vcs[@]/${pkgname##*-}/}) > > I think you're intentionally performing whitespace splitting here to > avoid counting problems. Even if that isn't the reason, it's not kosher. > it's a quick way to test if the -suffix matches the two _vcs variables. also, the potential list is confined to what is above and a vcs with a space in the name isn't likely. >> + if [[ ${#vcs[@]} -eq $vcslen ]]; then >> + warning "$(gettext "Ambiguous VCS package. Cannot pick from: %s.")" "${vcs[*]}" >> + return 0 >> + fi >> + vcs=${pkgname##*-} > > And after all that array business, vcs is now treated as a string. I > appreciate bash's "dynamic" typing, but I rarely seek to abuse it. > ok >> + fi >> + >> if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then >> if ! type -p darcs >/dev/null; then >> warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" >> -- >> 1.7.9.3 >> >> > From d at falconindy.com Mon Mar 12 15:22:58 2012 From: d at falconindy.com (Dave Reisner) Date: Mon, 12 Mar 2012 15:22:58 -0400 Subject: [pacman-dev] [PATCH 5/6] makepkg: devel_check(): only work for -vcs pkgnames In-Reply-To: <1331578395-11782-6-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-6-git-send-email-dgbaley27@0x01b.net> Message-ID: <20120312192258.GV838@rampage> On Mon, Mar 12, 2012 at 12:53:14PM -0600, dgbaley27 at 0x01b.net wrote: > From: Matthew Monaco > > If the package's name does not end in -git/svn/etc, then don't touch > the pkgver or pkgrel. This changes the current semantics of makepkg, but > it shouldn't be too mind blowing. And I strongly disagree... What's the point in holding the package version if you can't tell the VCS behind the source files to obey this arbitrary date (e.g. in the case of git)? > Currently in core/extra there are two vcs packages (svn) which use > _svntrunk and _svnmod. They also use -svn in the pkgname so they won't > be affected (mplayer-svn, seom-svn). In addition, vim uses the _hg > directives but with a double underscore (presumably to avoid automatic > versioning despite not being vim-git). > > In community there are a few packages which use the vcs directives but > do not have a -vcs name. Most of these appear to never want an automatic > version number (blender, boinc, bti, cfml, go, lorcon, sfml). > > The exceptions in community are: fusion-icon, ldc, notion, opencollada. And in my opinion, these packages are wrong. > --- > doc/PKGBUILD.5.txt | 3 ++- > scripts/makepkg.sh.in | 5 +++++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt > index a21c1df..7459521 100644 > --- a/doc/PKGBUILD.5.txt > +++ b/doc/PKGBUILD.5.txt > @@ -389,7 +389,8 @@ makepkg supports building development versions of packages without having to > manually update the pkgver in the PKGBUILD. This was formerly done using the > separate utility 'versionpkg'. In order to utilize this functionality, your > PKGBUILD must use correct variable names depending on the SCM being fetched > -from (e.g., 'makepkg-git', 'mplayer-svn'). > +from *and* the name of the package must end in -SCM (e.g., 'makepkg-git', > +'mplayer-svn'). > > *CVS*:: > The generated pkgver will be the date the package is built. > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index d4798ca..dd545c6 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -1735,6 +1735,11 @@ devel_check() { > vcs=${pkgname##*-} > fi > > + if [[ "$vcs" != "${pkgname##*-}" ]]; then > + warning "$(gettext "The pkgname does not end in -%s, skipping automatic versioning.")" "$vcs" > + return 0 > + fi > + > if ! type -p "$vcs" >/dev/null; then > warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "$vcs" "$vcs" > return 0 > -- > 1.7.9.3 > > From dgbaley27 at 0x01b.net Mon Mar 12 15:23:44 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 13:23:44 -0600 Subject: [pacman-dev] [PATCH 4/6] makepkg: devel_check(): set newpkgver (cleanup) In-Reply-To: <20120312191945.GU838@rampage> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-5-git-send-email-dgbaley27@0x01b.net> <20120312191945.GU838@rampage> Message-ID: <4F5E4D40.2010507@0x01b.net> On 03/12/2012 01:19 PM, Dave Reisner wrote: > On Mon, Mar 12, 2012 at 12:53:13PM -0600, dgbaley27 at 0x01b.net wrote: >> From: Matthew Monaco >> >> The case structure allows the syntax to focus on what's actually being >> done here. >> --- >> scripts/makepkg.sh.in | 61 +++++++++++++++++++++++++++---------------------- >> 1 file changed, 34 insertions(+), 27 deletions(-) >> >> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >> index c5259c9..d4798ca 100644 >> --- a/scripts/makepkg.sh.in >> +++ b/scripts/makepkg.sh.in >> @@ -1742,34 +1742,41 @@ devel_check() { >> >> msg "$(gettext "Determining latest %s revision...")" "$vcs" >> >> - if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then >> - newpkgver=$(date +%Y%m%d) >> - elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then >> - newpkgver=$(date +%Y%m%d) >> - elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then >> - newpkgver=$(date +%Y%m%d) >> - elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then >> - newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') >> - elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then >> - newpkgver=$(bzr revno ${_bzrtrunk}) >> - elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then >> - if [[ -d ./src/$_hgrepo ]] ; then >> - cd ./src/$_hgrepo >> - local ret=0 >> - hg pull || ret=$? >> - if (( ! ret )); then >> - hg update >> - elif (( ret != 1 )); then >> - return 1 >> + case "$vcs" in >> + darcs) >> + newpkgver=$(date +%Y%m%d) >> + ;; >> + cvs) >> + newpkgver=$(date +%Y%m%d) >> + ;; >> + git) >> + newpkgver=$(date +%Y%m%d) >> + ;; >> + svn) >> + newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') >> + ;; >> + bzr) >> + newpkgver=$(bzr revno ${_bzrtrunk}) >> + ;; >> + hg) >> + if [[ -d ./src/$_hgrepo ]] ; then >> + cd ./src/$_hgrepo > > If we're going to be changing this, please use pushd/popd, quote > properly, and check for errors. > I can do this, but this set didn't touch any of the code that sets newpkgver. >> + local ret=0 >> + hg pull || ret=$? >> + if (( ! ret )); then >> + hg update >> + elif (( ret != 1 )); then >> + return 1 >> + fi >> + else >> + [[ ! -d ./src/ ]] && mkdir ./src/ >> + hg clone $_hgroot/$_hgrepo ./src/$_hgrepo >> + cd ./src/$_hgrepo >> fi >> - else >> - [[ ! -d ./src/ ]] && mkdir ./src/ >> - hg clone $_hgroot/$_hgrepo ./src/$_hgrepo >> - cd ./src/$_hgrepo >> - fi >> - newpkgver=$(hg tip --template "{rev}") >> - cd ../../ >> - fi >> + newpkgver=$(hg tip --template "{rev}") >> + cd ../../ >> + ;; >> + esac >> >> if [[ -n $newpkgver ]]; then >> msg2 "$(gettext "Version found: %s")" "$newpkgver" >> -- >> 1.7.9.3 >> >> > From dgbaley27 at 0x01b.net Mon Mar 12 15:33:47 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 13:33:47 -0600 Subject: [pacman-dev] [PATCH 5/6] makepkg: devel_check(): only work for -vcs pkgnames In-Reply-To: <20120312192258.GV838@rampage> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-6-git-send-email-dgbaley27@0x01b.net> <20120312192258.GV838@rampage> Message-ID: <4F5E4F9B.6010306@0x01b.net> On 03/12/2012 01:22 PM, Dave Reisner wrote: > On Mon, Mar 12, 2012 at 12:53:14PM -0600, dgbaley27 at 0x01b.net wrote: >> From: Matthew Monaco >> >> If the package's name does not end in -git/svn/etc, then don't touch >> the pkgver or pkgrel. This changes the current semantics of makepkg, but >> it shouldn't be too mind blowing. > > And I strongly disagree... What's the point in holding the package > version if you can't tell the VCS behind the source files to obey this > arbitrary date (e.g. in the case of git)? > I'm not sure I follow. If the package uses _gitroot and _gitname, but is not -git, then from what I saw in packages.git and community.git, most of the time the package is built using git, but the intention is to still build some specific version. (There are a lot of packages that have to use __gitroot, __gitname...). The situation I intend(ed) to help with is when there is some package in the repos that I temporarily want to replace with the git version until the next release. For this, I grab the -git version but set the pkgver to some number just before the next release so future upgrades will happen automatically. That, coupled with my look through existing packages, made it seem like packages that don't have a -vcs shouldn't have the version's automatically set. >> Currently in core/extra there are two vcs packages (svn) which use >> _svntrunk and _svnmod. They also use -svn in the pkgname so they won't >> be affected (mplayer-svn, seom-svn). In addition, vim uses the _hg >> directives but with a double underscore (presumably to avoid automatic >> versioning despite not being vim-git). >> >> In community there are a few packages which use the vcs directives but >> do not have a -vcs name. Most of these appear to never want an automatic >> version number (blender, boinc, bti, cfml, go, lorcon, sfml). >> >> The exceptions in community are: fusion-icon, ldc, notion, opencollada. > > And in my opinion, these packages are wrong. > So then I'm not sure where the disagreement is =) >> --- >> doc/PKGBUILD.5.txt | 3 ++- >> scripts/makepkg.sh.in | 5 +++++ >> 2 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt >> index a21c1df..7459521 100644 >> --- a/doc/PKGBUILD.5.txt >> +++ b/doc/PKGBUILD.5.txt >> @@ -389,7 +389,8 @@ makepkg supports building development versions of packages without having to >> manually update the pkgver in the PKGBUILD. This was formerly done using the >> separate utility 'versionpkg'. In order to utilize this functionality, your >> PKGBUILD must use correct variable names depending on the SCM being fetched >> -from (e.g., 'makepkg-git', 'mplayer-svn'). >> +from *and* the name of the package must end in -SCM (e.g., 'makepkg-git', >> +'mplayer-svn'). >> >> *CVS*:: >> The generated pkgver will be the date the package is built. >> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >> index d4798ca..dd545c6 100644 >> --- a/scripts/makepkg.sh.in >> +++ b/scripts/makepkg.sh.in >> @@ -1735,6 +1735,11 @@ devel_check() { >> vcs=${pkgname##*-} >> fi >> >> + if [[ "$vcs" != "${pkgname##*-}" ]]; then >> + warning "$(gettext "The pkgname does not end in -%s, skipping automatic versioning.")" "$vcs" >> + return 0 >> + fi >> + >> if ! type -p "$vcs" >/dev/null; then >> warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "$vcs" "$vcs" >> return 0 >> -- >> 1.7.9.3 >> >> > From d at falconindy.com Mon Mar 12 15:45:26 2012 From: d at falconindy.com (Dave Reisner) Date: Mon, 12 Mar 2012 15:45:26 -0400 Subject: [pacman-dev] [PATCH 5/6] makepkg: devel_check(): only work for -vcs pkgnames In-Reply-To: <4F5E4F9B.6010306@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-6-git-send-email-dgbaley27@0x01b.net> <20120312192258.GV838@rampage> <4F5E4F9B.6010306@0x01b.net> Message-ID: <20120312194526.GW838@rampage> On Mon, Mar 12, 2012 at 01:33:47PM -0600, Matthew Monaco wrote: > On 03/12/2012 01:22 PM, Dave Reisner wrote: > > > > And in my opinion, these packages are wrong. > > > > So then I'm not sure where the disagreement is =) > *rereads* I'm not sure either. I'm going to get some more coffee. Ignore my rambling. From dgbaley27 at 0x01b.net Mon Mar 12 16:37:26 2012 From: dgbaley27 at 0x01b.net (dgbaley27 at 0x01b.net) Date: Mon, 12 Mar 2012 14:37:26 -0600 Subject: [pacman-dev] [PATCH v2 2/6] makepkg: devel_check(): determine vcs In-Reply-To: <4F5E4CEC.9070209@0x01b.net> References: <4F5E4CEC.9070209@0x01b.net> Message-ID: <1331584646-15876-1-git-send-email-dgbaley27@0x01b.net> From: Matthew Monaco EDITS: - user arithmetic contexts for integer comparison - use the regex comparison operator to test array membership Rather than prioritizing an arbitrary VCS, collect all development directives. If there is more than one, use the package name as a hint. If that doesn't work, abort. --- scripts/makepkg.sh.in | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 05a611d..55df323 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1714,6 +1714,25 @@ devel_check() { # calls to makepkg via fakeroot will explicitly pass the version # number to avoid having to determine the version number twice. # Also do a check to make sure we have the VCS tool available. + local vcs=() + + [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] && vcs+=("darcs") + [[ -n ${_cvsroot} && -n ${_cvsmod} ]] && vcs+=("cvs") + [[ -n ${_gitroot} && -n ${_gitname} ]] && vcs+=("git") + [[ -n ${_svntrunk} && -n ${_svnmod} ]] && vcs+=("svn") + [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] && vcs+=("bzr") + [[ -n ${_hgroot} && -n ${_hgrepo} ]] && vcs+=("hg") + + if (( ${#vcs[@]} == 0 )); then + return + elif (( ${#vcs[@]} >= 2 )); then + if [[ ${vcs[@]} =~ "${pkgname##*-}" ]]; then + warning "$(gettext "Ambiguous VCS package. Cannot pick from: %s.")" "${vcs[*]}" + return 0 + fi + vcs=${pkgname##*-} + fi + if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then if ! type -p darcs >/dev/null; then warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 16:42:42 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 14:42:42 -0600 Subject: [pacman-dev] [PATCH 7/7] makepkg: devel_check(): cleanup for hg version In-Reply-To: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> Message-ID: <1331584962-16157-1-git-send-email-dgbaley27@0x01b.net> From: Matthew Monaco Use pushd/popd, quote args, handle some more errors --- scripts/makepkg.sh.in | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 11de2b7..0169bbf 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1763,8 +1763,7 @@ devel_check() { newpkgver=$(bzr revno ${_bzrtrunk}) ;; hg) - if [[ -d ./src/$_hgrepo ]] ; then - cd ./src/$_hgrepo + if pushd "./src/$_hgrepo" > /dev/null; then local ret=0 hg pull || ret=$? if (( ! ret )); then @@ -1774,11 +1773,14 @@ devel_check() { fi else [[ ! -d ./src/ ]] && mkdir ./src/ - hg clone $_hgroot/$_hgrepo ./src/$_hgrepo - cd ./src/$_hgrepo + hg clone "$_hgroot/$_hgrepo" "./src/$_hgrepo" + if ! pushd "./src/$_hgrepo" > /dev/null; then + warning "$(gettext "An error occured while determining the hg version number.")" + return 0 + fi fi newpkgver=$(hg tip --template "{rev}") - cd ../../ + popd > /dev/null ;; esac -- 1.7.9.3 From allan at archlinux.org Mon Mar 12 18:56:39 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 08:56:39 +1000 Subject: [pacman-dev] [PATCH 2/6] makepkg: devel_check(): determine vcs In-Reply-To: <4F5E4CEC.9070209@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-3-git-send-email-dgbaley27@0x01b.net> <20120312191354.GT838@rampage> <4F5E4CEC.9070209@0x01b.net> Message-ID: <4F5E7F27.3040201@archlinux.org> On 13/03/12 05:22, Matthew Monaco wrote: > On 03/12/2012 01:13 PM, Dave Reisner wrote: >> On Mon, Mar 12, 2012 at 12:53:11PM -0600, dgbaley27 at 0x01b.net wrote: >>> From: Matthew Monaco >>> >>> Rather than prioritizing an arbitrary VCS, collect all development >>> directives. If there is more than one, use the package name as a hint. >>> If that doesn't work, abort. >>> --- >> >> I'm not really sure I understand the need for this. In what use case >> are multiple VCS definitions needed? >> > > I've only seen multiples when a project is transitioning to a new system. Either > way, I think that splitting the check for the which vcs is being used and > setting the new version might be useful. > I do not understand this argument. I have never seen a project transitioning from one VCS to another in such a way that you had to use both VCS systems to get the source. If that happens, you probably have two different projects managed by the same people and should have two packages. From dgbaley27 at 0x01b.net Mon Mar 12 19:10:36 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 17:10:36 -0600 Subject: [pacman-dev] [PATCH 2/6] makepkg: devel_check(): determine vcs In-Reply-To: <4F5E7F27.3040201@archlinux.org> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-3-git-send-email-dgbaley27@0x01b.net> <20120312191354.GT838@rampage> <4F5E4CEC.9070209@0x01b.net> <4F5E7F27.3040201@archlinux.org> Message-ID: <4F5E826C.10406@0x01b.net> On 03/12/2012 04:56 PM, Allan McRae wrote: > On 13/03/12 05:22, Matthew Monaco wrote: >> On 03/12/2012 01:13 PM, Dave Reisner wrote: >>> On Mon, Mar 12, 2012 at 12:53:11PM -0600, dgbaley27 at 0x01b.net wrote: >>>> From: Matthew Monaco >>>> >>>> Rather than prioritizing an arbitrary VCS, collect all development >>>> directives. If there is more than one, use the package name as a hint. >>>> If that doesn't work, abort. >>>> --- >>> >>> I'm not really sure I understand the need for this. In what use case >>> are multiple VCS definitions needed? >>> >> >> I've only seen multiples when a project is transitioning to a new system. Either >> way, I think that splitting the check for the which vcs is being used and >> setting the new version might be useful. >> > > I do not understand this argument. I have never seen a project > transitioning from one VCS to another in such a way that you had to use > both VCS systems to get the source. If that happens, you probably have > two different projects managed by the same people and should have two > packages. > It wasn't the point of the change; just a potential scenario given when asked. I was in the function and figured Murphy's Law indicated at some point someone was going to do something funny. The real change that I'm after is that a package has to be named appropriately to get an automatic version bump by default. > > From allan at archlinux.org Mon Mar 12 19:12:11 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 09:12:11 +1000 Subject: [pacman-dev] [PATCH 5/6] makepkg: devel_check(): only work for -vcs pkgnames In-Reply-To: <1331578395-11782-6-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-6-git-send-email-dgbaley27@0x01b.net> Message-ID: <4F5E82CB.3070202@archlinux.org> On 13/03/12 04:53, dgbaley27 at 0x01b.net wrote: > From: Matthew Monaco > > If the package's name does not end in -git/svn/etc, then don't touch > the pkgver or pkgrel. This changes the current semantics of makepkg, but > it shouldn't be too mind blowing. Well... even if Dave's ramblings are to be ignored, I am very strongly against this. 1) If you have defined _gitroot etc then you have a git package. The name of the package is immaterial. 2) If you do not want to update your pkgver then use the --holdver flag. (which is crap... but achieves the same as this patch). What problem is this solving? All I can see is adding a restriction to what a package name can be with absolutely no benefit. Allan From dgbaley27 at 0x01b.net Mon Mar 12 19:54:52 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 17:54:52 -0600 Subject: [pacman-dev] [PATCH 5/6] makepkg: devel_check(): only work for -vcs pkgnames In-Reply-To: <4F5E82CB.3070202@archlinux.org> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-6-git-send-email-dgbaley27@0x01b.net> <4F5E82CB.3070202@archlinux.org> Message-ID: <4F5E8CCC.1060803@0x01b.net> On 03/12/2012 05:12 PM, Allan McRae wrote: > On 13/03/12 04:53, dgbaley27 at 0x01b.net wrote: >> From: Matthew Monaco >> >> If the package's name does not end in -git/svn/etc, then don't touch >> the pkgver or pkgrel. This changes the current semantics of makepkg, but >> it shouldn't be too mind blowing. > > > Well... even if Dave's ramblings are to be ignored, I am very strongly > against this. > Fair enough > 1) If you have defined _gitroot etc then you have a git package. The > name of the package is immaterial. > > 2) If you do not want to update your pkgver then use the --holdver flag. > (which is crap... but achieves the same as this patch). > > > What problem is this solving? All I can see is adding a restriction to > what a package name can be with absolutely no benefit. > I thought that requiring a package to be named appropriately to be considered a development package was at least worthy of discussion. > Allan > From allan at archlinux.org Mon Mar 12 20:24:59 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 10:24:59 +1000 Subject: [pacman-dev] [PATCH 1/6] makepkg: remove unused variable In-Reply-To: <1331578395-11782-2-git-send-email-dgbaley27@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-2-git-send-email-dgbaley27@0x01b.net> Message-ID: <4F5E93DB.4080902@archlinux.org> On 13/03/12 04:53, dgbaley27 at 0x01b.net wrote: > From: Matthew Monaco > > --- > scripts/makepkg.sh.in | 1 - > 1 file changed, 1 deletion(-) Pulled to my patchqueue. Thanks, Allan > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 89cd118..05a611d 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -1714,7 +1714,6 @@ devel_check() { > # calls to makepkg via fakeroot will explicitly pass the version > # number to avoid having to determine the version number twice. > # Also do a check to make sure we have the VCS tool available. > - oldpkgver=$pkgver > if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then > if ! type -p darcs >/dev/null; then > warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" From allan at archlinux.org Mon Mar 12 20:34:06 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 10:34:06 +1000 Subject: [pacman-dev] [PATCH v2 2/6] makepkg: devel_check(): determine vcs In-Reply-To: <1331584646-15876-1-git-send-email-dgbaley27@0x01b.net> References: <4F5E4CEC.9070209@0x01b.net> <1331584646-15876-1-git-send-email-dgbaley27@0x01b.net> Message-ID: <4F5E95FE.4030201@archlinux.org> On 13/03/12 06:37, dgbaley27 at 0x01b.net wrote: > From: Matthew Monaco > > EDITS: > - user arithmetic contexts for integer comparison > - use the regex comparison operator to test array membership > > Rather than prioritizing an arbitrary VCS, collect all development > directives. If there is more than one, use the package name as a hint. > If that doesn't work, abort. > --- > scripts/makepkg.sh.in | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 05a611d..55df323 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -1714,6 +1714,25 @@ devel_check() { > # calls to makepkg via fakeroot will explicitly pass the version > # number to avoid having to determine the version number twice. > # Also do a check to make sure we have the VCS tool available. > + local vcs=() > + > + [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] && vcs+=("darcs") > + [[ -n ${_cvsroot} && -n ${_cvsmod} ]] && vcs+=("cvs") > + [[ -n ${_gitroot} && -n ${_gitname} ]] && vcs+=("git") > + [[ -n ${_svntrunk} && -n ${_svnmod} ]] && vcs+=("svn") > + [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] && vcs+=("bzr") > + [[ -n ${_hgroot} && -n ${_hgrepo} ]] && vcs+=("hg") > + > + if (( ${#vcs[@]} == 0 )); then > + return > + elif (( ${#vcs[@]} >= 2 )); then > + if [[ ${vcs[@]} =~ "${pkgname##*-}" ]]; then If you remove this check based on the package name, I will ack patches 2 to 4. Allan From dgbaley27 at 0x01b.net Mon Mar 12 21:14:17 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 19:14:17 -0600 Subject: [pacman-dev] [PATCH v3 0/5] development package cleanups Message-ID: From: Matthew Monaco Some cleanup in the devel_check() function. The semantics aren't really changed here. Guard against the potential to specify multiple groups of development directives. Matthew Monaco (5): makepkg: remove unused variable makepkg: devel_check(): determine vcs makepkg: devel_check(): consolidate common code makepkg: devel_check(): set newpkgver (cleanup) makepkg: devel_check(): cleanup for hg version scripts/makepkg.sh.in | 117 +++++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 58 deletions(-) -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 21:14:18 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 19:14:18 -0600 Subject: [pacman-dev] [PATCH v3 1/5] makepkg: remove unused variable In-Reply-To: References: Message-ID: <142502a90b9641ab9c8304a9776b8a62cde73715.1331601062.git.matthew.monaco@0x01b.net> From: Matthew Monaco --- scripts/makepkg.sh.in | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 89cd118..05a611d 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1714,7 +1714,6 @@ devel_check() { # calls to makepkg via fakeroot will explicitly pass the version # number to avoid having to determine the version number twice. # Also do a check to make sure we have the VCS tool available. - oldpkgver=$pkgver if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then if ! type -p darcs >/dev/null; then warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 21:14:19 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 19:14:19 -0600 Subject: [pacman-dev] [PATCH v3 2/5] makepkg: devel_check(): determine vcs In-Reply-To: References: Message-ID: <7509a0aa33c133d0cf7f567284bfce6273066ddd.1331601062.git.matthew.monaco@0x01b.net> From: Matthew Monaco Rather than prioritizing an arbitrary VCS, collect all development directives. If there is more than one, give a warning and abort. --- scripts/makepkg.sh.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 05a611d..46e787f 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1714,6 +1714,22 @@ devel_check() { # calls to makepkg via fakeroot will explicitly pass the version # number to avoid having to determine the version number twice. # Also do a check to make sure we have the VCS tool available. + local vcs=() + + [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] && vcs+=("darcs") + [[ -n ${_cvsroot} && -n ${_cvsmod} ]] && vcs+=("cvs") + [[ -n ${_gitroot} && -n ${_gitname} ]] && vcs+=("git") + [[ -n ${_svntrunk} && -n ${_svnmod} ]] && vcs+=("svn") + [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] && vcs+=("bzr") + [[ -n ${_hgroot} && -n ${_hgrepo} ]] && vcs+=("hg") + + if (( ${#vcs[@]} == 0 )); then + return + elif (( ${#vcs[@]} > 1 )); then + warning "$(gettext "Ambiguous VCS package. Cannot pick from: %s.")" "${vcs[*]}" + return 0 + fi + if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then if ! type -p darcs >/dev/null; then warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 21:14:20 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 19:14:20 -0600 Subject: [pacman-dev] [PATCH v3 3/5] makepkg: devel_check(): consolidate common code In-Reply-To: References: Message-ID: From: Matthew Monaco --- scripts/makepkg.sh.in | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 46e787f..74dfd96 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1730,47 +1730,24 @@ devel_check() { return 0 fi + if ! type -p "$vcs" >/dev/null; then + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "$vcs" "$vcs" + return 0 + fi + + msg "$(gettext "Determining latest %s revision...")" "$vcs" + if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then - if ! type -p darcs >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'darcs' newpkgver=$(date +%Y%m%d) elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then - if ! type -p cvs >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "cvs" "cvs" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'cvs' newpkgver=$(date +%Y%m%d) elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then - if ! type -p git >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "git" "git" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'git' newpkgver=$(date +%Y%m%d) elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then - if ! type -p svn >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "svn" "svn" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'svn' newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then - if ! type -p bzr >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "bzr" "bzr" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'bzr' newpkgver=$(bzr revno ${_bzrtrunk}) elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then - if ! type -p hg >/dev/null; then - warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "hg" "hg" - return 0 - fi - msg "$(gettext "Determining latest %s revision...")" 'hg' if [[ -d ./src/$_hgrepo ]] ; then cd ./src/$_hgrepo local ret=0 -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 21:14:21 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 19:14:21 -0600 Subject: [pacman-dev] [PATCH v3 4/5] makepkg: devel_check(): set newpkgver (cleanup) In-Reply-To: References: Message-ID: <9ea236a7daad4700e89678537a638b7931c2668f.1331601062.git.matthew.monaco@0x01b.net> From: Matthew Monaco The case structure allows the syntax to focus on what's actually being done here. --- scripts/makepkg.sh.in | 61 +++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 74dfd96..5dcaf60 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1737,34 +1737,41 @@ devel_check() { msg "$(gettext "Determining latest %s revision...")" "$vcs" - if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then - newpkgver=$(date +%Y%m%d) - elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then - newpkgver=$(date +%Y%m%d) - elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then - newpkgver=$(date +%Y%m%d) - elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then - newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') - elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then - newpkgver=$(bzr revno ${_bzrtrunk}) - elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then - if [[ -d ./src/$_hgrepo ]] ; then - cd ./src/$_hgrepo - local ret=0 - hg pull || ret=$? - if (( ! ret )); then - hg update - elif (( ret != 1 )); then - return 1 + case "$vcs" in + darcs) + newpkgver=$(date +%Y%m%d) + ;; + cvs) + newpkgver=$(date +%Y%m%d) + ;; + git) + newpkgver=$(date +%Y%m%d) + ;; + svn) + newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') + ;; + bzr) + newpkgver=$(bzr revno ${_bzrtrunk}) + ;; + hg) + if [[ -d ./src/$_hgrepo ]] ; then + cd ./src/$_hgrepo + local ret=0 + hg pull || ret=$? + if (( ! ret )); then + hg update + elif (( ret != 1 )); then + return 1 + fi + else + [[ ! -d ./src/ ]] && mkdir ./src/ + hg clone $_hgroot/$_hgrepo ./src/$_hgrepo + cd ./src/$_hgrepo fi - else - [[ ! -d ./src/ ]] && mkdir ./src/ - hg clone $_hgroot/$_hgrepo ./src/$_hgrepo - cd ./src/$_hgrepo - fi - newpkgver=$(hg tip --template "{rev}") - cd ../../ - fi + newpkgver=$(hg tip --template "{rev}") + cd ../../ + ;; + esac if [[ -n $newpkgver ]]; then msg2 "$(gettext "Version found: %s")" "$newpkgver" -- 1.7.9.3 From dgbaley27 at 0x01b.net Mon Mar 12 21:14:22 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 19:14:22 -0600 Subject: [pacman-dev] [PATCH v3 5/5] makepkg: devel_check(): cleanup for hg version In-Reply-To: References: Message-ID: <192bd7b10723f83ce2214822a8b7cee749519b11.1331601062.git.matthew.monaco@0x01b.net> From: Matthew Monaco Use pushd/popd, quote args, handle some more errors --- scripts/makepkg.sh.in | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5dcaf60..98e9a5a 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1754,8 +1754,7 @@ devel_check() { newpkgver=$(bzr revno ${_bzrtrunk}) ;; hg) - if [[ -d ./src/$_hgrepo ]] ; then - cd ./src/$_hgrepo + if pushd "./src/$_hgrepo" > /dev/null; then local ret=0 hg pull || ret=$? if (( ! ret )); then @@ -1765,11 +1764,14 @@ devel_check() { fi else [[ ! -d ./src/ ]] && mkdir ./src/ - hg clone $_hgroot/$_hgrepo ./src/$_hgrepo - cd ./src/$_hgrepo + hg clone "$_hgroot/$_hgrepo" "./src/$_hgrepo" + if ! pushd "./src/$_hgrepo" > /dev/null; then + warning "$(gettext "An error occured while determining the hg version number.")" + return 0 + fi fi newpkgver=$(hg tip --template "{rev}") - cd ../../ + popd > /dev/null ;; esac -- 1.7.9.3 From allan at archlinux.org Mon Mar 12 23:58:29 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 13:58:29 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 Message-ID: <4F5EC5E5.4070803@archlinux.org> It is well know that the VCS package support in makepkg is subpar... The number of bugs about this is into double figures. There have also been some patches submitted attempting to be able to use the source=() array in PKGBUILDs to specify a VCS repo and remove a lot of the repetitive crap involved for repo checkout/updating in the current PKGBUILDs. To get the ball rolling again, I think we should pick one VCS system and flesh out what we need and what the prototype PKGBUILD would look like. Then we can move on to the other VCS systems and finally implement it. I guess by the time all the bikeshedding is finished, this will all be done by 2015 and hence the subject line. :) I am going to start with git. Current: pkgver = the date the package was built _gitroot = the url of the git repo _gitname = the name of the directory we check out the repo into... According to the man page, _gitname is supposed to be a branch or tag but that is all lies. What would we like to have for a flexible git package implementation? - url of the repo - be able to specify the branch/tag/commit to use (and appropriate combinations) - a decent pkgver 1) URL: There were previous patches to the mailing list that never really got finished, but I think we were fairly happy with this syntax: source=(git://projects.archlinux.org/pacman.git) source=(git@@http://projects.archlinux.org/git/pacman.git) Does it make any sense to allow the "::" syntax here? i.e. source=(git@@dirname::http://projects.archlinux.org/git/pacman.git) where dirname is the name of the directory it checked out into? I am thinking we should probably do the checkout into $vcsdir=$startdir/vcs, so this would only be needed if #1 - we supported multiple VCS checkouts in one PKGBUILD there were two that wanted to used the same name... #2 - another source file conflicted #2 is readily dealt with and I am not sure we should allow #1 (see below) so I would vote to skip it until a genuine need is shown. 2) Specifying commit to work with: I think that this is the difficult bit... the syntax with the source array is already convoluted enough, so I do not think they should be added there. So that suggests we go with assigning them to variables like _git_branch, _git_commit, _git_tag... etc. But what if we have two git sources? For example, say pacman allowed building against an internal copy of libarchive if a folder named libarchive was found in its root directory. So: source=(git://projects.archlinux.org/pacman.git git://github.com/libarchive/libarchive) build() { cd $srcdir/pacman ln -s ../libarchive ./autogen.sh ... It might seem a somewhat convoluted example, but (e.g.) gcc does allow in source tree building of many of its dependencies. The question is should we consider this outside the realms of the reasonable and state one VCS repo should be one package. I'd say 99.999% of VCS PKGBUILDs (at a lower bound) would never use two VCS sources... and the ones that do need this could do manual checking out of the non-main source within the PKGBUILD anyway. 3) pkgver Use output of "git describe" (with a s/-/_/) and fall back to "git rev-list HEAD | wc -l" (with a trailing commit id added) if there are no tags in the repo. PROTOTYPE: pkgname=pacman-git pkgver=AUTO ... source=(git://projects.archlinux.org/users/allan/pacman.git) _git_branch="working" _git_commit="8c857343" build() { cd $srcdir/pacman ./autogen.sh ... } What makepkg does: 1) goes into $vcsdir, checks for the pacman directory - if not present, do the git checkout - if present, enter and do a "git pull" unless --holdver is specified 2) enters $srcdir, and does the appropriate clone of the repo in $vscdir to be at the required branch/tag/commit 3) starts build() etc... Oh wow... you are still reading this? Well then, you are now qualified to comment on the proposal. Please stick to just concerns with the git usage at the moment, unless you see something monumental that we will not be able to support using other VCS systems using this approach. Allan From allan at archlinux.org Tue Mar 13 01:32:01 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 15:32:01 +1000 Subject: [pacman-dev] [PATCH v3 0/5] development package cleanups In-Reply-To: References: Message-ID: <4F5EDBD1.9010703@archlinux.org> On 13/03/12 11:14, Matthew Monaco wrote: > From: Matthew Monaco > > Some cleanup in the devel_check() function. The semantics aren't really > changed here. Guard against the potential to specify multiple groups of > development directives. > > Matthew Monaco (5): > makepkg: remove unused variable > makepkg: devel_check(): determine vcs > makepkg: devel_check(): consolidate common code > makepkg: devel_check(): set newpkgver (cleanup) > makepkg: devel_check(): cleanup for hg version > > scripts/makepkg.sh.in | 117 +++++++++++++++++++++++++------------------------ > 1 file changed, 59 insertions(+), 58 deletions(-) > Thanks, These all look good to me. I have pulled them to my patchqueue branch for Dan to take to master. Allan From dgbaley27 at 0x01b.net Tue Mar 13 01:36:27 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Mon, 12 Mar 2012 23:36:27 -0600 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5EC5E5.4070803@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> Message-ID: <4F5EDCDB.2000803@0x01b.net> On 03/12/2012 09:58 PM, Allan McRae wrote: > It is well know that the VCS package support in makepkg is subpar... > The number of bugs about this is into double figures. There have also > been some patches submitted attempting to be able to use the source=() > array in PKGBUILDs to specify a VCS repo and remove a lot of the > repetitive crap involved for repo checkout/updating in the current > PKGBUILDs. > > To get the ball rolling again, I think we should pick one VCS system and > flesh out what we need and what the prototype PKGBUILD would look like. > Then we can move on to the other VCS systems and finally implement it. > I guess by the time all the bikeshedding is finished, this will all be > done by 2015 and hence the subject line. :) > > > I am going to start with git. > > Current: > pkgver = the date the package was built > _gitroot = the url of the git repo > _gitname = the name of the directory we check out the repo into... > > According to the man page, _gitname is supposed to be a branch or tag > but that is all lies. > > > What would we like to have for a flexible git package implementation? > - url of the repo > - be able to specify the branch/tag/commit to use (and appropriate > combinations) > - a decent pkgver > > > 1) URL: > There were previous patches to the mailing list that never really got > finished, but I think we were fairly happy with this syntax: > > source=(git://projects.archlinux.org/pacman.git) > source=(git@@http://projects.archlinux.org/git/pacman.git) > > Does it make any sense to allow the "::" syntax here? i.e. > source=(git@@dirname::http://projects.archlinux.org/git/pacman.git) > > where dirname is the name of the directory it checked out into? I am > thinking we should probably do the checkout into $vcsdir=$startdir/vcs, > so this would only be needed if > #1 - we supported multiple VCS checkouts in one PKGBUILD there were two > that wanted to used the same name... > #2 - another source file conflicted > > #2 is readily dealt with and I am not sure we should allow #1 (see > below) so I would vote to skip it until a genuine need is shown. > > > 2) Specifying commit to work with: > I think that this is the difficult bit... the syntax with the source > array is already convoluted enough, so I do not think they should be > added there. So that suggests we go with assigning them to variables > like _git_branch, _git_commit, _git_tag... etc. > > But what if we have two git sources? For example, say pacman allowed > building against an internal copy of libarchive if a folder named > libarchive was found in its root directory. So: > > source=(git://projects.archlinux.org/pacman.git > git://github.com/libarchive/libarchive) > refs=(master v3.14.1) ? Non-vcs sources shouldn't need a placeholder or anything like that. Of course, instead of sources there could be a repos=() array or something like that. This would alleviate the syntactic issue of trying to specify a repo, (optional) dir to clone into, and ref to checkout in a succinct way. repos=([dir::]url[::ref]) > build() > { > cd $srcdir/pacman > ln -s ../libarchive > ./autogen.sh > ... > > It might seem a somewhat convoluted example, but (e.g.) gcc does allow > in source tree building of many of its dependencies. The question is > should we consider this outside the realms of the reasonable and state > one VCS repo should be one package. I'd say 99.999% of VCS PKGBUILDs > (at a lower bound) would never use two VCS sources... and the ones that > do need this could do manual checking out of the non-main source within > the PKGBUILD anyway. > > > 3) pkgver > Use output of "git describe" (with a s/-/_/) and fall back to "git > rev-list HEAD | wc -l" (with a trailing commit id added) if there are no > tags in the repo. > What if there are no tags in the repo, and for whatever reason the PKGBUILD switches to a different branch? The number of commits just doesn't seem that stable. Is it at all feasible to just use the build date for package ordering if it's a vcs package? This way the pkgver can be the ref that was checked out: - the short hash - the tag - the branch (_short hash maybe OR only automatically bump the pkgrel) > > PROTOTYPE: > > pkgname=pacman-git > pkgver=AUTO > ... > source=(git://projects.archlinux.org/users/allan/pacman.git) > _git_branch="working" > _git_commit="8c857343" > Are these looking forward to other VCS's though? What scenario is more than one ref needed? Makepkg would just be doing a checkout right? > build() > { > cd $srcdir/pacman > ./autogen.sh > ... > } > > > What makepkg does: > 1) goes into $vcsdir, checks for the pacman directory > - if not present, do the git checkout > - if present, enter and do a "git pull" unless --holdver is specified > 2) enters $srcdir, and does the appropriate clone of the repo in $vscdir > to be at the required branch/tag/commit > 3) starts build() etc... > Seems like there's a lot of stuff that can be shared up front, but at some point there are really two different types of VCS packages: those that should pull automatically every time the pkg is built (branch), and those that use vcs for obtaining the source, but are really meant to target a specific version (tag,commit). In general, I'll say that I really don't like makepkg manipulating my PKGBUILDs. So it'd be cool if all of this produced sane package versions in the built package, but didn't need to touch the PKGBUILD itself. > > > Oh wow... you are still reading this? Well then, you are now > qualified to comment on the proposal. Please stick to just concerns > with the git usage at the moment, unless you see something monumental > that we will not be able to support using other VCS systems using this > approach. > > Allan > From allan at archlinux.org Tue Mar 13 04:21:31 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 18:21:31 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5EDCDB.2000803@0x01b.net> References: <4F5EC5E5.4070803@archlinux.org> <4F5EDCDB.2000803@0x01b.net> Message-ID: <4F5F038B.7000904@archlinux.org> On 13/03/12 15:36, Matthew Monaco wrote: > On 03/12/2012 09:58 PM, Allan McRae wrote: >> 2) Specifying commit to work with: >> I think that this is the difficult bit... the syntax with the source >> array is already convoluted enough, so I do not think they should be >> added there. So that suggests we go with assigning them to variables >> like _git_branch, _git_commit, _git_tag... etc. >> >> But what if we have two git sources? For example, say pacman allowed >> building against an internal copy of libarchive if a folder named >> libarchive was found in its root directory. So: >> >> source=(git://projects.archlinux.org/pacman.git >> git://github.com/libarchive/libarchive) >> > > refs=(master > v3.14.1) > ? > > Non-vcs sources shouldn't need a placeholder or anything like that. > > Of course, instead of sources there could be a repos=() array or something like > that. This would alleviate the syntactic issue of trying to specify a repo, > (optional) dir to clone into, and ref to checkout in a succinct way. > > repos=([dir::]url[::ref]) I would really prefer not to have a new array for the repo source. Part of the attraction of getting all this into the source array is that we only have to look in one place to see where the source came from. >> build() >> { >> cd $srcdir/pacman >> ln -s ../libarchive >> ./autogen.sh >> ... >> >> It might seem a somewhat convoluted example, but (e.g.) gcc does allow >> in source tree building of many of its dependencies. The question is >> should we consider this outside the realms of the reasonable and state >> one VCS repo should be one package. I'd say 99.999% of VCS PKGBUILDs >> (at a lower bound) would never use two VCS sources... and the ones that >> do need this could do manual checking out of the non-main source within >> the PKGBUILD anyway. >> >> >> 3) pkgver >> Use output of "git describe" (with a s/-/_/) and fall back to "git >> rev-list HEAD | wc -l" (with a trailing commit id added) if there are no >> tags in the repo. >> > > What if there are no tags in the repo, and for whatever reason the PKGBUILD > switches to a different branch? The number of commits just doesn't seem that stable. No tags in the repo is covered by the rev-list option. I agree that these numbers are not particularly stable (with switching branches etc), but I would assume that someone providing a repo with a VCS package will not be branch hopping too often and for local packaging it really does not matter. > Is it at all feasible to just use the build date for package ordering if it's a > vcs package? This way the pkgver can be the ref that was checked out: > > - the short hash > - the tag > - the branch (_short hash maybe OR only automatically bump the pkgrel) I would really like to move away from the build date having anything to do with package ordering as it is entirely non-deterministic about what is in a package. Also, that would require pacman to know which packages were built from a VCS style PKGBUILD and all the extra tracking to implement that... >> >> PROTOTYPE: >> >> pkgname=pacman-git >> pkgver=AUTO >> ... >> source=(git://projects.archlinux.org/users/allan/pacman.git) >> _git_branch="working" >> _git_commit="8c857343" >> > > Are these looking forward to other VCS's though? What scenario is more than one > ref needed? Makepkg would just be doing a checkout right? This might be me not understanding some of the subtleties of git, but this is what I see as options for building from a git repo... 1) build from master HEAD 2) build from a branch HEAD 3) build from a given commit/tag So, assuming that the git repo is checked out from upstream in $vcsdir, the command needed for each of these is: 1) git clone --branch master $vcsdir [*] 2) git clone --branch $vcsdir 3) git clone $vcsdir; git checkout [*] this fails if the default branch upstream is not master, but does allow you to either do some work in the copy in $vcsdir or have your PKGBUILD git source point to a local copy of a git repo that you actually do work in... Anyway, from what I can see from those three use cases is that to be flexible here, we need to be able to specify a branch or a ref (commit/tag). I'm not sure how to differentiate the two without assigning them to different variables. And while it is not necessary, I would find it useful to have the branch specified even when the commit/tag is used more for documentation than anything else. >> build() >> { >> cd $srcdir/pacman >> ./autogen.sh >> ... >> } >> >> >> What makepkg does: >> 1) goes into $vcsdir, checks for the pacman directory >> - if not present, do the git checkout >> - if present, enter and do a "git pull" unless --holdver is specified >> 2) enters $srcdir, and does the appropriate clone of the repo in $vscdir >> to be at the required branch/tag/commit >> 3) starts build() etc... >> > > Seems like there's a lot of stuff that can be shared up front, but at some point > there are really two different types of VCS packages: those that should pull > automatically every time the pkg is built (branch), and those that use vcs for > obtaining the source, but are really meant to target a specific version > (tag,commit). There is quite some overlap there... I quite often have commits on my local pacman working branch that I do not want running on my live system just yet. So my pacman-git package gets built from my working branch with the last commit I am happy with optionally specified. > In general, I'll say that I really don't like makepkg manipulating my PKGBUILDs. > So it'd be cool if all of this produced sane package versions in the built > package, but didn't need to touch the PKGBUILD itself. I tend to agree about makepkg not adjusting PKGBUILDs. Although, it does have the advantage that after building a package, you can "makepkg --source" and send that archive to someone and they will be able to build the exact same package as you using the --holdver flag (or at least will be able to when --holdver works...). Allan From thomas at archlinux.org Tue Mar 13 06:13:11 2012 From: thomas at archlinux.org (=?ISO-8859-15?Q?Thomas_B=E4chler?=) Date: Tue, 13 Mar 2012 11:13:11 +0100 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5EC5E5.4070803@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> Message-ID: <4F5F1DB7.7060000@archlinux.org> Am 13.03.2012 04:58, schrieb Allan McRae: > To get the ball rolling again, I think we should pick one VCS system and > flesh out what we need and what the prototype PKGBUILD would look like. > Then we can move on to the other VCS systems and finally implement it. > I guess by the time all the bikeshedding is finished, this will all be > done by 2015 and hence the subject line. :) Thank God - or Allan. > I am going to start with git. > > Current: > pkgver = the date the package was built > _gitroot = the url of the git repo > _gitname = the name of the directory we check out the repo into... > > According to the man page, _gitname is supposed to be a branch or tag > but that is all lies. One shortcoming: No way to use more than one git repo. > What would we like to have for a flexible git package implementation? > - url of the repo > - be able to specify the branch/tag/commit to use (and appropriate > combinations) > - a decent pkgver - More than one git repo per PKGBUILD (?) > 1) URL: > There were previous patches to the mailing list that never really got > finished, but I think we were fairly happy with this syntax: > > source=(git://projects.archlinux.org/pacman.git) > source=(git@@http://projects.archlinux.org/git/pacman.git) > > Does it make any sense to allow the "::" syntax here? i.e. > source=(git@@dirname::http://projects.archlinux.org/git/pacman.git) > > where dirname is the name of the directory it checked out into? I am > thinking we should probably do the checkout into $vcsdir=$startdir/vcs, > so this would only be needed if > #1 - we supported multiple VCS checkouts in one PKGBUILD there were two > that wanted to used the same name... > #2 - another source file conflicted > > #2 is readily dealt with and I am not sure we should allow #1 (see > below) so I would vote to skip it until a genuine need is shown. When using tarballs, we just extract them, and we don't care if two tarballs extract into the same directory. We should make this consistent (and thus equally stupid): If we check out pacman.git, call the directory pacman/. I didn't even know the :: syntax, but: The :: syntax is for downloaded file names, not for renaming the directory we extract into. For consistency, it should not be supported here. > 2) Specifying commit to work with: > I think that this is the difficult bit... the syntax with the source > array is already convoluted enough, so I do not think they should be > added there. So that suggests we go with assigning them to variables > like _git_branch, _git_commit, _git_tag... etc. > > But what if we have two git sources? For example, say pacman allowed > building against an internal copy of libarchive if a folder named > libarchive was found in its root directory. So: > > source=(git://projects.archlinux.org/pacman.git > git://github.com/libarchive/libarchive) > > build() > { > cd $srcdir/pacman > ln -s ../libarchive > ./autogen.sh > ... > > It might seem a somewhat convoluted example, but (e.g.) gcc does allow > in source tree building of many of its dependencies. The question is > should we consider this outside the realms of the reasonable and state > one VCS repo should be one package. I'd say 99.999% of VCS PKGBUILDs > (at a lower bound) would never use two VCS sources... and the ones that > do need this could do manual checking out of the non-main source within > the PKGBUILD anyway. I am all for consistency here (again) - we allow multiple tarballs as source, so we should also allow multiple VCS repos as source. And this would force us to put the commit name into the URL in the source array. I don't see the real problem here, we could just have a nice syntax for git URLs. What would be the problem with $VCS:$URL@$COMMIT? GIT:git://projects.archlinux.org/pacman.git at maint SVN:ssh://svn.foo.com/bar at 12345 It's readable and intuitive. (The @ might be a problem when you put user names in the URL, but we could just use @@ or so.) > 3) pkgver > Use output of "git describe" (with a s/-/_/) and fall back to "git > rev-list HEAD | wc -l" (with a trailing commit id added) if there are no > tags in the repo. 'git describe' is nice as it sorts well with vercmp (if the tag names are friendly enough). With my proposal about allowing arbitrarily many VCS sources, we should just make it a convention to use the first VCS source for the version - or make it configurable in pkgver. > PROTOTYPE: > > pkgname=pacman-git > pkgver=AUTO > ... > source=(git://projects.archlinux.org/users/allan/pacman.git) > _git_branch="working" > _git_commit="8c857343" > > build() > { > cd $srcdir/pacman > ./autogen.sh > ... > } Obviously, I don't like that, as pointed out above. I do like the pkgver=AUTO - makepkg should leave the pkgver alone if it isn't set to AUTO. > What makepkg does: > 1) goes into $vcsdir, checks for the pacman directory > - if not present, do the git checkout > - if present, enter and do a "git pull" unless --holdver is specified This should be a path under SRCDIR. This should also be a bare clone without working copy. > 2) enters $srcdir, and does the appropriate clone of the repo in $vscdir > to be at the required branch/tag/commit > 3) starts build() etc... ACK. > Oh wow... you are still reading this? Hell yes! > Well then, you are now qualified to comment on the proposal. Thanks, thou shallt not be disappointed. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From thomas at archlinux.org Tue Mar 13 06:25:06 2012 From: thomas at archlinux.org (=?ISO-8859-15?Q?Thomas_B=E4chler?=) Date: Tue, 13 Mar 2012 11:25:06 +0100 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F038B.7000904@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5EDCDB.2000803@0x01b.net> <4F5F038B.7000904@archlinux.org> Message-ID: <4F5F2082.50300@archlinux.org> Am 13.03.2012 09:21, schrieb Allan McRae: >> Is it at all feasible to just use the build date for package ordering if it's a >> vcs package? This way the pkgver can be the ref that was checked out: >> >> - the short hash >> - the tag >> - the branch (_short hash maybe OR only automatically bump the pkgrel) > > I would really like to move away from the build date having anything to > do with package ordering as it is entirely non-deterministic about what > is in a package. I cannot ACK that enough. Please, no build dates! >>> source=(git://projects.archlinux.org/users/allan/pacman.git) >>> _git_branch="working" >>> _git_commit="8c857343" >>> >> >> Are these looking forward to other VCS's though? What scenario is more than one >> ref needed? Makepkg would just be doing a checkout right? > > This might be me not understanding some of the subtleties of git, but > this is what I see as options for building from a git repo... > > 1) build from master HEAD > 2) build from a branch HEAD > 3) build from a given commit/tag > > So, assuming that the git repo is checked out from upstream in $vcsdir, > the command needed for each of these is: > > 1) git clone --branch master $vcsdir [*] > 2) git clone --branch $vcsdir > 3) git clone $vcsdir; git checkout You complicate things A LOT here. Specifying the branch and commit separately is nonsense. The commit id already tells you exactly where you want to be. This is the right thing to do: $ git clone $vcsdir $ git checkout -b makepkg $ref Here, $ref can be a tag name, a branch name, a commit id or an abbreviated commit id - everything git understands as a refspec. Let's just give git a single refspec and let it handle the rest. (I just realized I might be slightly wrong here, as we refer to branch and tag names in a remote repository of a remote repository - but I am sure some magic exists here that will make it just as easy as I described, Dan probably knows.) This is what you don't seem to understand: Once you have the commit id, the branch name has no relevance anymore. You only need the branch name when referencing the head of that branch. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From allan at archlinux.org Tue Mar 13 06:36:29 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 20:36:29 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F1DB7.7060000@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5F1DB7.7060000@archlinux.org> Message-ID: <4F5F232D.2040307@archlinux.org> On 13/03/12 20:13, Thomas B?chler wrote: >> What makepkg does: >> > 1) goes into $vcsdir, checks for the pacman directory >> > - if not present, do the git checkout >> > - if present, enter and do a "git pull" unless --holdver is specified > This should be a path under SRCDIR. This should also be a bare clone > without working copy. Query, do you mean $srcdir or $SRCDEST there? Also, do you mean a bare (--bare) clone or a shallow (--depth 1) clone? As far as I know, a bare clone can not be updated. I am also not convinced about shallow clones... For glibc, (~20,000 commits), this save a little less that 20% of the size. Apparently, for the entire GNOME git repos, it saves only 10%. That comes at a disadvantage of not being able to clone it into $srcdir (which uses hardlinks when possible so saves space). Well, there is a hack that allows you to do so but it could break at any time... Allan From thomas at archlinux.org Tue Mar 13 06:39:04 2012 From: thomas at archlinux.org (=?ISO-8859-15?Q?Thomas_B=E4chler?=) Date: Tue, 13 Mar 2012 11:39:04 +0100 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F232D.2040307@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5F1DB7.7060000@archlinux.org> <4F5F232D.2040307@archlinux.org> Message-ID: <4F5F23C8.2080505@archlinux.org> Am 13.03.2012 11:36, schrieb Allan McRae: > On 13/03/12 20:13, Thomas B?chler wrote: >>> What makepkg does: >>>> 1) goes into $vcsdir, checks for the pacman directory >>>> - if not present, do the git checkout >>>> - if present, enter and do a "git pull" unless --holdver is specified >> This should be a path under SRCDIR. This should also be a bare clone >> without working copy. > > Query, do you mean $srcdir or $SRCDEST there? Ehm, SRCDEST, sorry :) > Also, do you mean a bare (--bare) clone or a shallow (--depth 1) clone? > As far as I know, a bare clone can not be updated. Of course a bare clone can be updated (man git-fetch). Only git pull won't work. Also, regarding the problem in my other mail: git clone --mirror might be the right thing. > I am also not convinced about shallow clones... For glibc, (~20,000 > commits), this save a little less that 20% of the size. Apparently, for > the entire GNOME git repos, it saves only 10%. That comes at a > disadvantage of not being able to clone it into $srcdir (which uses > hardlinks when possible so saves space). Well, there is a hack that > allows you to do so but it could break at any time... Shallow is not useful, you might want to check out old commits or different branches. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From allan at archlinux.org Tue Mar 13 06:54:41 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 20:54:41 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F23C8.2080505@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5F1DB7.7060000@archlinux.org> <4F5F232D.2040307@archlinux.org> <4F5F23C8.2080505@archlinux.org> Message-ID: <4F5F2771.5050003@archlinux.org> On 13/03/12 20:39, Thomas B?chler wrote: > Am 13.03.2012 11:36, schrieb Allan McRae: >> On 13/03/12 20:13, Thomas B?chler wrote: >>>> What makepkg does: >>>>> 1) goes into $vcsdir, checks for the pacman directory >>>>> - if not present, do the git checkout >>>>> - if present, enter and do a "git pull" unless --holdver is specified >>> This should be a path under SRCDIR. This should also be a bare clone >>> without working copy. >> >> Query, do you mean $srcdir or $SRCDEST there? > > Ehm, SRCDEST, sorry :) > >> Also, do you mean a bare (--bare) clone or a shallow (--depth 1) clone? >> As far as I know, a bare clone can not be updated. > > Of course a bare clone can be updated (man git-fetch). Only git pull > won't work. Also, regarding the problem in my other mail: git clone > --mirror might be the right thing. > Oh... cool. Learnt something new today. I did not know that could be done. Allan From allan at archlinux.org Tue Mar 13 07:05:14 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 21:05:14 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F2082.50300@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5EDCDB.2000803@0x01b.net> <4F5F038B.7000904@archlinux.org> <4F5F2082.50300@archlinux.org> Message-ID: <4F5F29EA.4010606@archlinux.org> On 13/03/12 20:25, Thomas B?chler wrote: > Am 13.03.2012 09:21, schrieb Allan McRae: >>> Is it at all feasible to just use the build date for package ordering if it's a >>> vcs package? This way the pkgver can be the ref that was checked out: >>> >>> - the short hash >>> - the tag >>> - the branch (_short hash maybe OR only automatically bump the pkgrel) >> >> I would really like to move away from the build date having anything to >> do with package ordering as it is entirely non-deterministic about what >> is in a package. > > I cannot ACK that enough. Please, no build dates! > >>>> source=(git://projects.archlinux.org/users/allan/pacman.git) >>>> _git_branch="working" >>>> _git_commit="8c857343" >>>> >>> >>> Are these looking forward to other VCS's though? What scenario is more than one >>> ref needed? Makepkg would just be doing a checkout right? >> >> This might be me not understanding some of the subtleties of git, but >> this is what I see as options for building from a git repo... >> >> 1) build from master HEAD >> 2) build from a branch HEAD >> 3) build from a given commit/tag >> >> So, assuming that the git repo is checked out from upstream in $vcsdir, >> the command needed for each of these is: >> >> 1) git clone --branch master $vcsdir [*] >> 2) git clone --branch $vcsdir >> 3) git clone $vcsdir; git checkout > > You complicate things A LOT here. Specifying the branch and commit > separately is nonsense. The commit id already tells you exactly where > you want to be. This is the right thing to do: Just to be clear, you do realize these are not three commands to be run one after the other but the way I was thinking about achieving each of the three usages scenarios I gave above? > $ git clone $vcsdir > $ git checkout -b makepkg $ref > > Here, $ref can be a tag name, a branch name, a commit id or an > abbreviated commit id - everything git understands as a refspec. Let's > just give git a single refspec and let it handle the rest. > > (I just realized I might be slightly wrong here, as we refer to branch > and tag names in a remote repository of a remote repository - but I am > sure some magic exists here that will make it just as easy as I > described, Dan probably knows.) > > This is what you don't seem to understand: Once you have the commit id, > the branch name has no relevance anymore. You only need the branch name > when referencing the head of that branch. > I do understand the branch name is useless once you have a tag/commit id. That is why later in the email I said it only really serves as documentation. What I was trying to avoid is the need to specify (e.g.) "origin/maint" as the branch. The "origin/" part just seems redundant and the I was trying to remove as much redundancy across PKGBUILDs as possible here. Of course I also see that having separate methods to specify a branch and a ref/tag is redundant too... In the end there is probably no such thing as perfection here. Allan From bluewind at xinu.at Tue Mar 13 07:20:48 2012 From: bluewind at xinu.at (Florian Pritz) Date: Tue, 13 Mar 2012 12:20:48 +0100 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F29EA.4010606@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5EDCDB.2000803@0x01b.net> <4F5F038B.7000904@archlinux.org> <4F5F2082.50300@archlinux.org> <4F5F29EA.4010606@archlinux.org> Message-ID: <4F5F2D90.6000001@xinu.at> On 13.03.2012 12:05, Allan McRae wrote: > I do understand the branch name is useless once you have a tag/commit > id. That is why later in the email I said it only really serves as > documentation. Use comments for that. -- Florian Pritz -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: From dpmcgee at gmail.com Tue Mar 13 07:23:28 2012 From: dpmcgee at gmail.com (Dan McGee) Date: Tue, 13 Mar 2012 07:23:28 -0400 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F2D90.6000001@xinu.at> References: <4F5EC5E5.4070803@archlinux.org> <4F5EDCDB.2000803@0x01b.net> <4F5F038B.7000904@archlinux.org> <4F5F2082.50300@archlinux.org> <4F5F29EA.4010606@archlinux.org> <4F5F2D90.6000001@xinu.at> Message-ID: On Tue, Mar 13, 2012 at 7:20 AM, Florian Pritz wrote: > On 13.03.2012 12:05, Allan McRae wrote: >> I do understand the branch name is useless once you have a tag/commit >> id. ?That is why later in the email I said it only really serves as >> documentation. > > Use comments for that. So just how do you propose using a comment to describe origin/maint in the pacman repository to build my pacman-maint-git package? I don't follow this logic one bit...you clearly need to use a branch name, not some arbitrary sha1 that never moves forward with new commits... -Dan From allan at archlinux.org Tue Mar 13 07:33:47 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 21:33:47 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: References: <4F5EC5E5.4070803@archlinux.org> <4F5EDCDB.2000803@0x01b.net> <4F5F038B.7000904@archlinux.org> <4F5F2082.50300@archlinux.org> <4F5F29EA.4010606@archlinux.org> <4F5F2D90.6000001@xinu.at> Message-ID: <4F5F309B.10103@archlinux.org> On 13/03/12 21:23, Dan McGee wrote: > On Tue, Mar 13, 2012 at 7:20 AM, Florian Pritz wrote: >> On 13.03.2012 12:05, Allan McRae wrote: >>> I do understand the branch name is useless once you have a tag/commit >>> id. That is why later in the email I said it only really serves as >>> documentation. >> >> Use comments for that. > > So just how do you propose using a comment to describe origin/maint in > the pacman repository to build my pacman-maint-git package? I don't > follow this logic one bit...you clearly need to use a branch name, not > some arbitrary sha1 that never moves forward with new commits... I think context is needed here... I said the branch name is only really useful as documentation _if_ we are building for a specified commit. The three cases I see as needing covered are: 1) build from master HEAD 2) build from a branch HEAD 3) build from a given commit/tag What we need to find is the simplest way of allowing these (and other reasonable suggestion that arises...). Allan From bluewind at xinu.at Tue Mar 13 07:41:40 2012 From: bluewind at xinu.at (Florian Pritz) Date: Tue, 13 Mar 2012 12:41:40 +0100 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5EC5E5.4070803@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> Message-ID: <4F5F3274.80306@xinu.at> On 13.03.2012 04:58, Allan McRae wrote: > 1) URL: > There were previous patches to the mailing list that never really got > finished, but I think we were fairly happy with this syntax: > > source=(git://projects.archlinux.org/pacman.git) > source=(git@@http://projects.archlinux.org/git/pacman.git) > > Does it make any sense to allow the "::" syntax here? i.e. > source=(git@@dirname::http://projects.archlinux.org/git/pacman.git) If you want to allow multiple sources of the same project, please don't clone them into multiple directories. You'd just duplicate all objects they share (which could be many). Better cd into the one you already have and simply add a new remote. I don't like the @@ and :: syntax. Maybe "git://remotename//http://projects.archlinux.org/git/pacman.git"? That way we can simply look for "git://" and also easily figure out if there is a remote name or not. "//" should also be a safe delimiter because in the URL it would be collapsed to "/" anyway. > 2) Specifying commit to work with: > I think that this is the difficult bit... the syntax with the source > array is already convoluted enough, so I do not think they should be > added there. So that suggests we go with assigning them to variables > like _git_branch, _git_commit, _git_tag... etc. > > But what if we have two git sources? For example, say pacman allowed > building against an internal copy of libarchive if a folder named > libarchive was found in its root directory. So: > > source=(git://projects.archlinux.org/pacman.git > git://github.com/libarchive/libarchive) source=("git://foo " "git://2ndfoo/bar.git ") I'll just assume git allows urlencoded URLs so even if the git URL contained a space you could make it "%20". This is simple, clear and doesn't introduce any forbidden characters in the URL. If is ommited, we should just clone/add the remote and leave HEAD alone. If it is there we checkout. This also means if there are multiple git URLs with the same name the last refspec wins. -- Florian Pritz -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: From dpmcgee at gmail.com Tue Mar 13 07:53:13 2012 From: dpmcgee at gmail.com (Dan McGee) Date: Tue, 13 Mar 2012 07:53:13 -0400 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F3274.80306@xinu.at> References: <4F5EC5E5.4070803@archlinux.org> <4F5F3274.80306@xinu.at> Message-ID: On Tue, Mar 13, 2012 at 7:41 AM, Florian Pritz wrote: > On 13.03.2012 04:58, Allan McRae wrote: >> 1) URL: >> There were previous patches to the mailing list that never really got >> finished, but I think we were fairly happy with this syntax: >> >> source=(git://projects.archlinux.org/pacman.git) >> source=(git@@http://projects.archlinux.org/git/pacman.git) >> >> Does it make any sense to allow the "::" syntax here? ?i.e. >> source=(git@@dirname::http://projects.archlinux.org/git/pacman.git) > > If you want to allow multiple sources of the same project, please don't > clone them into multiple directories. You'd just duplicate all objects > they share (which could be many). > > Better cd into the one you already have and simply add a new remote. I don't think this was the case anyone was talking about here. More like sources from: git://code.example.com/project.git git://code.example.com/project-extras.git > I don't like the @@ and :: syntax. Maybe > "git://remotename//http://projects.archlinux.org/git/pacman.git"? That > way we can simply look for "git://" and also easily figure out if there > is a remote name or not. "//" should also be a safe delimiter because in > the URL it would be collapsed to "/" anyway. Heck no, minus -1000. We are **not** reinventing a URL syntax. This is confusing, misleading, and awful. Look at this: git://remotename//git://projects.archlinux.org/pacman.git I don't even know what remotename is (but if that can contain a '/', my eyes will really bleed). The double URL specifier (using the same protocol twice!!) is likely not allowable or recommended by http://tools.ietf.org/html/rfc3986. If you are trying to stick with URI/URL format, I'd much rather see git+http:// in this case, which is a lot like the 'svn+ssh://' protocol you can use, etc. And then use fragment identifiers perhaps (RFC 3986, 3.5, '#branchname') to identify the branch name. -Dan From allan at archlinux.org Tue Mar 13 08:15:04 2012 From: allan at archlinux.org (Allan McRae) Date: Tue, 13 Mar 2012 22:15:04 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: References: <4F5EC5E5.4070803@archlinux.org> <4F5F3274.80306@xinu.at> Message-ID: <4F5F3A48.5040105@archlinux.org> On 13/03/12 21:53, Dan McGee wrote: > On Tue, Mar 13, 2012 at 7:41 AM, Florian Pritz wrote: >> On 13.03.2012 04:58, Allan McRae wrote: >>> 1) URL: >>> There were previous patches to the mailing list that never really got >>> finished, but I think we were fairly happy with this syntax: >>> >>> source=(git://projects.archlinux.org/pacman.git) >>> source=(git@@http://projects.archlinux.org/git/pacman.git) >>> >>> Does it make any sense to allow the "::" syntax here? i.e. >>> source=(git@@dirname::http://projects.archlinux.org/git/pacman.git) >> >> If you want to allow multiple sources of the same project, please don't >> clone them into multiple directories. You'd just duplicate all objects >> they share (which could be many). >> >> Better cd into the one you already have and simply add a new remote. > I don't think this was the case anyone was talking about here. More > like sources from: > git://code.example.com/project.git > git://code.example.com/project-extras.git > >> I don't like the @@ and :: syntax. Maybe >> "git://remotename//http://projects.archlinux.org/git/pacman.git"? That >> way we can simply look for "git://" and also easily figure out if there >> is a remote name or not. "//" should also be a safe delimiter because in >> the URL it would be collapsed to "/" anyway. > Heck no, minus -1000. We are **not** reinventing a URL syntax. This is > confusing, misleading, and awful. Look at this: > git://remotename//git://projects.archlinux.org/pacman.git > > I don't even know what remotename is (but if that can contain a '/', > my eyes will really bleed). The double URL specifier (using the same > protocol twice!!) is likely not allowable or recommended by > http://tools.ietf.org/html/rfc3986. > > If you are trying to stick with URI/URL format, I'd much rather see > git+http:// in this case, which is a lot like the 'svn+ssh://' > protocol you can use, etc. And then use fragment identifiers perhaps > (RFC 3986, 3.5, '#branchname') to identify the branch name. Hmm... good idea using the fragment identifier for specifying the branch/tag/commit to checkout. Being inspired by how pypi uses these to provide checksums, could I even suggest: #branch=maint #tag=v4.0.1 #commit=f42ad345 This gives full clarity to what is being specified an allows for potential cases where branches and tags have the same name and we could provide multiple options, semicolon separated, if needed (obviously not for git, but maybe for another VSC system). Allan From thomas at archlinux.org Tue Mar 13 08:16:12 2012 From: thomas at archlinux.org (=?ISO-8859-15?Q?Thomas_B=E4chler?=) Date: Tue, 13 Mar 2012 13:16:12 +0100 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F309B.10103@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5EDCDB.2000803@0x01b.net> <4F5F038B.7000904@archlinux.org> <4F5F2082.50300@archlinux.org> <4F5F29EA.4010606@archlinux.org> <4F5F2D90.6000001@xinu.at> <4F5F309B.10103@archlinux.org> Message-ID: <4F5F3A8C.4020205@archlinux.org> Am 13.03.2012 12:33, schrieb Allan McRae: > The three cases I see as needing covered are: > > 1) build from master HEAD > 2) build from a branch HEAD > 3) build from a given commit/tag > > > What we need to find is the simplest way of allowing these (and other > reasonable suggestion that arises...). My point was that from git's perspective, those are not different cases. The only annoying thing is the origin/ for branch names which we need to get around somehow. I will throw in another suggestion which should solve some of those problems: To get the source: cd $vcsdir git clone --mirror $url or cd $vcsdir/$reponame git fetch cd $srcdir GIT_DIR=$vcsdir/$reponame git archive --format=tar --prefix=$reponame/ $refspec | bsdtar -xf - To get the version: GIT_DIR=$vcsdir/$reponame git describe $refspec Disadvantage: - The "checkout" itself is not a git tree, so build() cannot use any git commands (some projects use git commands internally in their Makefiles, so this might be bad) Advantage: - Due to clone --mirror, we have all remote branch names as local branch names, so we don't need to care whether $refspec is a branch name or not. As we don't clone again, we don't lose those names. That disadvantage is big (breaks kernel and syslinux git snapshot versioning), so I am still not convinced. My main point is: We must find a way to make sure we (==makepkg) don't need to care about whether $refspec is a branch, tag or commit. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From mysatyre at gmail.com Tue Mar 13 08:58:21 2012 From: mysatyre at gmail.com (Martti =?iso-8859-1?Q?K=FChne?=) Date: Tue, 13 Mar 2012 13:58:21 +0100 Subject: [pacman-dev] [PATCH 5/6] makepkg: devel_check(): only work for -vcs pkgnames In-Reply-To: <4F5E8CCC.1060803@0x01b.net> References: <1331578395-11782-1-git-send-email-dgbaley27@0x01b.net> <1331578395-11782-6-git-send-email-dgbaley27@0x01b.net> <4F5E82CB.3070202@archlinux.org> <4F5E8CCC.1060803@0x01b.net> Message-ID: <20120313125821.GA23014@deepthought> On Mon, Mar 12, 2012 at 05:54:52PM -0600, Matthew Monaco wrote: > On 03/12/2012 05:12 PM, Allan McRae wrote: > > I thought that requiring a package to be named appropriately to be considered a > development package was at least worthy of discussion. > Why not display a warning? Automagically modifying things is very unlike what pacman tools do, but vcs naming conventions are something I'd like to see encouraged. Since I'm currently out of aur helpers, I search for packages manually by name and missing packages because they don't stick to the convention is something I'd like to avoid. So, while we're at it, what other approaches on this can you suggest? Downloading pkgbuilds and checking the way mathew's code does now? cheers! mar77i From dgbaley27 at 0x01b.net Tue Mar 13 11:49:31 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Tue, 13 Mar 2012 09:49:31 -0600 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F3A48.5040105@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5F3274.80306@xinu.at> <4F5F3A48.5040105@archlinux.org> Message-ID: <4F5F6C8B.5060300@0x01b.net> On 03/13/2012 06:15 AM, Allan McRae wrote: > > Hmm... good idea using the fragment identifier for specifying the > branch/tag/commit to checkout. Being inspired by how pypi uses these to > provide checksums, could I even suggest: > > #branch=maint > #tag=v4.0.1 > #commit=f42ad345 > > This gives full clarity to what is being specified an allows for > potential cases where branches and tags have the same name and we could > provide multiple options, semicolon separated, if needed (obviously not > for git, but maybe for another VSC system). > That makes tag/commit unable to move forward automatically unless you can always specify a branch and then optionally a tag/commit. There are ways to get the children of a commit though; makepkg could move to the tip of the branch if there's only one child and complain if there's more. From allan at archlinux.org Tue Mar 13 11:53:53 2012 From: allan at archlinux.org (Allan McRae) Date: Wed, 14 Mar 2012 01:53:53 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F6C8B.5060300@0x01b.net> References: <4F5EC5E5.4070803@archlinux.org> <4F5F3274.80306@xinu.at> <4F5F3A48.5040105@archlinux.org> <4F5F6C8B.5060300@0x01b.net> Message-ID: <4F5F6D91.7030206@archlinux.org> On 14/03/12 01:49, Matthew Monaco wrote: > On 03/13/2012 06:15 AM, Allan McRae wrote: >> >> Hmm... good idea using the fragment identifier for specifying the >> branch/tag/commit to checkout. Being inspired by how pypi uses these to >> provide checksums, could I even suggest: >> >> #branch=maint >> #tag=v4.0.1 >> #commit=f42ad345 >> >> This gives full clarity to what is being specified an allows for >> potential cases where branches and tags have the same name and we could >> provide multiple options, semicolon separated, if needed (obviously not >> for git, but maybe for another VSC system). >> > > That makes tag/commit unable to move forward automatically unless you can always > specify a branch and then optionally a tag/commit. There are ways to get the > children of a commit though; makepkg could move to the tip of the branch if > there's only one child and complain if there's more. > Everything there is optional. If you do not specify any of a branch/tag/commit, then makepkg would build from the head of the master branch. If you specify a branch, makepkg builds from the head of that branch. If you specify a commit/tag, makepkg builds from that commit/tag. Allan From thomas at archlinux.org Tue Mar 13 12:12:58 2012 From: thomas at archlinux.org (=?ISO-8859-15?Q?Thomas_B=E4chler?=) Date: Tue, 13 Mar 2012 17:12:58 +0100 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F3A48.5040105@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5F3274.80306@xinu.at> <4F5F3A48.5040105@archlinux.org> Message-ID: <4F5F720A.6000406@archlinux.org> Am 13.03.2012 13:15, schrieb Allan McRae: > #branch=maint > #tag=v4.0.1 > #commit=f42ad345 > > This gives full clarity to what is being specified an allows for > potential cases where branches and tags have the same name and we could > provide multiple options, semicolon separated, if needed (obviously not > for git, but maybe for another VSC system). Actually, this seems saner than everything I proposed. I ACK it in principle. One question: Why do you distinguish between tag and commit? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From allan at archlinux.org Tue Mar 13 12:24:29 2012 From: allan at archlinux.org (Allan McRae) Date: Wed, 14 Mar 2012 02:24:29 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5F720A.6000406@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F5F3274.80306@xinu.at> <4F5F3A48.5040105@archlinux.org> <4F5F720A.6000406@archlinux.org> Message-ID: <4F5F74BD.9050402@archlinux.org> On 14/03/12 02:12, Thomas B?chler wrote: > Am 13.03.2012 13:15, schrieb Allan McRae: >> #branch=maint >> #tag=v4.0.1 >> #commit=f42ad345 >> >> This gives full clarity to what is being specified an allows for >> potential cases where branches and tags have the same name and we could >> provide multiple options, semicolon separated, if needed (obviously not >> for git, but maybe for another VSC system). > > Actually, this seems saner than everything I proposed. I ACK it in > principle. > > One question: Why do you distinguish between tag and commit? > Clarity only. There is obviously no actual difference in how these would be handled. Allan From xyne at archlinux.ca Tue Mar 13 12:52:05 2012 From: xyne at archlinux.ca (Xyne) Date: Tue, 13 Mar 2012 16:52:05 +0000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: References: <4F5EC5E5.4070803@archlinux.org> <4F5F3274.80306@xinu.at> Message-ID: <20120313165205.227adcc6@archlinux.ca> Dan McGee wrote: > > I don't like the @@ and :: syntax. Maybe > > "git://remotename//http://projects.archlinux.org/git/pacman.git"? That > > way we can simply look for "git://" and also easily figure out if there > > is a remote name or not. "//" should also be a safe delimiter because in > > the URL it would be collapsed to "/" anyway. > Heck no, minus -1000. We are **not** reinventing a URL syntax. This is > confusing, misleading, and awful. Look at this: > git://remotename//git://projects.archlinux.org/pacman.git > > I don't even know what remotename is (but if that can contain a '/', > my eyes will really bleed). The double URL specifier (using the same > protocol twice!!) is likely not allowable or recommended by > http://tools.ietf.org/html/rfc3986. > > If you are trying to stick with URI/URL format, I'd much rather see > git+http:// in this case, which is a lot like the 'svn+ssh://' > protocol you can use, etc. And then use fragment identifiers perhaps > (RFC 3986, 3.5, '#branchname') to identify the branch name. Please do this, and modularize the handlers in such a way that users can create new ones without hacking/patching the makepkg source. For example, create a directory similar to /etc/profile.d with files that get sourced by makepkg. Files in this directory could contain functions with scheme prefixes and common names, e.g. for git+http you might have git_http_download and for svn+ssh you would then have svn_ssh_download. The *_download function would be responsible for handling cloning and updating as necessary. It could accept the URL minus the fragments as first argument, the target/build directory as second argument, and then the fragments as additional arguments. Obviously that's just an example off the top of my head and you will have better ideas of how to implement it (e.g. maybe leave parsing to the function). The real purpose it to effectively create a VCS plugin system. Aside from providing users with flexibility, it would also crowdsource the creation of new VCS handlers. They could even be provided as optdepends. For versions, the *_download function could return one or there could be a special *_version function, but mixed sources may be a problem in that case. You could simply make it a guideline/requirement that the version be the date of the last VCS release or source modification. The version of the package would then be the version of the last release/modification of any source. That should simplify version handling across different VCS. I don't recommend using release tags as versions because there will be no way to compare them meaningfully in many (most?) cases. Just some thoughts. Regards, Xyne From d at falconindy.com Wed Mar 14 16:41:10 2012 From: d at falconindy.com (Dave Reisner) Date: Wed, 14 Mar 2012 16:41:10 -0400 Subject: [pacman-dev] [PATCH 1/2] Revert "makepkg: calculate exact total file size" Message-ID: <1331757671-24675-1-git-send-email-dreisner@archlinux.org> btrfs's cow snapshots seem to do very strange things, causing du to not count data still in filesystem buffers. Repackaging the same build of handbrake within a chroot on brynhild, I witnessed (via bash xtrace) du reporting a different $pkgdir size every time the write_pkginfo() function ran. Unfortunately, replacing du with stat has its own slew of problems, mostly due to hard links (e.g. git, with 106 hardlinks to the same file). Working around this is neither fun, nor practical. As it turns out, all we needed here all along was a simple call to sync to flush writes to disk before calling du. This reverts commit b264fb9e9ddcc31dc8782390309421965e507383. Signed-off-by: Dave Reisner --- configure.ac | 1 + scripts/Makefile.am | 1 + scripts/makepkg.sh.in | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 12a6e65..52f8ad4 100644 --- a/configure.ac +++ b/configure.ac @@ -282,6 +282,7 @@ esac AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes") AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes") +AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] ) AC_SUBST(SIZECMD) AC_SUBST(SEDINPLACE) AC_SUBST(STRIP_BINARIES) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 727de25..328fbff 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -53,6 +53,7 @@ edit = sed \ -e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \ -e 's|@SIZECMD[@]|$(SIZECMD)|g' \ -e 's|@SEDINPLACE[@]|$(SEDINPLACE)|g' \ + -e 's|@DUPATH[@]|$(DUPATH)|g' \ -e 's|@SCRIPTNAME[@]|$@|g' \ -e 's|@configure_input[@]|Generated from $@.sh.in; do not edit by hand.|g' diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 89cd118..c2941b2 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1156,7 +1156,8 @@ write_pkginfo() { else local packager="Unknown Packager" fi - local size="$(find . -print0 | xargs -0 @SIZECMD@ | awk '{ sum += $1 } END { print sum }')" + local size="$(@DUPATH@ -sk)" + size="$(( ${size%%[^0-9]*} * 1024 ))" msg2 "$(gettext "Generating %s file...")" ".PKGINFO" echo "# Generated by makepkg $myver" @@ -1264,6 +1265,10 @@ create_package() { PKGARCH=$CARCH fi + # flush buffers to disk. This avoids problems with du calculating the wrong + # installed package size, particularly on btrfs CoW snapshots. + sync + write_pkginfo $nameofpkg > .PKGINFO local comp_files=('.PKGINFO') -- 1.7.9.4 From d at falconindy.com Wed Mar 14 16:41:11 2012 From: d at falconindy.com (Dave Reisner) Date: Wed, 14 Mar 2012 16:41:11 -0400 Subject: [pacman-dev] [PATCH 2/2] makepkg: avoid unnecessary local variable In-Reply-To: <1331757671-24675-1-git-send-email-dreisner@archlinux.org> References: <1331757671-24675-1-git-send-email-dreisner@archlinux.org> Message-ID: <1331757671-24675-2-git-send-email-dreisner@archlinux.org> Use a simple default value parameter expansion instead of using an intermediate local variable to write the packager name in write_pkginfo. Signed-off-by: Dave Reisner --- scripts/makepkg.sh.in | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c2941b2..4be17e5 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1151,11 +1151,6 @@ check_license() { write_pkginfo() { local builddate=$(date -u "+%s") - if [[ -n $PACKAGER ]]; then - local packager="$PACKAGER" - else - local packager="Unknown Packager" - fi local size="$(@DUPATH@ -sk)" size="$(( ${size%%[^0-9]*} * 1024 ))" @@ -1171,7 +1166,7 @@ write_pkginfo() { echo "pkgdesc = $pkgdesc" echo "url = $url" echo "builddate = $builddate" - echo "packager = $packager" + echo "packager = ${PACKAGER:-Unknown Packager}" echo "size = $size" echo "arch = $PKGARCH" -- 1.7.9.4 From allan at archlinux.org Wed Mar 14 17:11:07 2012 From: allan at archlinux.org (Allan McRae) Date: Thu, 15 Mar 2012 07:11:07 +1000 Subject: [pacman-dev] [PATCH 1/2] Revert "makepkg: calculate exact total file size" In-Reply-To: <1331757671-24675-1-git-send-email-dreisner@archlinux.org> References: <1331757671-24675-1-git-send-email-dreisner@archlinux.org> Message-ID: <4F61096B.5090804@archlinux.org> On 15/03/12 06:41, Dave Reisner wrote: > btrfs's cow snapshots seem to do very strange things, causing du to not > count data still in filesystem buffers. Repackaging the same build of > handbrake within a chroot on brynhild, I witnessed (via bash xtrace) du > reporting a different $pkgdir size every time the write_pkginfo() > function ran. > > Unfortunately, replacing du with stat has its own slew of problems, > mostly due to hard links (e.g. git, with 106 hardlinks to the same > file). Working around this is neither fun, nor practical. > > As it turns out, all we needed here all along was a simple call to sync > to flush writes to disk before calling du. > > This reverts commit b264fb9e9ddcc31dc8782390309421965e507383. > > Signed-off-by: Dave Reisner Argh... look at the commit message in 14474a32... That sync results in the Arch buildserver stalling for minutes. Allan From d at falconindy.com Wed Mar 14 19:48:06 2012 From: d at falconindy.com (Dave Reisner) Date: Wed, 14 Mar 2012 19:48:06 -0400 Subject: [pacman-dev] [PATCH 1/2] Revert "makepkg: calculate exact total file size" In-Reply-To: <4F61096B.5090804@archlinux.org> References: <1331757671-24675-1-git-send-email-dreisner@archlinux.org> <4F61096B.5090804@archlinux.org> Message-ID: <20120314234806.GD838@rampage> On Thu, Mar 15, 2012 at 07:11:07AM +1000, Allan McRae wrote: > On 15/03/12 06:41, Dave Reisner wrote: > > btrfs's cow snapshots seem to do very strange things, causing du to not > > count data still in filesystem buffers. Repackaging the same build of > > handbrake within a chroot on brynhild, I witnessed (via bash xtrace) du > > reporting a different $pkgdir size every time the write_pkginfo() > > function ran. > > > > Unfortunately, replacing du with stat has its own slew of problems, > > mostly due to hard links (e.g. git, with 106 hardlinks to the same > > file). Working around this is neither fun, nor practical. > > > > As it turns out, all we needed here all along was a simple call to sync > > to flush writes to disk before calling du. > > > > This reverts commit b264fb9e9ddcc31dc8782390309421965e507383. > > > > Signed-off-by: Dave Reisner > > Argh... look at the commit message in 14474a32... > > That sync results in the Arch buildserver stalling for minutes. > > Allan > Ok fine. Back to the trenches I go... Some careful changes to makepkg and a simple stack trace catches du in the act of being broken. It receives a statbuf with the correct size of /usr/bin/ghb: newfstatat(AT_FDCWD, "usr/bin/ghb", {st_mode=S_IFREG|0755, st_size=16037808, ...}, AT_SYMLINK_NOFOLLOW) = 0 And then it writes the size completely wrong: write(1, "3456\tusr/bin/ghb\n", 17) = 17 I have no idea what's going on, but I'll keep digging. d From d at falconindy.com Wed Mar 14 20:50:22 2012 From: d at falconindy.com (Dave Reisner) Date: Wed, 14 Mar 2012 20:50:22 -0400 Subject: [pacman-dev] [PATCH 1/2] Revert "makepkg: calculate exact total file size" In-Reply-To: <20120314234806.GD838@rampage> References: <1331757671-24675-1-git-send-email-dreisner@archlinux.org> <4F61096B.5090804@archlinux.org> <20120314234806.GD838@rampage> Message-ID: <20120315005022.GE838@rampage> On Wed, Mar 14, 2012 at 07:48:06PM -0400, Dave Reisner wrote: > On Thu, Mar 15, 2012 at 07:11:07AM +1000, Allan McRae wrote: > > On 15/03/12 06:41, Dave Reisner wrote: > > > btrfs's cow snapshots seem to do very strange things, causing du to not > > > count data still in filesystem buffers. Repackaging the same build of > > > handbrake within a chroot on brynhild, I witnessed (via bash xtrace) du > > > reporting a different $pkgdir size every time the write_pkginfo() > > > function ran. > > > > > > Unfortunately, replacing du with stat has its own slew of problems, > > > mostly due to hard links (e.g. git, with 106 hardlinks to the same > > > file). Working around this is neither fun, nor practical. > > > > > > As it turns out, all we needed here all along was a simple call to sync > > > to flush writes to disk before calling du. > > > > > > This reverts commit b264fb9e9ddcc31dc8782390309421965e507383. > > > > > > Signed-off-by: Dave Reisner > > > > Argh... look at the commit message in 14474a32... > > > > That sync results in the Arch buildserver stalling for minutes. > > > > Allan > > > > Ok fine. Back to the trenches I go... > > Some careful changes to makepkg and a simple stack trace catches du in > the act of being broken. It receives a statbuf with the correct size of > /usr/bin/ghb: > > newfstatat(AT_FDCWD, "usr/bin/ghb", {st_mode=S_IFREG|0755, > st_size=16037808, ...}, AT_SYMLINK_NOFOLLOW) = 0 > > And then it writes the size completely wrong: > > write(1, "3456\tusr/bin/ghb\n", 17) = 17 > > I have no idea what's going on, but I'll keep digging. > > d Replying to myself, because I've been having an monologue with myself all goddamn day over this. It seems that while the stat buffer reports the size properly, there's a measureable delay of a half second or so before the st_blocks member is populated. I can stick a 'sleep 1' into makepkg before the du call, and everything works. I hacked up du and added some lovely printf calls (since you can't use gdb for this...) without the delay... sb->st_size=16037808, sb->st_blocks=0 <- ghb ^ that's when we see problems, because du is measuring size based on (st_blkcnt*st_blocksize). With a 1 second delay... sb->st_size=16037808, sb->st_blocks=31328 <- ghb Yay! d From dan at archlinux.org Wed Mar 14 23:04:04 2012 From: dan at archlinux.org (Dan McGee) Date: Wed, 14 Mar 2012 23:04:04 -0400 Subject: [pacman-dev] [PATCH 1/2] Handle printing NULL correctly in table display Message-ID: <1331780645-15830-1-git-send-email-dan@archlinux.org> Treat this value as the empty string. Signed-off-by: Dan McGee --- src/pacman/util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pacman/util.c b/src/pacman/util.c index 7be3dc5..a96aa62 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -500,6 +500,9 @@ static void table_print_line(const alpm_list_t *line, short col_padding, } value = curcell->data; + if(!value) { + value = ""; + } /* silly printf requires padding size to be an int */ cell_padding = (int)widths[i] - (int)string_length(value); if(cell_padding < 0) { -- 1.7.9.4 From dan at archlinux.org Wed Mar 14 23:04:05 2012 From: dan at archlinux.org (Dan McGee) Date: Wed, 14 Mar 2012 23:04:05 -0400 Subject: [pacman-dev] [PATCH 2/2] Always display download size if it applies In-Reply-To: <1331780645-15830-1-git-send-email-dan@archlinux.org> References: <1331780645-15830-1-git-send-email-dan@archlinux.org> Message-ID: <1331780645-15830-2-git-send-email-dan@archlinux.org> Currently, we try to do a bunch of funkyness constraining download size to print only when doing a -S/--sync operation. However, it is possible we try to download packages on a -U/--upgrade operation, and we currently won't show any itemized download sizes. Fix this ommission by always including the download size stuff in the built table rows; this column will be completely omitted anyway if there are no values due to prior work in commit 33bb7dbd35. Signed-off-by: Dan McGee --- src/pacman/util.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index a96aa62..8b4f072 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -793,7 +793,7 @@ void signature_display(const char *title, alpm_siglist_t *siglist) } /* creates a header row for use with table_display */ -static alpm_list_t *create_verbose_header(int dl_size) +static alpm_list_t *create_verbose_header(void) { alpm_list_t *res = NULL; char *str; @@ -806,16 +806,14 @@ static alpm_list_t *create_verbose_header(int dl_size) res = alpm_list_add(res, str); str = _("Net Change"); res = alpm_list_add(res, str); - if(dl_size) { - str = _("Download Size"); - res = alpm_list_add(res, str); - } + str = _("Download Size"); + res = alpm_list_add(res, str); return res; } /* returns package info as list of strings */ -static alpm_list_t *create_verbose_row(pm_target_t *target, int dl_size) +static alpm_list_t *create_verbose_row(pm_target_t *target) { char *str; off_t size = 0; @@ -852,16 +850,14 @@ static alpm_list_t *create_verbose_row(pm_target_t *target, int dl_size) pm_asprintf(&str, "%.2f %s", human_size, label); ret = alpm_list_add(ret, str); - if(dl_size) { - size = target->install ? alpm_pkg_download_size(target->install) : 0; - human_size = humanize_size(size, 'M', 2, &label); - if(size != 0) { - pm_asprintf(&str, "%.2f %s", human_size, label); - } else { - str = strdup(""); - } - ret = alpm_list_add(ret, str); + size = target->install ? alpm_pkg_download_size(target->install) : 0; + human_size = humanize_size(size, 'M', 2, &label); + if(size != 0) { + pm_asprintf(&str, "%.2f %s", human_size, label); + } else { + str = NULL; } + ret = alpm_list_add(ret, str); return ret; } @@ -874,7 +870,6 @@ static void _display_targets(alpm_list_t *targets, int verbose) double size; off_t isize = 0, rsize = 0, dlsize = 0; alpm_list_t *i, *rows = NULL, *names = NULL; - int show_dl_size = config->op == PM_OP_SYNC; if(!targets) { return; @@ -898,7 +893,7 @@ static void _display_targets(alpm_list_t *targets, int verbose) for(i = targets; i; i = alpm_list_next(i)) { pm_target_t *target = i->data; - rows = alpm_list_add(rows, create_verbose_row(target, show_dl_size)); + rows = alpm_list_add(rows, create_verbose_row(target)); if(target->install) { pm_asprintf(&str, "%s-%s", alpm_pkg_get_name(target->install), alpm_pkg_get_version(target->install)); @@ -917,7 +912,7 @@ static void _display_targets(alpm_list_t *targets, int verbose) printf("\n"); if(verbose) { - alpm_list_t *header = create_verbose_header(show_dl_size); + alpm_list_t *header = create_verbose_header(); if(table_display(str, header, rows) != 0) { /* fallback to list display if table wouldn't fit */ list_display(str, names); -- 1.7.9.4 From d at falconindy.com Wed Mar 14 23:13:01 2012 From: d at falconindy.com (Dave Reisner) Date: Wed, 14 Mar 2012 23:13:01 -0400 Subject: [pacman-dev] [PATCH 1/2] dload: reset payload filename members before download Message-ID: <1331781182-13290-1-git-send-email-dreisner@archlinux.org> To avoid conflicts on reusing a payload after a failed download, ensure that we reset the filename hints in the payload struct prior to the download operation. Signed-off-by: Dave Reisner --- lib/libalpm/dload.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 0598806..b3ac024 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -390,6 +390,11 @@ static int curl_download_internal(struct dload_payload *payload, CURL *curl = get_libcurl_handle(handle); handle->pm_errno = 0; + /* make sure these are NULL */ + FREE(payload->tempfile_name); + FREE(payload->destfile_name); + FREE(payload->content_disp_name); + payload->tempfile_openmode = "wb"; if(!payload->remote_name) { STRDUP(payload->remote_name, get_filename(payload->fileurl), -- 1.7.9.4 From d at falconindy.com Wed Mar 14 23:13:02 2012 From: d at falconindy.com (Dave Reisner) Date: Wed, 14 Mar 2012 23:13:02 -0400 Subject: [pacman-dev] [PATCH 2/2] lib/sync: avoid unwanted unlink after download fail In-Reply-To: <1331781182-13290-1-git-send-email-dreisner@archlinux.org> References: <1331781182-13290-1-git-send-email-dreisner@archlinux.org> Message-ID: <1331781182-13290-2-git-send-email-dreisner@archlinux.org> In case we have a mirror failure, unlink_on_fail would remain set, causing an interrupt in a successive download attempt to be wrongly unlinked. This also fixes a memory leak in the url member, as we would allocate over the previous, unfreed URL. Signed-off-by: Dave Reisner --- lib/libalpm/sync.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 69d27af..feab302 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -864,6 +864,9 @@ static int download_single_file(alpm_handle_t *handle, struct dload_payload *pay { const alpm_list_t *server; + payload->handle = handle; + payload->allow_resume = 1; + for(server = payload->servers; server; server = server->next) { const char *server_url = server->data; size_t len; @@ -872,12 +875,15 @@ static int download_single_file(alpm_handle_t *handle, struct dload_payload *pay len = strlen(server_url) + strlen(payload->remote_name) + 2; MALLOC(payload->fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1)); snprintf(payload->fileurl, len, "%s/%s", server_url, payload->remote_name); - payload->handle = handle; - payload->allow_resume = 1; if(_alpm_download(payload, cachedir, NULL) != -1) { return 0; } + + /* we failed the download, clean out the URL and any bits that might be + * set in _alpm_download */ + payload->unlink_on_fail = 0; + free(payload->fileurl); } return -1; -- 1.7.9.4 From dan at archlinux.org Fri Mar 16 13:08:53 2012 From: dan at archlinux.org (Dan McGee) Date: Fri, 16 Mar 2012 13:08:53 -0400 (EDT) Subject: [pacman-dev] [GIT] The official pacman repository branch, maint, updated. v4.0.2-25-gf988aa6 Message-ID: <20120316170853.4C93B90070@gerolde.archlinux.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The official pacman repository". The branch, maint has been updated via f988aa6b32503f5d4003b1402089df74adf8b485 (commit) via f41037358af167424403d30a3b972b1fd733c755 (commit) via 952ee5e6cb8bb1849c1bceedae38744935c82fca (commit) via 47d0df6c101455c989887551bd0f0149a0f00de7 (commit) via ff58e5cb2d6aca0e1c8ed0e77770f3c5d2442c46 (commit) from 1a8c3e52d70bfa21ba108aa77179adf90401949d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f988aa6b32503f5d4003b1402089df74adf8b485 Author: Allan McRae Date: Fri Mar 9 17:32:11 2012 +1000 makepkg: quote removed filename as it can have spaces Signed-off-by: Allan McRae Signed-off-by: Dan McGee commit f41037358af167424403d30a3b972b1fd733c755 Author: Dave Reisner Date: Wed Mar 14 23:06:24 2012 -0400 lib/sync: avoid unwanted unlink after download fail In case we have a mirror failure, unlink_on_fail would remain set, causing an interrupt in a successive download attempt to be wrongly unlinked. This also fixes a memory leak in the url member, as we would allocate over the previous, unfreed URL. Signed-off-by: Dave Reisner commit 952ee5e6cb8bb1849c1bceedae38744935c82fca Author: Dave Reisner Date: Wed Mar 14 23:04:43 2012 -0400 dload: reset payload filename members before download To avoid conflicts on reusing a payload after a failed download, ensure that we reset the filename hints in the payload struct prior to the download operation. Signed-off-by: Dave Reisner Signed-off-by: Dan McGee commit 47d0df6c101455c989887551bd0f0149a0f00de7 Author: Allan McRae Date: Fri Mar 9 23:16:40 2012 +1000 Skip special files when cleaning package cache Ignore *.sig, *.db*, and *.src.tar* when cleaning the package cache. Fixes FS#25166. Signed-off-by: Allan McRae commit ff58e5cb2d6aca0e1c8ed0e77770f3c5d2442c46 Author: Dan McGee Date: Mon Mar 12 21:16:14 2012 -0500 Add 3.0.x versions to doc/index.txt These got lost when I switched to the new Asciidoc tables syntax in commit 1ebe5dc1979e. Signed-off-by: Dan McGee ----------------------------------------------------------------------- Summary of changes: doc/index.txt | 17 ++++++++++++----- lib/libalpm/dload.c | 5 +++++ lib/libalpm/sync.c | 2 ++ scripts/makepkg.sh.in | 2 +- src/pacman/sync.c | 17 +++++++++++++++++ 5 files changed, 37 insertions(+), 6 deletions(-) hooks/post-receive -- The official pacman repository From dan at archlinux.org Fri Mar 16 13:08:55 2012 From: dan at archlinux.org (Dan McGee) Date: Fri, 16 Mar 2012 13:08:55 -0400 (EDT) Subject: [pacman-dev] [GIT] The official pacman repository branch, master, updated. v4.0.2-185-ge6f72c6 Message-ID: <20120316170856.5C8AB90074@gerolde.archlinux.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The official pacman repository". The branch, master has been updated via e6f72c61a098b52ea29e54b8eb4739a2ff81e6b0 (commit) via f988aa6b32503f5d4003b1402089df74adf8b485 (commit) via 573bd80f147ce90f21ef51fb8ca6f71e89cc3a74 (commit) via 44de3183ff42dc4e5972a9d563ebc7125c3eb4dd (commit) via 03465ad6b6719e0afb20ca8829581190a2b7658e (commit) via d521f30f071e2bd2c39c05f39df34be867dfe572 (commit) via 9e1a20022d8186eba0005e20b8b6db16cf7dec64 (commit) via 56f821b72a6b56cdcbc727515e43c16affd39f08 (commit) via 930e93b8925874a3c6d3460d2c0cebcda5fc0d09 (commit) via 89f4dd88d784632fed134ae88284074511cf4567 (commit) via 83e42dcccef08233134a0a5da7e3da70638e6c97 (commit) via f41037358af167424403d30a3b972b1fd733c755 (commit) via 952ee5e6cb8bb1849c1bceedae38744935c82fca (commit) via 47d0df6c101455c989887551bd0f0149a0f00de7 (commit) via 5bda38196fbd6ad389fd829924736b007732e2f1 (commit) via ff58e5cb2d6aca0e1c8ed0e77770f3c5d2442c46 (commit) from 8de0631edbd1fd7681f6a924f5e166621328c13f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e6f72c61a098b52ea29e54b8eb4739a2ff81e6b0 Merge: 573bd80 f988aa6 Author: Dan McGee Date: Fri Mar 16 12:08:10 2012 -0500 Merge branch 'maint' Conflicts: lib/libalpm/sync.c commit 573bd80f147ce90f21ef51fb8ca6f71e89cc3a74 Author: Allan McRae Date: Fri Mar 9 17:27:43 2012 +1000 makepkg: abort when failing to create BUILDDIR Signed-off-by: Allan McRae Signed-off-by: Dan McGee commit 44de3183ff42dc4e5972a9d563ebc7125c3eb4dd Author: Allan McRae Date: Fri Mar 9 17:15:28 2012 +1000 makepkg: prevent issues with files starting with a hyphen Most places in makepkg deal with full file paths, but a few use the file name only. Protect from potential issues when a file name starts with a hyphen. Signed-off-by: Allan McRae Signed-off-by: Dan McGee commit 03465ad6b6719e0afb20ca8829581190a2b7658e Author: Allan McRae Date: Fri Mar 9 16:01:28 2012 +1000 makepkg: append pkgbase to BUILDDIR if specified This means multiple packages can be build using the same BUILDDIR without their source files all ending up extracted in the same directory. Fixes FS#28417. Signed-off-by: Allan McRae Signed-off-by: Dan McGee commit d521f30f071e2bd2c39c05f39df34be867dfe572 Author: Dan McGee Date: Tue Mar 13 06:33:56 2012 -0500 pactest: make OPTDEPEND rule look at non-description only Signed-off-by: Dan McGee commit 9e1a20022d8186eba0005e20b8b6db16cf7dec64 Author: Dan McGee Date: Wed Mar 14 22:19:13 2012 -0400 Always display download size if it applies Currently, we try to do a bunch of funkyness constraining download size to print only when doing a -S/--sync operation. However, it is possible we try to download packages on a -U/--upgrade operation, and we currently won't show any itemized download sizes. Fix this ommission by always including the download size stuff in the built table rows; this column will be completely omitted anyway if there are no values due to prior work in commit 33bb7dbd35. Signed-off-by: Dan McGee commit 56f821b72a6b56cdcbc727515e43c16affd39f08 Author: Dan McGee Date: Wed Mar 14 22:18:37 2012 -0400 Handle printing NULL correctly in table display Treat this value as the empty string. Signed-off-by: Dan McGee commit 930e93b8925874a3c6d3460d2c0cebcda5fc0d09 Author: Dan McGee Date: Fri Mar 9 14:24:48 2012 -0600 Prefer fputs/fputc over fprintf when writing local database Using fputs should be faster as no format string parsing is required. It also prevents silly errors related to unescaped '%' signs, and removes the need to double them up in a lot of places. Signed-off-by: Dan McGee commit 89f4dd88d784632fed134ae88284074511cf4567 Author: Dan McGee Date: Fri Mar 9 14:10:04 2012 -0600 Extract a write_deps function from local database writing This reduces a lot of code duplication in the write function, which cleans it up a bit. Signed-off-by: Dan McGee commit 83e42dcccef08233134a0a5da7e3da70638e6c97 Author: Dan McGee Date: Fri Mar 9 13:40:55 2012 -0600 Remove unnecessary path check from local database This removes a call to _alpm_local_db_pkgpath() as well as an access() call when reading the local database. This appears to be code from 2006 that has stuck around. We don't need it because: 1) We never use this path except to check it via access(); however, we are already in a readdir() loop so it exists, or at least did at the time of the call. 2) The fopen() and other calls will fail on accessing the database files anyway, and we need to check those for errors. Signed-off-by: Dan McGee commit 5bda38196fbd6ad389fd829924736b007732e2f1 Author: Dan McGee Date: Mon Mar 12 21:47:29 2012 -0500 Minor format-string related cleanups We had one stubbed out so we didn't require a translation update, and the other is more a code style issue. Signed-off-by: Dan McGee ----------------------------------------------------------------------- Summary of changes: doc/index.txt | 17 +++++-- lib/libalpm/be_local.c | 106 ++++++++++++++++++------------------------------ lib/libalpm/dload.c | 5 ++ lib/libalpm/sync.c | 10 +++- scripts/makepkg.sh.in | 25 ++++++++---- src/pacman/sync.c | 17 ++++++++ src/pacman/util.c | 34 +++++++-------- test/pacman/pmrule.py | 7 ++- 8 files changed, 118 insertions(+), 103 deletions(-) hooks/post-receive -- The official pacman repository From dan at archlinux.org Fri Mar 16 19:19:57 2012 From: dan at archlinux.org (Dan McGee) Date: Fri, 16 Mar 2012 18:19:57 -0500 Subject: [pacman-dev] [PATCH 1/3] Pass a file descriptor to getcols and flush_term_input Message-ID: <1331939999-21035-1-git-send-email-dan@archlinux.org> This makes these methods a bit more flexible. Signed-off-by: Dan McGee --- src/pacman/callback.c | 4 ++-- src/pacman/util.c | 31 ++++++++++++++++--------------- src/pacman/util.h | 2 +- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 9fd9cc4..61f517c 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -384,7 +384,7 @@ void cb_progress(alpm_progress_t event, const char *pkgname, int percent, int len, wclen, wcwid, padwid; wchar_t *wcstr; - const unsigned short cols = getcols(); + const unsigned short cols = getcols(fileno(stdout)); if(config->noprogressbar || cols == 0) { return; @@ -544,7 +544,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total) const char *rate_label, *xfered_label; int file_percent = 0, total_percent = 0; - const unsigned short cols = getcols(); + const unsigned short cols = getcols(fileno(stdout)); if(config->noprogressbar || cols == 0 || file_total == -1) { if(file_xfered == 0) { diff --git a/src/pacman/util.c b/src/pacman/util.c index a5242ae..15cd6fd 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -130,10 +130,10 @@ int check_syncdbs(size_t need_repos, int check_valid) } /* discard unhandled input on the terminal's input buffer */ -static int flush_term_input(void) { +static int flush_term_input(int fd) { #ifdef HAVE_TCFLUSH - if(isatty(fileno(stdin))) { - return tcflush(fileno(stdin), TCIFLUSH); + if(isatty(fd)) { + return tcflush(fd, TCIFLUSH); } #endif @@ -142,24 +142,24 @@ static int flush_term_input(void) { } /* gets the current screen column width */ -unsigned short getcols(void) +unsigned short getcols(int fd) { const unsigned short default_tty = 80; const unsigned short default_notty = 0; unsigned short termwidth = 0; - if(!isatty(fileno(stdout))) { + if(!isatty(fd)) { return default_notty; } -#ifdef TIOCGSIZE +#if defined(TIOCGSIZE) struct ttysize win; - if(ioctl(1, TIOCGSIZE, &win) == 0) { + if(ioctl(fd, TIOCGSIZE, &win) == 0) { termwidth = win.ts_cols; } #elif defined(TIOCGWINSZ) struct winsize win; - if(ioctl(1, TIOCGWINSZ, &win) == 0) { + if(ioctl(fd, TIOCGWINSZ, &win) == 0) { termwidth = win.ws_col; } #endif @@ -259,7 +259,7 @@ void indentprint(const char *str, size_t indent) wchar_t *wcstr; const wchar_t *p; int len, cidx; - const unsigned short cols = getcols(); + const unsigned short cols = getcols(fileno(stdout)); if(!str) { return; @@ -622,7 +622,7 @@ int table_display(const char *title, const alpm_list_t *header, totalwidth = table_calc_widths(header, rows, padding, totalcols, &widths, &has_data); /* return -1 if terminal is not wide enough */ - if(totalwidth > getcols()) { + if(totalwidth > getcols(fileno(stdout))) { pm_printf(ALPM_LOG_WARNING, _("insufficient columns available for table display\n")); return -1; @@ -660,7 +660,7 @@ void list_display(const char *title, const alpm_list_t *list) if(!list) { printf("%s\n", _("None")); } else { - const unsigned short maxcols = getcols(); + const unsigned short maxcols = getcols(fileno(stdout)); size_t cols = len; const char *str = list->data; fputs(str, stdout); @@ -1377,7 +1377,7 @@ int multiselect_question(char *array, int count) break; } - flush_term_input(); + flush_term_input(fileno(stdin)); if(fgets(response, response_len, stdin)) { const size_t response_incr = 64; @@ -1440,7 +1440,7 @@ int select_question(int count) break; } - flush_term_input(); + flush_term_input(fileno(stdin)); if(fgets(response, sizeof(response), stdin)) { size_t len = strtrim(response); @@ -1463,6 +1463,7 @@ static int question(short preset, char *fmt, va_list args) { char response[32]; FILE *stream; + int fd_in = fileno(stdin); if(config->noconfirm) { stream = stdout; @@ -1489,7 +1490,7 @@ static int question(short preset, char *fmt, va_list args) } fflush(stream); - flush_term_input(); + flush_term_input(fd_in); if(fgets(response, sizeof(response), stdin)) { size_t len = strtrim(response); @@ -1499,7 +1500,7 @@ static int question(short preset, char *fmt, va_list args) /* if stdin is piped, response does not get printed out, and as a result * a \n is missing, resulting in broken output (FS#27909) */ - if(!isatty(fileno(stdin))) { + if(!isatty(fd_in)) { fprintf(stream, "%s\n", response); } diff --git a/src/pacman/util.h b/src/pacman/util.h index 0df46e8..fc97707 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -47,7 +47,7 @@ int trans_init(alpm_transflag_t flags, int check_valid); int trans_release(void); int needs_root(void); int check_syncdbs(size_t need_repos, int check_valid); -unsigned short getcols(void); +unsigned short getcols(int fd); int rmrf(const char *path); const char *mbasename(const char *path); char *mdirname(const char *path); -- 1.7.9.4 From dan at archlinux.org Fri Mar 16 19:19:58 2012 From: dan at archlinux.org (Dan McGee) Date: Fri, 16 Mar 2012 18:19:58 -0500 Subject: [pacman-dev] [PATCH 2/3] Reduce calls to getcols In-Reply-To: <1331939999-21035-1-git-send-email-dan@archlinux.org> References: <1331939999-21035-1-git-send-email-dan@archlinux.org> Message-ID: <1331939999-21035-2-git-send-email-dan@archlinux.org> This dramatically improves upon a much older attempt in 2008 in commit ce3d70aa99ab86. We don't need to call it once per line we print unless there is a reasonable expectation of being able to resize the terminal mid-operation; this is really only the case during our callback progress bars. Some before and after numbers of ioctl() calls, gleaned from strace of the following operations (no targets to any of them to maximize the amount of output): pacman -Qii : 37768 -> 2616 (93.1% decrease) pacman -Qs : 2616 -> 4 (99.8%) pacman -Sii : 133036 -> 10926 (91.8%) pacman -Ss : 10926 -> 14 (99.9%) Obviously the search results are astounding; we only call getcols() once in the case of -Qs, and once per repo in the case of -Ss. For -Qii and -Sii we are still calling it once per package, but this is much better than once per line of info output. Signed-off-by: Dan McGee --- src/pacman/callback.c | 2 +- src/pacman/package.c | 67 +++++++++++++++++++++++++------------------------ src/pacman/pacman.c | 2 +- src/pacman/query.c | 8 +++--- src/pacman/sync.c | 10 +++++--- src/pacman/util.c | 63 +++++++++++++++++++++++++--------------------- src/pacman/util.h | 16 +++++++----- 7 files changed, 92 insertions(+), 76 deletions(-) diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 61f517c..01c6b61 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -308,7 +308,7 @@ void cb_question(alpm_question_t event, void *data1, void *data2, ":: The following package cannot be upgraded due to unresolvable dependencies:\n", ":: The following packages cannot be upgraded due to unresolvable dependencies:\n", count)); - list_display(" ", namelist); + list_display(" ", namelist, getcols(fileno(stdout))); printf("\n"); *response = noyes(_n( "Do you want to skip the above package for this upgrade?", diff --git a/src/pacman/package.c b/src/pacman/package.c index 6e091d5..942797a 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -40,14 +40,14 @@ * @param deps a list with items of type alpm_depend_t */ static void deplist_display(const char *title, - alpm_list_t *deps) + alpm_list_t *deps, unsigned short cols) { alpm_list_t *i, *text = NULL; for(i = deps; i; i = alpm_list_next(i)) { alpm_depend_t *dep = i->data; text = alpm_list_add(text, alpm_dep_compute_string(dep)); } - list_display(title, text); + list_display(title, text, cols); FREELIST(text); } @@ -55,14 +55,14 @@ static void deplist_display(const char *title, * @param optdeps a list with items of type alpm_optdepend_t */ static void optdeplist_display(const char *title, - alpm_list_t *optdeps) + alpm_list_t *optdeps, unsigned short cols) { alpm_list_t *i, *text = NULL; for(i = optdeps; i; i = alpm_list_next(i)) { alpm_depend_t *optdep = i->data; text = alpm_list_add(text, alpm_dep_compute_string(optdep)); } - list_display_linebreak(title, text); + list_display_linebreak(title, text, cols); FREELIST(text); } @@ -76,14 +76,13 @@ static void optdeplist_display(const char *title, */ void dump_pkg_full(alpm_pkg_t *pkg, int extra) { - const char *reason; - alpm_list_t *validation = NULL; + unsigned short cols; time_t bdate, idate; - char bdatestr[50] = "", idatestr[50] = ""; - const char *label; - double size; - alpm_list_t *requiredby = NULL; alpm_pkgfrom_t from; + double size; + char bdatestr[50] = "", idatestr[50] = ""; + const char *label, *reason; + alpm_list_t *validation = NULL, *requiredby = NULL; from = alpm_pkg_get_origin(pkg); @@ -133,24 +132,26 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra) requiredby = alpm_pkg_compute_requiredby(pkg); } + cols = getcols(fileno(stdout)); + /* actual output */ if(from == PKG_FROM_SYNCDB) { string_display(_("Repository :"), - alpm_db_get_name(alpm_pkg_get_db(pkg))); + alpm_db_get_name(alpm_pkg_get_db(pkg)), cols); } - string_display(_("Name :"), alpm_pkg_get_name(pkg)); - string_display(_("Version :"), alpm_pkg_get_version(pkg)); - string_display(_("URL :"), alpm_pkg_get_url(pkg)); - list_display(_("Licenses :"), alpm_pkg_get_licenses(pkg)); - list_display(_("Groups :"), alpm_pkg_get_groups(pkg)); - deplist_display(_("Provides :"), alpm_pkg_get_provides(pkg)); - deplist_display(_("Depends On :"), alpm_pkg_get_depends(pkg)); - optdeplist_display(_("Optional Deps :"), alpm_pkg_get_optdepends(pkg)); + string_display(_("Name :"), alpm_pkg_get_name(pkg), cols); + string_display(_("Version :"), alpm_pkg_get_version(pkg), cols); + string_display(_("URL :"), alpm_pkg_get_url(pkg), cols); + list_display(_("Licenses :"), alpm_pkg_get_licenses(pkg), cols); + list_display(_("Groups :"), alpm_pkg_get_groups(pkg), cols); + deplist_display(_("Provides :"), alpm_pkg_get_provides(pkg), cols); + deplist_display(_("Depends On :"), alpm_pkg_get_depends(pkg), cols); + optdeplist_display(_("Optional Deps :"), alpm_pkg_get_optdepends(pkg), cols); if(extra || from == PKG_FROM_LOCALDB) { - list_display(_("Required By :"), requiredby); + list_display(_("Required By :"), requiredby, cols); } - deplist_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg)); - deplist_display(_("Replaces :"), alpm_pkg_get_replaces(pkg)); + deplist_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg), cols); + deplist_display(_("Replaces :"), alpm_pkg_get_replaces(pkg), cols); size = humanize_size(alpm_pkg_get_size(pkg), 'K', 2, &label); if(from == PKG_FROM_SYNCDB) { @@ -162,35 +163,35 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra) size = humanize_size(alpm_pkg_get_isize(pkg), 'K', 2, &label); printf(_("Installed Size : %6.2f %s\n"), size, label); - string_display(_("Packager :"), alpm_pkg_get_packager(pkg)); - string_display(_("Architecture :"), alpm_pkg_get_arch(pkg)); - string_display(_("Build Date :"), bdatestr); + string_display(_("Packager :"), alpm_pkg_get_packager(pkg), cols); + string_display(_("Architecture :"), alpm_pkg_get_arch(pkg), cols); + string_display(_("Build Date :"), bdatestr, cols); if(from == PKG_FROM_LOCALDB) { - string_display(_("Install Date :"), idatestr); - string_display(_("Install Reason :"), reason); + string_display(_("Install Date :"), idatestr, cols); + string_display(_("Install Reason :"), reason, cols); } if(from == PKG_FROM_FILE || from == PKG_FROM_LOCALDB) { string_display(_("Install Script :"), - alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No")); + alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No"), cols); } - list_display(_("Validated By :"), validation); + list_display(_("Validated By :"), validation, cols); if(from == PKG_FROM_FILE) { alpm_siglist_t siglist; int err = alpm_pkg_check_pgp_signature(pkg, &siglist); if(err && alpm_errno(config->handle) == ALPM_ERR_SIG_MISSING) { - string_display(_("Signatures :"), _("None")); + string_display(_("Signatures :"), _("None"), cols); } else if(err) { string_display(_("Signatures :"), - alpm_strerror(alpm_errno(config->handle))); + alpm_strerror(alpm_errno(config->handle)), cols); } else { - signature_display(_("Signatures :"), &siglist); + signature_display(_("Signatures :"), &siglist, cols); } alpm_siglist_cleanup(&siglist); } - string_display(_("Description :"), alpm_pkg_get_desc(pkg)); + string_display(_("Description :"), alpm_pkg_get_desc(pkg), cols); /* Print additional package info if info flag passed more than once */ if(from == PKG_FROM_LOCALDB && extra) { diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 107aa18..1e6797c 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -897,7 +897,7 @@ int main(int argc, char *argv[]) printf("Lock File : %s\n", alpm_option_get_lockfile(config->handle)); printf("Log File : %s\n", alpm_option_get_logfile(config->handle)); printf("GPG Dir : %s\n", alpm_option_get_gpgdir(config->handle)); - list_display("Targets :", pm_targets); + list_display("Targets :", pm_targets, 0); } /* Log command line */ diff --git a/src/pacman/query.c b/src/pacman/query.c index 1d27232..a1cc1cf 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -246,6 +246,7 @@ static int query_search(alpm_list_t *targets) alpm_list_t *i, *searchlist; int freelist; alpm_db_t *db_local = alpm_get_localdb(config->handle); + unsigned short cols; /* if we have a targets list, search for packages matching it */ if(targets) { @@ -259,6 +260,7 @@ static int query_search(alpm_list_t *targets) return 1; } + cols = getcols(fileno(stdout)); for(i = searchlist; i; i = alpm_list_next(i)) { alpm_list_t *grp; alpm_pkg_t *pkg = i->data; @@ -286,10 +288,10 @@ static int query_search(alpm_list_t *targets) } /* we need a newline and initial indent first */ - printf("\n "); - indentprint(alpm_pkg_get_desc(pkg), 4); + fputs("\n ", stdout); + indentprint(alpm_pkg_get_desc(pkg), 4, cols); } - printf("\n"); + fputc('\n', stdout); } /* we only want to free if the list was a search list */ diff --git a/src/pacman/sync.c b/src/pacman/sync.c index d782a94..74e417c 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -360,6 +360,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) for(i = syncs; i; i = alpm_list_next(i)) { alpm_db_t *db = i->data; + unsigned short cols; /* if we have a targets list, search for packages matching it */ if(targets) { ret = alpm_db_search(db, targets); @@ -373,6 +374,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) } else { found = 1; } + cols = getcols(fileno(stdout)); for(j = ret; j; j = alpm_list_next(j)) { alpm_list_t *grp; alpm_pkg_t *pkg = j->data; @@ -402,10 +404,10 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) print_installed(db_local, pkg); /* we need a newline and initial indent first */ - printf("\n "); - indentprint(alpm_pkg_get_desc(pkg), 4); + fputs("\n ", stdout); + indentprint(alpm_pkg_get_desc(pkg), 4, cols); } - printf("\n"); + fputc('\n', stdout); } /* we only want to free if the list was a search list */ if(freelist) { @@ -1005,7 +1007,7 @@ int pacman_sync(alpm_list_t *targets) if(config->op_s_upgrade || (tmp = alpm_list_diff(targets, packages, (alpm_list_fn_cmp)strcmp))) { alpm_list_free(tmp); printf(_(":: The following packages should be upgraded first :\n")); - list_display(" ", packages); + list_display(" ", packages, getcols(fileno(stdout))); if(yesno(_(":: Do you want to cancel the current operation\n" ":: and upgrade these packages now?"))) { FREELIST(targs); diff --git a/src/pacman/util.c b/src/pacman/util.c index 15cd6fd..4b8684e 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -254,12 +254,11 @@ char *mdirname(const char *path) /* output a string, but wrap words properly with a specified indentation */ -void indentprint(const char *str, size_t indent) +void indentprint(const char *str, unsigned short indent, unsigned short cols) { wchar_t *wcstr; const wchar_t *p; int len, cidx; - const unsigned short cols = getcols(fileno(stdout)); if(!str) { return; @@ -461,7 +460,7 @@ static size_t string_length(const char *s) return len; } -void string_display(const char *title, const char *string) +void string_display(const char *title, const char *string, unsigned short cols) { if(title) { printf("%s ", title); @@ -471,7 +470,7 @@ void string_display(const char *title, const char *string) } else { /* compute the length of title + a space */ size_t len = string_length(title) + 1; - indentprint(string, len); + indentprint(string, (unsigned short)len, cols); } printf("\n"); } @@ -603,11 +602,11 @@ static size_t table_calc_widths(const alpm_list_t *header, * of headers * @param rows the rows to display as a list of lists of strings. the outer * list represents the rows, the inner list the cells (= columns) - * + * @param cols the number of columns available in the terminal * @return -1 if not enough terminal cols available, else 0 */ int table_display(const char *title, const alpm_list_t *header, - const alpm_list_t *rows) + const alpm_list_t *rows, unsigned short cols) { const unsigned short padding = 2; const alpm_list_t *i; @@ -622,7 +621,7 @@ int table_display(const char *title, const alpm_list_t *header, totalwidth = table_calc_widths(header, rows, padding, totalcols, &widths, &has_data); /* return -1 if terminal is not wide enough */ - if(totalwidth > getcols(fileno(stdout))) { + if(totalwidth > cols) { pm_printf(ALPM_LOG_WARNING, _("insufficient columns available for table display\n")); return -1; @@ -647,7 +646,8 @@ int table_display(const char *title, const alpm_list_t *header, return 0; } -void list_display(const char *title, const alpm_list_t *list) +void list_display(const char *title, const alpm_list_t *list, + unsigned short maxcols) { const alpm_list_t *i; size_t len = 0; @@ -660,7 +660,6 @@ void list_display(const char *title, const alpm_list_t *list) if(!list) { printf("%s\n", _("None")); } else { - const unsigned short maxcols = getcols(fileno(stdout)); size_t cols = len; const char *str = list->data; fputs(str, stdout); @@ -688,12 +687,13 @@ void list_display(const char *title, const alpm_list_t *list) } } -void list_display_linebreak(const char *title, const alpm_list_t *list) +void list_display_linebreak(const char *title, const alpm_list_t *list, + unsigned short maxcols) { - size_t len = 0; + unsigned short len = 0; if(title) { - len = string_length(title) + 1; + len = (unsigned short)string_length(title) + 1; printf("%s ", title); } @@ -702,7 +702,7 @@ void list_display_linebreak(const char *title, const alpm_list_t *list) } else { const alpm_list_t *i; /* Print the first element */ - indentprint((const char *)list->data, len); + indentprint((const char *)list->data, len, maxcols); printf("\n"); /* Print the rest */ for(i = alpm_list_next(list); i; i = alpm_list_next(i)) { @@ -710,18 +710,19 @@ void list_display_linebreak(const char *title, const alpm_list_t *list) for(j = 1; j <= len; j++) { printf(" "); } - indentprint((const char *)i->data, len); + indentprint((const char *)i->data, len, maxcols); printf("\n"); } } } -void signature_display(const char *title, alpm_siglist_t *siglist) +void signature_display(const char *title, alpm_siglist_t *siglist, + unsigned short maxcols) { - size_t len = 0; + unsigned short len = 0; if(title) { - len = string_length(title) + 1; + len = (unsigned short)string_length(title) + 1; printf("%s ", title); } if(siglist->count == 0) { @@ -785,7 +786,7 @@ void signature_display(const char *title, alpm_siglist_t *siglist) pm_printf(ALPM_LOG_ERROR, _("failed to allocate string\n")); continue; } - indentprint(sigline, len); + indentprint(sigline, len, maxcols); printf("\n"); free(sigline); } @@ -869,6 +870,7 @@ static void _display_targets(alpm_list_t *targets, int verbose) const char *label; double size; off_t isize = 0, rsize = 0, dlsize = 0; + unsigned short cols; alpm_list_t *i, *rows = NULL, *names = NULL; if(!targets) { @@ -909,17 +911,18 @@ static void _display_targets(alpm_list_t *targets, int verbose) /* print to screen */ pm_asprintf(&str, _("Targets (%d):"), alpm_list_count(targets)); - printf("\n"); + + cols = getcols(fileno(stdout)); if(verbose) { alpm_list_t *header = create_verbose_header(); - if(table_display(str, header, rows) != 0) { + if(table_display(str, header, rows, cols) != 0) { /* fallback to list display if table wouldn't fit */ - list_display(str, names); + list_display(str, names, cols); } alpm_list_free(header); } else { - list_display(str, names); + list_display(str, names, cols); } printf("\n"); @@ -1205,7 +1208,8 @@ void display_new_optdepends(alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg) if(optstrings) { printf(_("New optional dependencies for %s\n"), alpm_pkg_get_name(newpkg)); - list_display_linebreak(" ", optstrings); + unsigned short cols = getcols(fileno(stdout)); + list_display_linebreak(" ", optstrings, cols); } alpm_list_free(optdeps); @@ -1226,19 +1230,21 @@ void display_optdepends(alpm_pkg_t *pkg) if(optstrings) { printf(_("Optional dependencies for %s\n"), alpm_pkg_get_name(pkg)); - list_display_linebreak(" ", optstrings); + unsigned short cols = getcols(fileno(stdout)); + list_display_linebreak(" ", optstrings, cols); } FREELIST(optstrings); } -static void display_repo_list(const char *dbname, alpm_list_t *list) +static void display_repo_list(const char *dbname, alpm_list_t *list, + unsigned short cols) { const char *prefix= " "; printf(":: "); printf(_("Repository %s\n"), dbname); - list_display(prefix, list); + list_display(prefix, list, cols); } void select_display(const alpm_list_t *pkglist) @@ -1248,6 +1254,7 @@ void select_display(const alpm_list_t *pkglist) alpm_list_t *list = NULL; char *string = NULL; const char *dbname = NULL; + unsigned short cols = getcols(fileno(stdout)); for(i = pkglist; i; i = i->next) { alpm_pkg_t *pkg = i->data; @@ -1256,7 +1263,7 @@ void select_display(const alpm_list_t *pkglist) if(!dbname) dbname = alpm_db_get_name(db); if(strcmp(alpm_db_get_name(db), dbname) != 0) { - display_repo_list(dbname, list); + display_repo_list(dbname, list, cols); FREELIST(list); dbname = alpm_db_get_name(db); } @@ -1265,7 +1272,7 @@ void select_display(const alpm_list_t *pkglist) list = alpm_list_add(list, string); nth++; } - display_repo_list(dbname, list); + display_repo_list(dbname, list, cols); FREELIST(list); } diff --git a/src/pacman/util.h b/src/pacman/util.h index fc97707..7773c81 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -51,17 +51,21 @@ unsigned short getcols(int fd); int rmrf(const char *path); const char *mbasename(const char *path); char *mdirname(const char *path); -void indentprint(const char *str, size_t indent); +void indentprint(const char *str, unsigned short indent, unsigned short cols); size_t strtrim(char *str); char *strreplace(const char *str, const char *needle, const char *replace); alpm_list_t *strsplit(const char *str, const char splitchar); -void string_display(const char *title, const char *string); +void string_display(const char *title, const char *string, unsigned short cols); double humanize_size(off_t bytes, const char target_unit, int precision, const char **label); -int table_display(const char *title, const alpm_list_t *header, const alpm_list_t *rows); -void list_display(const char *title, const alpm_list_t *list); -void list_display_linebreak(const char *title, const alpm_list_t *list); -void signature_display(const char *title, alpm_siglist_t *siglist); +int table_display(const char *title, const alpm_list_t *header, + const alpm_list_t *rows, unsigned short cols); +void list_display(const char *title, const alpm_list_t *list, + unsigned short maxcols); +void list_display_linebreak(const char *title, const alpm_list_t *list, + unsigned short maxcols); +void signature_display(const char *title, alpm_siglist_t *siglist, + unsigned short maxcols); void display_targets(void); int str_cmp(const void *s1, const void *s2); void display_new_optdepends(alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg); -- 1.7.9.4 From dan at archlinux.org Fri Mar 16 19:19:59 2012 From: dan at archlinux.org (Dan McGee) Date: Fri, 16 Mar 2012 18:19:59 -0500 Subject: [pacman-dev] [PATCH 3/3] Change table_display() to be static In-Reply-To: <1331939999-21035-1-git-send-email-dan@archlinux.org> References: <1331939999-21035-1-git-send-email-dan@archlinux.org> Message-ID: <1331939999-21035-3-git-send-email-dan@archlinux.org> It is only used inside util.c. Signed-off-by: Dan McGee --- src/pacman/util.c | 2 +- src/pacman/util.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index 4b8684e..f2ab163 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -605,7 +605,7 @@ static size_t table_calc_widths(const alpm_list_t *header, * @param cols the number of columns available in the terminal * @return -1 if not enough terminal cols available, else 0 */ -int table_display(const char *title, const alpm_list_t *header, +static int table_display(const char *title, const alpm_list_t *header, const alpm_list_t *rows, unsigned short cols) { const unsigned short padding = 2; diff --git a/src/pacman/util.h b/src/pacman/util.h index 7773c81..0dfdc85 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -58,8 +58,6 @@ alpm_list_t *strsplit(const char *str, const char splitchar); void string_display(const char *title, const char *string, unsigned short cols); double humanize_size(off_t bytes, const char target_unit, int precision, const char **label); -int table_display(const char *title, const alpm_list_t *header, - const alpm_list_t *rows, unsigned short cols); void list_display(const char *title, const alpm_list_t *list, unsigned short maxcols); void list_display_linebreak(const char *title, const alpm_list_t *list, -- 1.7.9.4 From dgbaley27 at 0x01b.net Sat Mar 17 15:05:20 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Sat, 17 Mar 2012 13:05:20 -0600 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F5EC5E5.4070803@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> Message-ID: <4F64E070.5080002@0x01b.net> On 03/12/2012 09:58 PM, Allan McRae wrote: > blah I have a patch that I've tested (a little bit) that appears to work... Is there any reason why devel_update() actually needs to do an in-place sed? I replaced it with an eval and its working fine. The function now looks like: if [[ -n $newpkgver ]]; then if [[ $newpkgver != "$pkgver" ]]; then eval $(sed -e "s/^pkgver=[^ ]*/pkgver=$newpkgver/" \ -e "s/^pkgrel=[^ ]*/pkgrel=1/" \ "$BUILDFILE") fi fi >From the git history it looks like it's been in-place since the start, so I can't find any explanation if it exists. From thomas at archlinux.org Sat Mar 17 15:26:56 2012 From: thomas at archlinux.org (=?ISO-8859-15?Q?Thomas_B=E4chler?=) Date: Sat, 17 Mar 2012 20:26:56 +0100 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F64E070.5080002@0x01b.net> References: <4F5EC5E5.4070803@archlinux.org> <4F64E070.5080002@0x01b.net> Message-ID: <4F64E580.1000704@archlinux.org> Am 17.03.2012 20:05, schrieb Matthew Monaco: > Is there any reason why devel_update() actually needs to do an in-place sed? I > replaced it with an eval and its working fine. > > The function now looks like: > > if [[ -n $newpkgver ]]; then > if [[ $newpkgver != "$pkgver" ]]; then > eval $(sed -e "s/^pkgver=[^ ]*/pkgver=$newpkgver/" \ > -e "s/^pkgrel=[^ ]*/pkgrel=1/" \ > "$BUILDFILE") > fi > fi As discussed somewhere else in this thread, the devel build shouldn't modify the PKGBUILD at all. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From dgbaley27 at 0x01b.net Sat Mar 17 15:47:56 2012 From: dgbaley27 at 0x01b.net (Matthew Monaco) Date: Sat, 17 Mar 2012 13:47:56 -0600 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F64E580.1000704@archlinux.org> References: <4F5EC5E5.4070803@archlinux.org> <4F64E070.5080002@0x01b.net> <4F64E580.1000704@archlinux.org> Message-ID: <4F64EA6C.6020903@0x01b.net> On 03/17/2012 01:26 PM, Thomas B?chler wrote: > Am 17.03.2012 20:05, schrieb Matthew Monaco: >> Is there any reason why devel_update() actually needs to do an in-place sed? I >> replaced it with an eval and its working fine. >> >> The function now looks like: >> >> if [[ -n $newpkgver ]]; then >> if [[ $newpkgver != "$pkgver" ]]; then >> eval $(sed -e "s/^pkgver=[^ ]*/pkgver=$newpkgver/" \ >> -e "s/^pkgrel=[^ ]*/pkgrel=1/" \ >> "$BUILDFILE") >> fi >> fi > > As discussed somewhere else in this thread, the devel build shouldn't > modify the PKGBUILD at all. > I know, but it does. It's a gripe of mine. What I'm saying is this appears to work *now* as a drop in change. In the meantime I'm playing with Xyne's great idea of plugins. From allan at archlinux.org Sun Mar 18 03:27:34 2012 From: allan at archlinux.org (Allan McRae) Date: Sun, 18 Mar 2012 17:27:34 +1000 Subject: [pacman-dev] The great VCS packages overhaul of 2015 In-Reply-To: <4F64EA6C.6020903@0x01b.net> References: <4F5EC5E5.4070803@archlinux.org> <4F64E070.5080002@0x01b.net> <4F64E580.1000704@archlinux.org> <4F64EA6C.6020903@0x01b.net> Message-ID: <4F658E66.6040904@archlinux.org> On 18/03/12 05:47, Matthew Monaco wrote: > > In the meantime I'm playing with Xyne's great idea of plugins. > Just so you know... splitting out parts of makepkg has been discussed quite a bit already. That including solutions for how to enable running makepkg both from within the source tree and when installed. Allan From d at falconindy.com Tue Mar 20 00:00:31 2012 From: d at falconindy.com (Dave Reisner) Date: Tue, 20 Mar 2012 00:00:31 -0400 Subject: [pacman-dev] [PATCH] libalpm: add pkg-config file Message-ID: <1332216031-23075-1-git-send-email-dreisner@archlinux.org> Borrowed heavily from libarchive. Signed-off-by: Dave Reisner --- Throw a bone to the few projects who link against us... configure.ac | 1 + lib/libalpm/Makefile.am | 3 +++ lib/libalpm/libalpm.pc.in | 11 +++++++++++ 3 files changed, 15 insertions(+) create mode 100644 lib/libalpm/libalpm.pc.in diff --git a/configure.ac b/configure.ac index 12a6e65..9093a90 100644 --- a/configure.ac +++ b/configure.ac @@ -382,6 +382,7 @@ AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The shell used to run AC_CONFIG_FILES([ lib/libalpm/Makefile lib/libalpm/po/Makefile.in +lib/libalpm/libalpm.pc src/pacman/Makefile src/pacman/po/Makefile.in src/util/Makefile diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 61dcb87..17d9a58 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -23,6 +23,9 @@ if ENABLE_GNU89_INLINE_CC AM_CFLAGS += -fgnu89-inline endif +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libalpm.pc + libalpm_la_SOURCES = \ add.h add.c \ alpm.h alpm.c \ diff --git a/lib/libalpm/libalpm.pc.in b/lib/libalpm/libalpm.pc.in new file mode 100644 index 0000000..12bea28 --- /dev/null +++ b/lib/libalpm/libalpm.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libalpm +Description: Arch Linux package management library +Version: @VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lalpm +Libs.private: @LIBS@ -- 1.7.9.4 From allan at archlinux.org Tue Mar 20 10:02:14 2012 From: allan at archlinux.org (Allan McRae) Date: Wed, 21 Mar 2012 00:02:14 +1000 Subject: [pacman-dev] Debug symbol packages bikeshedding Message-ID: <4F688DE6.4010800@archlinux.org> I have been looking at the patches for automatic creation of packages with debug symbols. I think they are good starts, but before I polish them we need to decide on a few things. My preferences are highlighted with a (*) 1) the option in makepkg.conf and PKGBUILD options=() array - debug (*) - debugpkg - splitdbg - splitdebug 2) the naming of the package with debug symbols - foo-dbg - foo-debug (*) - foo-debuginfo - foo-debug-symbols (Note -dbg is Debian style, -debuginfo is RPM style, and -debug potentially conflicts with a few packages in the AUR but none in the Arch repos...) 3) what information the .PKGINFO file has: pkgdesc="Debugging symbols for $pkgname" Must be included: - pkgname - pkgver/pkgrel/epoch/arch as in parent package - depends=(parent=$epoch:$pkgver-$pkgrel) - license Should be included? - url - replaces - conflicts Do not include: - groups - provides - backup - install - changelog Allan From bluewind at xinu.at Tue Mar 20 10:13:34 2012 From: bluewind at xinu.at (Florian Pritz) Date: Tue, 20 Mar 2012 15:13:34 +0100 Subject: [pacman-dev] Debug symbol packages bikeshedding In-Reply-To: <4F688DE6.4010800@archlinux.org> References: <4F688DE6.4010800@archlinux.org> Message-ID: <4F68908E.8090709@xinu.at> On 20.03.2012 15:02, Allan McRae wrote: > I have been looking at the patches for automatic creation of packages > with debug symbols. I think they are good starts, but before I polish > them we need to decide on a few things. My preferences are highlighted > with a (*) > > 1) the option in makepkg.conf and PKGBUILD options=() array > - debug (*) > - debugpkg > - splitdbg > - splitdebug Assuming the only thing the option changes is that debug symbols are split into a separate package, I'd rather have splitdebug, because debug sounds like it would magically enable a debug build. (pass --debug to configure, add -g to CFLAGS or the like) > 2) the naming of the package with debug symbols > - foo-dbg > - foo-debug (*) > - foo-debuginfo > - foo-debug-symbols > > (Note -dbg is Debian style, -debuginfo is RPM style, and -debug > potentially conflicts with a few packages in the AUR but none in the > Arch repos...) The aur packages are probably not needed any more once we have this. Go with foo-debug > 3) what information the .PKGINFO file has: > > pkgdesc="Debugging symbols for $pkgname" > > Must be included: > - pkgname > - pkgver/pkgrel/epoch/arch as in parent package > - depends=(parent=$epoch:$pkgver-$pkgrel) > - license > > Should be included? > - url Can't hurt. > - replaces > - conflicts I guess those are not needed if we already depend on a specific version of the main package. > > Do not include: > - groups > - provides > - backup > - install > - changelog > > > Allan -- Florian Pritz -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: From allan at archlinux.org Tue Mar 20 10:34:52 2012 From: allan at archlinux.org (Allan McRae) Date: Wed, 21 Mar 2012 00:34:52 +1000 Subject: [pacman-dev] [PATCH] libalpm: add pkg-config file In-Reply-To: <1332216031-23075-1-git-send-email-dreisner@archlinux.org> References: <1332216031-23075-1-git-send-email-dreisner@archlinux.org> Message-ID: <4F68958C.9030900@archlinux.org> On 20/03/12 14:00, Dave Reisner wrote: > Borrowed heavily from libarchive. > > Signed-off-by: Dave Reisner > --- > Throw a bone to the few projects who link against us... > > configure.ac | 1 + > lib/libalpm/Makefile.am | 3 +++ > lib/libalpm/libalpm.pc.in | 11 +++++++++++ > 3 files changed, 15 insertions(+) > create mode 100644 lib/libalpm/libalpm.pc.in > > diff --git a/configure.ac b/configure.ac > index 12a6e65..9093a90 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -382,6 +382,7 @@ AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The shell used to run > AC_CONFIG_FILES([ > lib/libalpm/Makefile > lib/libalpm/po/Makefile.in > +lib/libalpm/libalpm.pc > src/pacman/Makefile > src/pacman/po/Makefile.in > src/util/Makefile > diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am > index 61dcb87..17d9a58 100644 > --- a/lib/libalpm/Makefile.am > +++ b/lib/libalpm/Makefile.am > @@ -23,6 +23,9 @@ if ENABLE_GNU89_INLINE_CC > AM_CFLAGS += -fgnu89-inline > endif > > +pkgconfigdir = $(libdir)/pkgconfig > +pkgconfig_DATA = libalpm.pc > + > libalpm_la_SOURCES = \ > add.h add.c \ > alpm.h alpm.c \ > diff --git a/lib/libalpm/libalpm.pc.in b/lib/libalpm/libalpm.pc.in > new file mode 100644 > index 0000000..12bea28 > --- /dev/null > +++ b/lib/libalpm/libalpm.pc.in > @@ -0,0 +1,11 @@ > +prefix=@prefix@ > +exec_prefix=@exec_prefix@ > +libdir=@libdir@ > +includedir=@includedir@ > + > +Name: libalpm > +Description: Arch Linux package management library > +Version: @VERSION@ > +Cflags: -I${includedir} > +Libs: -L${libdir} -lalpm > +Libs.private: @LIBS@ I do not think this is quite right... I end up with: Cflags: -I${includedir} Libs: -L${libdir} -lalpm Libs.private: -lssl -larchive -lm -lgpgme -lassuan -lgpg-error Note, no -lcurl or -lcrypto (although that is somewhat covered by -lssl) I am not pkg-config expert... but I think libcurl goes in a "Requires.private" section as it has a pkg-config files. So should libcrypto and libarchive. Libs.private should only have -libgpgme. Allan From allan at archlinux.org Fri Mar 23 10:14:01 2012 From: allan at archlinux.org (Allan McRae) Date: Sat, 24 Mar 2012 00:14:01 +1000 Subject: [pacman-dev] [PATCH] Make selecting scriptlet shell work Message-ID: <1332512041-23463-1-git-send-email-allan@archlinux.org> The initial patch to implement this achieved nothing apart from adding a configure option. This patch makes that configure option do what it advertises. Bug-found-by: Dave Reisner Signed-off-by: Allan McRae --- lib/libalpm/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index fe89e40..4309c07 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -343,7 +343,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath, _alpm_log(handle, ALPM_LOG_DEBUG, "executing \"%s\"\n", cmdline); - retval = _alpm_run_chroot(handle, "/bin/sh", argv); + retval = _alpm_run_chroot(handle, SCRIPTLET_SHELL, argv); cleanup: if(scriptfn && unlink(scriptfn)) { -- 1.7.9.4 From d at falconindy.com Fri Mar 23 10:47:43 2012 From: d at falconindy.com (Dave Reisner) Date: Fri, 23 Mar 2012 10:47:43 -0400 Subject: [pacman-dev] [PATCH] Make selecting scriptlet shell work In-Reply-To: <1332512041-23463-1-git-send-email-allan@archlinux.org> References: <1332512041-23463-1-git-send-email-allan@archlinux.org> Message-ID: <20120323144743.GF23966@rampage> On Sat, Mar 24, 2012 at 12:14:01AM +1000, Allan McRae wrote: > The initial patch to implement this achieved nothing apart from > adding a configure option. This patch makes that configure option > do what it advertises. Should we not alter the configure option's help text and default value as well? It needs to be an absolute path since we pass to execv, not execvp. > Bug-found-by: Dave Reisner > Signed-off-by: Allan McRae > --- > lib/libalpm/trans.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c > index fe89e40..4309c07 100644 > --- a/lib/libalpm/trans.c > +++ b/lib/libalpm/trans.c > @@ -343,7 +343,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath, > > _alpm_log(handle, ALPM_LOG_DEBUG, "executing \"%s\"\n", cmdline); > > - retval = _alpm_run_chroot(handle, "/bin/sh", argv); > + retval = _alpm_run_chroot(handle, SCRIPTLET_SHELL, argv); > > cleanup: > if(scriptfn && unlink(scriptfn)) { > -- > 1.7.9.4 > > From allan at archlinux.org Fri Mar 23 10:53:07 2012 From: allan at archlinux.org (Allan McRae) Date: Sat, 24 Mar 2012 00:53:07 +1000 Subject: [pacman-dev] [PATCH] Make selecting scriptlet shell work In-Reply-To: <20120323144743.GF23966@rampage> References: <1332512041-23463-1-git-send-email-allan@archlinux.org> <20120323144743.GF23966@rampage> Message-ID: <4F6C8E53.700@archlinux.org> On 24/03/12 00:47, Dave Reisner wrote: > On Sat, Mar 24, 2012 at 12:14:01AM +1000, Allan McRae wrote: >> The initial patch to implement this achieved nothing apart from >> adding a configure option. This patch makes that configure option >> do what it advertises. > > Should we not alter the configure option's help text and default value > as well? It needs to be an absolute path since we pass to execv, not > execvp. Crap... I didn't realise the default was broken too. Will update the patch tomorrow. Allan From pierre at archlinux.de Sun Mar 25 08:10:39 2012 From: pierre at archlinux.de (Pierre Schmitz) Date: Sun, 25 Mar 2012 14:10:39 +0200 Subject: [pacman-dev] [PATCH 1/4] pacman-key: lsign keys in --populate without prompting Message-ID: <1332677442-32075-1-git-send-email-pierre@archlinux.de> There is no gain in security when we ask the user to type in "y" on every single key. It also makes scripting harder. Signed-off-by: Pierre Schmitz --- scripts/pacman-key.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index 482b56d..32c70dc 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -275,7 +275,7 @@ populate_keyring() { msg "$(gettext "Locally signing trusted keys in keyring...")" for key_id in "${!trusted_ids[@]}"; do msg2 "$(gettext "Locally signing key %s...")" "${key_id}" - "${GPG_PACMAN[@]}" --quiet --lsign-key "${key_id}" + "${GPG_PACMAN[@]}" --quiet --batch --yes --lsign-key "${key_id}" done msg "$(gettext "Importing owner trust values...")" for keyring in "${KEYRINGIDS[@]}"; do -- 1.7.9.4 From pierre at archlinux.de Sun Mar 25 08:10:40 2012 From: pierre at archlinux.de (Pierre Schmitz) Date: Sun, 25 Mar 2012 14:10:40 +0200 Subject: [pacman-dev] [PATCH 2/4] pacman-key: Use --yes to confirm lsign-key In-Reply-To: <1332677442-32075-1-git-send-email-pierre@archlinux.de> References: <1332677442-32075-1-git-send-email-pierre@archlinux.de> Message-ID: <1332677442-32075-2-git-send-email-pierre@archlinux.de> We can just use --yes in batch mode. Also piping "y" two times was unnecessary. We also no longer need to use LANG=C for this call. Signed-off-by: Pierre Schmitz --- scripts/pacman-key.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index 32c70dc..46773ac 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -413,7 +413,7 @@ list_sigs() { lsign_keys() { check_keyids_exist - printf 'y\ny\n' | LANG=C "${GPG_PACMAN[@]}" --command-fd 0 --quiet --batch --lsign-key "${KEYIDS[@]}" 2>/dev/null + "${GPG_PACMAN[@]}" --yes --quiet --batch --lsign-key "${KEYIDS[@]}" 2>/dev/null if (( PIPESTATUS[1] )); then error "$(gettext "A specified key could not be locally signed.")" exit 1 -- 1.7.9.4 From pierre at archlinux.de Sun Mar 25 08:10:41 2012 From: pierre at archlinux.de (Pierre Schmitz) Date: Sun, 25 Mar 2012 14:10:41 +0200 Subject: [pacman-dev] [PATCH 3/4] pacman-key: reduce verbosity of --populate In-Reply-To: <1332677442-32075-1-git-send-email-pierre@archlinux.de> References: <1332677442-32075-1-git-send-email-pierre@archlinux.de> Message-ID: <1332677442-32075-3-git-send-email-pierre@archlinux.de> Do not bother the user with gpg's verbose output. Signed-off-by: Pierre Schmitz --- scripts/pacman-key.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index 46773ac..4c02d7d 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -250,7 +250,7 @@ populate_keyring() { # Add keys from requested keyrings for keyring in "${KEYRINGIDS[@]}"; do msg "$(gettext "Appending keys from %s.gpg...")" "$keyring" - "${GPG_PACMAN[@]}" --import "${KEYRING_IMPORT_DIR}/${keyring}.gpg" + "${GPG_PACMAN[@]}" --import "${KEYRING_IMPORT_DIR}/${keyring}.gpg" 2>/dev/null done # Read the trusted key IDs to an array. Because this is an ownertrust @@ -275,12 +275,12 @@ populate_keyring() { msg "$(gettext "Locally signing trusted keys in keyring...")" for key_id in "${!trusted_ids[@]}"; do msg2 "$(gettext "Locally signing key %s...")" "${key_id}" - "${GPG_PACMAN[@]}" --quiet --batch --yes --lsign-key "${key_id}" + "${GPG_PACMAN[@]}" --quiet --batch --yes --lsign-key "${key_id}" 2>/dev/null done msg "$(gettext "Importing owner trust values...")" for keyring in "${KEYRINGIDS[@]}"; do if [[ -f "${KEYRING_IMPORT_DIR}/${keyring}-trusted" ]]; then - "${GPG_PACMAN[@]}" --import-ownertrust "${KEYRING_IMPORT_DIR}/${keyring}-trusted" + "${GPG_PACMAN[@]}" --import-ownertrust "${KEYRING_IMPORT_DIR}/${keyring}-trusted" 2>/dev/null fi done fi -- 1.7.9.4 From pierre at archlinux.de Sun Mar 25 08:10:42 2012 From: pierre at archlinux.de (Pierre Schmitz) Date: Sun, 25 Mar 2012 14:10:42 +0200 Subject: [pacman-dev] [PATCH 4/4] pacman-key: Actually verify signatures and exit with correct codes In-Reply-To: <1332677442-32075-1-git-send-email-pierre@archlinux.de> References: <1332677442-32075-1-git-send-email-pierre@archlinux.de> Message-ID: <1332677442-32075-4-git-send-email-pierre@archlinux.de> We cannot rely on gpg's exit code. Instead we have to check the status-fd to figoure out whether a signature is valid or not. In addition to this pacman-key --verify can now be used in scripts as it will return an exit code of 1 if the signature is invalid. Signed-off-by: Pierre Schmitz --- scripts/pacman-key.sh.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index 4c02d7d..c5ecca5 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -436,10 +436,16 @@ refresh_keys() { } verify_sig() { - if ! "${GPG_PACMAN[@]}" --verify $SIGNATURE ; then + local fd="$(mktemp)" + exec 4>"${fd}" + "${GPG_PACMAN[@]}" --status-fd 4 --verify $SIGNATURE + exec 4>&- + if ! grep -q TRUST_FULLY "${fd}"; then + rm -f "${fd}" error "$(gettext "The signature identified by %s could not be verified.")" "$SIGNATURE" exit 1 fi + rm -f "${fd}" } updatedb() { -- 1.7.9.4 From allan at archlinux.org Sun Mar 25 10:23:35 2012 From: allan at archlinux.org (Allan McRae) Date: Mon, 26 Mar 2012 00:23:35 +1000 Subject: [pacman-dev] [PATCH 4/4] pacman-key: Actually verify signatures and exit with correct codes In-Reply-To: <1332677442-32075-4-git-send-email-pierre@archlinux.de> References: <1332677442-32075-1-git-send-email-pierre@archlinux.de> <1332677442-32075-4-git-send-email-pierre@archlinux.de> Message-ID: <4F6F2A67.9040901@archlinux.org> On 25/03/12 22:10, Pierre Schmitz wrote: > We cannot rely on gpg's exit code. Instead we have to check the status-fd to > figoure out whether a signature is valid or not. typo ^ > In addition to this pacman-key --verify can now be used in scripts as it will > return an exit code of 1 if the signature is invalid. > > Signed-off-by: Pierre Schmitz > --- > scripts/pacman-key.sh.in | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in > index 4c02d7d..c5ecca5 100644 > --- a/scripts/pacman-key.sh.in > +++ b/scripts/pacman-key.sh.in > @@ -436,10 +436,16 @@ refresh_keys() { > } > > verify_sig() { > - if ! "${GPG_PACMAN[@]}" --verify $SIGNATURE ; then > + local fd="$(mktemp)" > + exec 4>"${fd}" > + "${GPG_PACMAN[@]}" --status-fd 4 --verify $SIGNATURE I think it would be safer to use --status-file here. We do that when verifying signatures in makepkg. > + exec 4>&- > + if ! grep -q TRUST_FULLY "${fd}"; then > + rm -f "${fd}" > error "$(gettext "The signature identified by %s could not be verified.")" "$SIGNATURE" > exit 1 > fi > + rm -f "${fd}" > } > > updatedb() { From allan at archlinux.org Sun Mar 25 10:25:05 2012 From: allan at archlinux.org (Allan McRae) Date: Mon, 26 Mar 2012 00:25:05 +1000 Subject: [pacman-dev] [PATCH 3/4] pacman-key: reduce verbosity of --populate In-Reply-To: <1332677442-32075-3-git-send-email-pierre@archlinux.de> References: <1332677442-32075-1-git-send-email-pierre@archlinux.de> <1332677442-32075-3-git-send-email-pierre@archlinux.de> Message-ID: <4F6F2AC1.7080107@archlinux.org> On 25/03/12 22:10, Pierre Schmitz wrote: > Do not bother the user with gpg's verbose output. > > Signed-off-by: Pierre Schmitz > --- > scripts/pacman-key.sh.in | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in > index 46773ac..4c02d7d 100644 > --- a/scripts/pacman-key.sh.in > +++ b/scripts/pacman-key.sh.in > @@ -250,7 +250,7 @@ populate_keyring() { > # Add keys from requested keyrings > for keyring in "${KEYRINGIDS[@]}"; do > msg "$(gettext "Appending keys from %s.gpg...")" "$keyring" > - "${GPG_PACMAN[@]}" --import "${KEYRING_IMPORT_DIR}/${keyring}.gpg" > + "${GPG_PACMAN[@]}" --import "${KEYRING_IMPORT_DIR}/${keyring}.gpg" 2>/dev/null Is the output on stderr? I am reluctant to remove real error output. > done > > # Read the trusted key IDs to an array. Because this is an ownertrust > @@ -275,12 +275,12 @@ populate_keyring() { > msg "$(gettext "Locally signing trusted keys in keyring...")" > for key_id in "${!trusted_ids[@]}"; do > msg2 "$(gettext "Locally signing key %s...")" "${key_id}" > - "${GPG_PACMAN[@]}" --quiet --batch --yes --lsign-key "${key_id}" > + "${GPG_PACMAN[@]}" --quiet --batch --yes --lsign-key "${key_id}" 2>/dev/null > done > msg "$(gettext "Importing owner trust values...")" > for keyring in "${KEYRINGIDS[@]}"; do > if [[ -f "${KEYRING_IMPORT_DIR}/${keyring}-trusted" ]]; then > - "${GPG_PACMAN[@]}" --import-ownertrust "${KEYRING_IMPORT_DIR}/${keyring}-trusted" > + "${GPG_PACMAN[@]}" --import-ownertrust "${KEYRING_IMPORT_DIR}/${keyring}-trusted" 2>/dev/null > fi > done > fi From pierre at archlinux.de Sun Mar 25 11:00:43 2012 From: pierre at archlinux.de (Pierre Schmitz) Date: Sun, 25 Mar 2012 16:00:43 +0100 Subject: [pacman-dev] [PATCH 3/4] pacman-key: reduce verbosity of --populate In-Reply-To: <4F6F2AC1.7080107@archlinux.org> References: <1332677442-32075-1-git-send-email-pierre@archlinux.de> <1332677442-32075-3-git-send-email-pierre@archlinux.de> <4F6F2AC1.7080107@archlinux.org> Message-ID: Am 25.03.2012 15:25, schrieb Allan McRae: > On 25/03/12 22:10, Pierre Schmitz wrote: >> Do not bother the user with gpg's verbose output. >> >> Signed-off-by: Pierre Schmitz >> --- >> scripts/pacman-key.sh.in | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in >> index 46773ac..4c02d7d 100644 >> --- a/scripts/pacman-key.sh.in >> +++ b/scripts/pacman-key.sh.in >> @@ -250,7 +250,7 @@ populate_keyring() { >> # Add keys from requested keyrings >> for keyring in "${KEYRINGIDS[@]}"; do >> msg "$(gettext "Appending keys from %s.gpg...")" "$keyring" >> - "${GPG_PACMAN[@]}" --import "${KEYRING_IMPORT_DIR}/${keyring}.gpg" >> + "${GPG_PACMAN[@]}" --import "${KEYRING_IMPORT_DIR}/${keyring}.gpg" 2>/dev/null > > Is the output on stderr? I am reluctant to remove real error output. There shouldn't be much critical output here. But gpg also accepts the --quiet flag here which still outputs useless data but much less. -- Pierre Schmitz, https://pierre-schmitz.com From canyonknight at gmail.com Sun Mar 25 13:46:22 2012 From: canyonknight at gmail.com (canyonknight at gmail.com) Date: Sun, 25 Mar 2012 13:46:22 -0400 Subject: [pacman-dev] [PATCH] checkupdates: add new contrib script In-Reply-To: References: Message-ID: On Fri, Feb 24, 2012 at 12:39 AM, keenerd wrote: > checkupdates provides a way of checking for new updates without > touching the local sync database. ?Based heavily on a script > by Dave Reisner. > --- > ?contrib/.gitignore ? ? ?| ? ?1 + > ?contrib/Makefile.am ? ? | ? ?3 +++ > ?contrib/checkupdates.in | ? 44 ++++++++++++++++++++++++++++++++++++++++++++ > ?3 files changed, 48 insertions(+), 0 deletions(-) > ?create mode 100644 contrib/checkupdates.in > > diff --git a/contrib/.gitignore b/contrib/.gitignore > index 19b81e0..36c0918 100644 > --- a/contrib/.gitignore > +++ b/contrib/.gitignore > @@ -1,5 +1,6 @@ > ?bacman > ?bash_completion > +checkupdates > ?paccache > ?pacdiff > ?paclist > diff --git a/contrib/Makefile.am b/contrib/Makefile.am > index eca39e7..1ead042 100644 > --- a/contrib/Makefile.am > +++ b/contrib/Makefile.am > @@ -6,6 +6,7 @@ bin_SCRIPTS = \ > > ?OURSCRIPTS = \ > ? ? ? ?bacman \ > + ? ? ? checkupdates \ > ? ? ? ?paccache \ > ? ? ? ?pacdiff \ > ? ? ? ?paclist \ > @@ -22,6 +23,7 @@ EXTRA_DIST = \ > ? ? ? ?PKGBUILD.vim \ > ? ? ? ?bacman.in \ > ? ? ? ?bash_completion.in \ > + ? ? ? checkupdates.in \ > ? ? ? ?paccache.in \ > ? ? ? ?paclog-pkglist.in \ > ? ? ? ?pacdiff.in \ > @@ -76,6 +78,7 @@ uninstall-local: > > ?bacman: $(srcdir)/bacman.in > ?bash_completion: $(srcdir)/bash_completion.in > +checkupdates: $(srcdir)/checkupdates.in > ?paccache: $(srcdir)/paccache.in > ?pacdiff: $(srcdir)/pacdiff.in > ?paclist: $(srcdir)/paclist.in > diff --git a/contrib/checkupdates.in b/contrib/checkupdates.in > new file mode 100644 > index 0000000..e16378f > --- /dev/null > +++ b/contrib/checkupdates.in > @@ -0,0 +1,44 @@ > +#!/bin/bash > +# > +# checkupdates: Safely print a list of pending updates. > +# > +# Copyright (c) 2011 Kyle Keen > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 2 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. ?If not, see . > +# > + > +if (( $# > 0 )); then > + ? ? ? echo "checkupdate: Safely print a list of pending updates." Very minor, but shouldn't that be checkupdates and not checkupdate? > + ? ? ? echo "Use: checkupdates" > + ? ? ? echo "Export the 'CHECKUPDATE_DB' variable to change the path of the > temporary database." > + ? ? ? exit 0 > +fi > + > +if [[ -z $CHECKUPDATE_DB ]]; then > + ? ? ? CHECKUPDATE_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/" > +fi > + > +trap 'rm -f $CHECKUPDATE_DB/db.lck' INT TERM EXIT If I export CHECKUPDATE_DB to a path with a space this could delete a file that it shouldn't. > + > +eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf) > +DBPath="${DBPath:- at localstatedir@/lib/pacman/}" > + > +mkdir -p "$CHECKUPDATE_DB" > +ln -s "${DBPath}/local" "$CHECKUPDATE_DB" &> /dev/null > +fakeroot pacman -Sqy --dbpath "$CHECKUPDATE_DB" &> /dev/null > +pacman -Qqu --dbpath "$CHECKUPDATE_DB" 2> /dev/null > + > +exit 0 > + > +# vim: set ts=2 sw=2 noet: > -- > 1.7.9 > From daniel.wallace at gatech.edu Sun Mar 25 22:45:47 2012 From: daniel.wallace at gatech.edu (Daniel Wallace) Date: Sun, 25 Mar 2012 22:45:47 -0400 Subject: [pacman-dev] [PATCH 164/164] pacman-key The first thing I did was instead of running _pacman "$@" it now runs _pacman_comp "$@". This function uses a switch statement on $service so if pacman is the command it runs _pacman "$@" like it does right now, but if the command is pacman-key, _pacman_key "$@" is run instead. This function auto completes all the pacman-key flags and also provides the description next to the arguments. It also allows for completion of dirs for arguments like --gpgdir, and autocompletes .sig files for --verify, and gpg files for --import. Message-ID: <20120326024547.GC31120@Daniel-Tower> This patch is for zsh_completions for pacman-key The first thing I did was instead of running _pacman "$@" it now runs _pacman_comp "$@". This function uses a switch statement on $service so if pacman is the command it runs _pacman "$@" like it does right now, but if the command is pacman-key, _pacman_key "$@" is run instead. This function auto completes all the pacman-key flags and also provides the description next to the arguments. It also allows for completion of dirs for arguments like --gpgdir, and autocompletes .sig files for --verify, and gpg files for --import. This patch will also allow for keyids and emails to be auto completed from pacman-key --list-keys and other commands which use keyids. the _keys() function is the one that does this, it #uses the first \< to the end and remove first \> to the end to get all the emails #the using the first \/ to end then remove first '\ ' to the end this gets all the keyids (pub and sub) the ##uid* removes all the .jpeg pictures with ids, and ##pubbring.gpg removes the beginning line that lists where stuff is stored, ##\-\-* removes the line of dashes at the beginning, but doesn't remove email addresses with dashes in them. Signed-off-by: Daniel Wallace --- contrib/zsh_completion.in | 56 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index b30e960..608fa0c 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -1,4 +1,4 @@ -#compdef pacman pacman.static=pacman +#compdef pacman pacman.static=pacman pacman-key # copy this file to /usr/share/zsh/site-functions/_pacman @@ -332,5 +332,55 @@ _pacman() { esac } -# run the main dispatcher -_pacman "$@" +_pacman_key() { + _arguments \ + '(- :)'{-h,--help}"[show help]" \ + '(-a --add)*'{-a,--add}"[Add the specified keys (empty for stdin)]: :_files" \ + '(-d --delete)*'{-d,--delete}"[Remove the Specified keyids]: :_keys" \ + '(-e --export)*'{-e,--export}"[Export the specified or all keyids]: :_keys" \ + '(-f --finger)*'{-f,--finger}"[List fingreprint for specidied or all keyids]: :_keys" \ + '(-l --list-keys)*'{-l,--list-keys}"[List the specified or all keys]: :_keys" \ + '(-r --recv-keys)*'{-r,--recv-keys}"[Fetch the specified keyids]: :_keys" \ + '(-u --updatedb)*'{-u,--updatedb}"[Update the trustdb of pacman]" \ + '(-v --verify)*'{-v,--verify}"[Verify the file specified by the signature]: :_files -g '*.sig'" \ + '(-V --version)*'{-V,--version}"[Show program version]" \ + '(--config)*'{*,--config}"[Use an alternate config file]: :_files" \ + '(--edit-key)*'{*,--edit-key}"[Present a menu for key management task on keyids]: :_keys" \ + '(--gpgdir)*'{*,--gpgdir}"[Set an alternate directory for GnuPG (instead of '/etc/pacman.d/gnupg')]: :_files -/" \ + '(--import)*'{*,--import}"[Imports pubring.gpg from dir(s)]: :_files -g '*.gpg'" \ + '(--import-trustdb)*'{*,--import-tb}"[Imports ownertrust values from trustdb.gpg in dir(s)]: :_files -g '*.gpg'" \ + '(--init)*'{*,--init}"[Ensure the keyring is properly initialized]" \ + '(--keyserver)*'{*,--keyserver}"[Specify a keyserver to use if necessary]" \ + '(--list-sigs)*'{*,--list-sigs}"[List keys and their signatures]: :_keys" \ + '(--lsign-key)*'{*,--lsign-key}"[Locally sign the specified keyid]: :_keys" \ + '(--populate)*'{*,--populate}"[Reload the default keys from the (given) keyrings in '/usr/share/pacman/keyrings']: :_path_files -W /usr/share/pacman/keyrings" \ + '(--refresh-keys)*'{*,--refresh-keys}"[Update specified or all keys from a keyserver]: :_keys" +} + +_keys() { + local keys + #uses the first \< to the end and remove first \> to the end to get all the emails + #the using the first \/ to end then remove first '\ ' to the end this gets all the keyids (pub and sub) + #the ##uid* removes all the .jpeg pictures with ids, and ##pubbring.gpg removes the beginning line that lists + #where stuff is stored, ##\-\-* removes the line of dashes at the beginning, but doesn't remove email addresses + #with dashes in them + keys=( ${${${${${${${${${(f)"$(pacman-key --list-keys 2>/dev/null)"}}##*\<}%%\>}##*\/}%%\ *}##uid*}##pubring.gpg}##\-\-*} ) + _describe -t modules 'keys in keyring' keys && return 0 +} + +_pacman_comp() { + case "$service" in + pacman) + _pacman "$@";; + pacman-key) + _pacman_key "$@";; + *) + _message "Error";; + esac +} + +_pacman_comp "$@" + + + +# vim: ft=zsh sw=2 ts=2 et -- 1.7.9.4 From Daniel.wallace at gatech.edu Sun Mar 25 23:54:24 2012 From: Daniel.wallace at gatech.edu (Daniel.wallace at gatech.edu) Date: Sun, 25 Mar 2012 23:54:24 -0400 Subject: [pacman-dev] [PATCH] this patch is to add zsh completion to pacman-key Message-ID: <1332734064-31556-1-git-send-email-Daniel.wallace@gatech.edu> From: Daniel Wallace Sorry about my first email, hopefully this one will be in a better format and without the entire first paragraph in the subject line. The first thing I did was instead of running _pacman "$@" it now runs _pacman_comp "$@". This function uses a switch statement on $service so if pacman is the command it runs _pacman "$@" like it does right now, but if the command is pacman-key, _pacman_key "$@" is run instead. This function auto completes all the pacman-key flags and also provides the description next to the arguments. It also allows for completion of dirs for arguments like --gpgdir, and autocompletes .sig files for --verify, and gpg files for --import. This patch will also allow for keyids and emails to be auto completed from pacman-key --list-keys and other commands which use keyids. the _keys() function is the one that does this, it #uses the first \< to the end and remove first \> to the end to get all the emails #the using the first \/ to end then remove first '\ ' to the end this gets all the keyids (pub and sub) the ##uid* removes all the .jpeg pictures with ids, and ##pubbring.gpg removes the beginning line that lists where stuff is stored, ##\-\-* removes the line of dashes at the beginning, but doesn't remove email addresses with dashes in them. Signed-off-by: Daniel Wallace --- contrib/zsh_completion.in | 56 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index b30e960..608fa0c 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -1,4 +1,4 @@ -#compdef pacman pacman.static=pacman +#compdef pacman pacman.static=pacman pacman-key # copy this file to /usr/share/zsh/site-functions/_pacman @@ -332,5 +332,55 @@ _pacman() { esac } -# run the main dispatcher -_pacman "$@" +_pacman_key() { + _arguments \ + '(- :)'{-h,--help}"[show help]" \ + '(-a --add)*'{-a,--add}"[Add the specified keys (empty for stdin)]: :_files" \ + '(-d --delete)*'{-d,--delete}"[Remove the Specified keyids]: :_keys" \ + '(-e --export)*'{-e,--export}"[Export the specified or all keyids]: :_keys" \ + '(-f --finger)*'{-f,--finger}"[List fingreprint for specidied or all keyids]: :_keys" \ + '(-l --list-keys)*'{-l,--list-keys}"[List the specified or all keys]: :_keys" \ + '(-r --recv-keys)*'{-r,--recv-keys}"[Fetch the specified keyids]: :_keys" \ + '(-u --updatedb)*'{-u,--updatedb}"[Update the trustdb of pacman]" \ + '(-v --verify)*'{-v,--verify}"[Verify the file specified by the signature]: :_files -g '*.sig'" \ + '(-V --version)*'{-V,--version}"[Show program version]" \ + '(--config)*'{*,--config}"[Use an alternate config file]: :_files" \ + '(--edit-key)*'{*,--edit-key}"[Present a menu for key management task on keyids]: :_keys" \ + '(--gpgdir)*'{*,--gpgdir}"[Set an alternate directory for GnuPG (instead of '/etc/pacman.d/gnupg')]: :_files -/" \ + '(--import)*'{*,--import}"[Imports pubring.gpg from dir(s)]: :_files -g '*.gpg'" \ + '(--import-trustdb)*'{*,--import-tb}"[Imports ownertrust values from trustdb.gpg in dir(s)]: :_files -g '*.gpg'" \ + '(--init)*'{*,--init}"[Ensure the keyring is properly initialized]" \ + '(--keyserver)*'{*,--keyserver}"[Specify a keyserver to use if necessary]" \ + '(--list-sigs)*'{*,--list-sigs}"[List keys and their signatures]: :_keys" \ + '(--lsign-key)*'{*,--lsign-key}"[Locally sign the specified keyid]: :_keys" \ + '(--populate)*'{*,--populate}"[Reload the default keys from the (given) keyrings in '/usr/share/pacman/keyrings']: :_path_files -W /usr/share/pacman/keyrings" \ + '(--refresh-keys)*'{*,--refresh-keys}"[Update specified or all keys from a keyserver]: :_keys" +} + +_keys() { + local keys + #uses the first \< to the end and remove first \> to the end to get all the emails + #the using the first \/ to end then remove first '\ ' to the end this gets all the keyids (pub and sub) + #the ##uid* removes all the .jpeg pictures with ids, and ##pubbring.gpg removes the beginning line that lists + #where stuff is stored, ##\-\-* removes the line of dashes at the beginning, but doesn't remove email addresses + #with dashes in them + keys=( ${${${${${${${${${(f)"$(pacman-key --list-keys 2>/dev/null)"}}##*\<}%%\>}##*\/}%%\ *}##uid*}##pubring.gpg}##\-\-*} ) + _describe -t modules 'keys in keyring' keys && return 0 +} + +_pacman_comp() { + case "$service" in + pacman) + _pacman "$@";; + pacman-key) + _pacman_key "$@";; + *) + _message "Error";; + esac +} + +_pacman_comp "$@" + + + +# vim: ft=zsh sw=2 ts=2 et -- 1.7.9.4 From talespin_kit at yahoo.com Tue Mar 27 13:55:20 2012 From: talespin_kit at yahoo.com (Talespin Kit) Date: Tue, 27 Mar 2012 10:55:20 -0700 (PDT) Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 Message-ID: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> Hi, I have tried to do the Offline Installation as described in the ArchLinux wiki, but it did not worked out as i have mentioned in the thread http://stackoverflow.com/posts/comments/12588344. Hence i have planned to compile the pacman in a machine which has internet connection and then download the packages using the compiled pacman binary and then transfer it to offline ArchLinux Machine. While i tried to compile the pacman in Ubuntu-11.10 machine i got the following errors $ make # after ./autogen.sh && ./configure make all-recursive make[1]: Entering directory `/home/talespin/archlinux/pacman' Making all in lib/libalpm make[2]: Entering directory `/home/talespin/archlinux/pacman/lib/libalpm' Making all in po make[3]: Entering directory `/home/talespin/archlinux/pacman/lib/libalpm/po' test ! -f ./libalpm.pot || \ test -z "ca.gmo cs.gmo da.gmo de.gmo el.gmo en_GB.gmo es.gmo fi.gmo fr.gmo hu.gmo it.gmo kk.gmo lt.gmo nb.gmo pl.gmo pt.gmo pt_BR.gmo ro.gmo ru.gmo sk.gmo sr.gmo sr at latin.gmo sv.gmo tr.gmo uk.gmo zh_CN.gmo zh_TW.gmo" || make ca.gmo cs.gmo da.gmo de.gmo el.gmo en_GB.gmo es.gmo fi.gmo fr.gmo hu.gmo it.gmo kk.gmo lt.gmo nb.gmo pl.gmo pt.gmo pt_BR.gmo ro.gmo ru.gmo sk.gmo sr.gmo sr at latin.gmo sv.gmo tr.gmo uk.gmo zh_CN.gmo zh_TW.gmo make[4]: Entering directory `/home/talespin/archlinux/pacman/lib/libalpm/po' : --update --lang=ca ca.po libalpm.pot rm -f ca.gmo && : -c --statistics --verbose -o ca.gmo ca.po mv: cannot stat `t-ca.gmo': No such file or directory make[4]: *** [ca.gmo] Error 1 make[4]: Leaving directory `/home/talespin/archlinux/pacman/lib/libalpm/po' make[3]: *** [stamp-po] Error 2 make[3]: Leaving directory `/home/talespin/archlinux/pacman/lib/libalpm/po' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/talespin/archlinux/pacman/lib/libalpm' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/talespin/archlinux/pacman' make: *** [all] Error 2 I have cloned the source from git://projects.archlinux.org/pacman.git and tried compiling with the commit e6f72c61a098b52ea29e54b8eb4739a2ff81e6b0 and its parents(until commit ae25167bcd592186749b79ea31b10fb78ed9fb2d) with no success. Any ideas. Br, Talespin From dpmcgee at gmail.com Tue Mar 27 14:21:42 2012 From: dpmcgee at gmail.com (Dan McGee) Date: Tue, 27 Mar 2012 13:21:42 -0500 Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> Message-ID: On Tue, Mar 27, 2012 at 12:55 PM, Talespin Kit wrote: > Hi, > > I have tried to do the Offline Installation as described in > the ArchLinux wiki, but it did not worked out as i have mentioned in the thread http://stackoverflow.com/posts/comments/12588344. Hence i have planned to compile the pacman in a machine which has > internet connection and then download the packages using the compiled > pacman binary and then transfer it to offline ArchLinux Machine. > While i tried to compile the pacman in Ubuntu-11.10 machine i got the following errors > $ make # after ./autogen.sh && ./configure > make ?all-recursive > make[1]: Entering directory `/home/talespin/archlinux/pacman' > Making all in lib/libalpm > make[2]: Entering directory `/home/talespin/archlinux/pacman/lib/libalpm' > Making all in po > make[3]: Entering directory `/home/talespin/archlinux/pacman/lib/libalpm/po' > test ! -f ./libalpm.pot || \ test -z "ca.gmo cs.gmo da.gmo de.gmo el.gmo en_GB.gmo es.gmo fi.gmo fr.gmo hu.gmo it.gmo kk.gmo lt.gmo nb.gmo pl.gmo pt.gmo pt_BR.gmo ro.gmo ru.gmo sk.gmo sr.gmo sr at latin.gmo sv.gmo tr.gmo uk.gmo zh_CN.gmo zh_TW.gmo" || make ca.gmo cs.gmo da.gmo de.gmo el.gmo en_GB.gmo es.gmo fi.gmo fr.gmo hu.gmo it.gmo kk.gmo lt.gmo nb.gmo pl.gmo pt.gmo pt_BR.gmo ro.gmo ru.gmo sk.gmo sr.gmo sr at latin.gmo sv.gmo tr.gmo uk.gmo zh_CN.gmo zh_TW.gmo > make[4]: Entering directory `/home/talespin/archlinux/pacman/lib/libalpm/po' > : --update ?--lang=ca ca.po libalpm.pot > rm -f ca.gmo && : -c --statistics --verbose -o ca.gmo ca.po > mv: cannot stat `t-ca.gmo': No such file or directory > make[4]: *** [ca.gmo] Error 1 > make[4]: Leaving directory `/home/talespin/archlinux/pacman/lib/libalpm/po' > make[3]: *** [stamp-po] Error 2 > make[3]: Leaving directory `/home/talespin/archlinux/pacman/lib/libalpm/po' > make[2]: *** [all-recursive] Error 1 > make[2]: Leaving directory `/home/talespin/archlinux/pacman/lib/libalpm' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/talespin/archlinux/pacman' > make: *** [all] Error 2 > I have cloned the source from git://projects.archlinux.org/pacman.git and tried compiling with the commit > e6f72c61a098b52ea29e54b8eb4739a2ff81e6b0 and its parents(until commit > ae25167bcd592186749b79ea31b10fb78ed9fb2d) with no success. > Any ideas. You probably need the gettext development package installed. You're going to have much better luck just transferring the pacman XZ zipped package to the machine and unzipping it directly in '/', then removing the /.PKGINFO and /.INSTALL file it will leave behind. -Dan From d at falconindy.com Tue Mar 27 23:11:42 2012 From: d at falconindy.com (Dave Reisner) Date: Tue, 27 Mar 2012 23:11:42 -0400 Subject: [pacman-dev] [PATCH] signing: cope with gpg2's failure at life Message-ID: <1332904302-31855-1-git-send-email-dreisner@archlinux.org> For key searches only, gpg2 will fail to lookup any and all keys that are not prefixed with 0x. Signed-off-by: Dave Reisner --- lib/libalpm/signing.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index 3ec957d..ef9f080 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -234,6 +234,8 @@ static int key_search(alpm_handle_t *handle, const char *fpr, gpgme_keylist_mode_t mode; gpgme_key_t key; int ret = -1; + size_t fpr_len; + char *full_fpr; memset(&ctx, 0, sizeof(ctx)); err = gpgme_new(&ctx); @@ -248,14 +250,21 @@ static int key_search(alpm_handle_t *handle, const char *fpr, _alpm_log(handle, ALPM_LOG_DEBUG, "looking up key %s remotely\n", fpr); - err = gpgme_get_key(ctx, fpr, &key, 0); + /* gpg2 goes full retard here. For key searches ONLY, we need to prefix the + * key fingerprint with 0x, or the lookup will fail. */ + fpr_len = strlen(fpr); + MALLOC(full_fpr, fpr_len + 3, RET_ERR(handle, ALPM_ERR_MEMORY, -1)); + sprintf(full_fpr, "0x%s", fpr); + + err = gpgme_get_key(ctx, full_fpr, &key, 0); + if(gpg_err_code(err) == GPG_ERR_EOF) { _alpm_log(handle, ALPM_LOG_DEBUG, "key lookup failed, unknown key\n"); /* Try an alternate lookup using the 8 character fingerprint value, since * busted-ass keyservers can't support lookups using subkeys with the full * value as of now. This is why 2012 is not the year of PGP encryption. */ - if(strlen(fpr) > 8) { - const char *short_fpr = fpr + strlen(fpr) - 8; + if(fpr_len - 2 > 8) { + const char *short_fpr = memcpy(&full_fpr[fpr_len - 8], "0x", 2); _alpm_log(handle, ALPM_LOG_DEBUG, "looking up key %s remotely\n", short_fpr); err = gpgme_get_key(ctx, short_fpr, &key, 0); @@ -268,6 +277,8 @@ static int key_search(alpm_handle_t *handle, const char *fpr, } } + free(full_fpr); + if(gpg_err_code(err) != GPG_ERR_NO_ERROR) { goto error; } -- 1.7.9.5 From talespin_kit at yahoo.com Wed Mar 28 03:02:06 2012 From: talespin_kit at yahoo.com (Talespin Kit) Date: Wed, 28 Mar 2012 00:02:06 -0700 (PDT) Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> Message-ID: <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> >You're going to have much better luck just transferring the pacman XZ >zipped package to the machine and unzipping it directly in '/', then >removing the /.PKGINFO and /.INSTALL file it will leave behind. I would like to modify the sources and understand the pacman code. so compiling the sources is a necessary. >You probably need the gettext development package installed. I have installed the gettext package version 0.8.1.1-3ubuntu1 and it compiles the files in the **pacman/lib/libalpm/po** directory. Thank you for the info. But the make file reports error in **pacman/src/util** directory. $ make make? all-recursive make[1]: Entering directory `/home/user/tmp/pacman' Making all in lib/libalpm make[2]: Entering directory `/home/user/tmp/pacman/lib/libalpm' Making all in po make[3]: Entering directory `/home/user/tmp/pacman/lib/libalpm/po' make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm/po' make[3]: Entering directory `/home/user/tmp/pacman/lib/libalpm' make[3]: Nothing to be done for `all-am'. make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' Making all in src/util make[2]: Entering directory `/home/user/tmp/pacman/src/util' ? CCLD?? testpkg ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' Seems like MD5 related library has to be installed. I do not know which one to install. I was expecting ./configure scritpt to report about these required libraries. Br, Talespin From jelle at vdwaa.nl Wed Mar 28 03:48:30 2012 From: jelle at vdwaa.nl (Jelle van der Waa) Date: Wed, 28 Mar 2012 09:48:30 +0200 Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> Message-ID: On Wed, Mar 28, 2012 at 9:02 AM, Talespin Kit wrote: > > > >You're going to have much better luck just transferring the pacman XZ > >zipped package to the machine and unzipping it directly in '/', then > >removing the /.PKGINFO and /.INSTALL file it will leave behind. > > I would like to modify the sources and understand the pacman code. so > compiling the sources is a necessary. > > > >You probably need the gettext development package installed. > > I have installed the gettext package version 0.8.1.1-3ubuntu1 and it > compiles the files in the **pacman/lib/libalpm/po** directory. > Thank you for the info. > > But the make file reports error in **pacman/src/util** directory. > > $ make > make all-recursive > make[1]: Entering directory `/home/user/tmp/pacman' > Making all in lib/libalpm > make[2]: Entering directory `/home/user/tmp/pacman/lib/libalpm' > Making all in po > make[3]: Entering directory `/home/user/tmp/pacman/lib/libalpm/po' > make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm/po' > make[3]: Entering directory `/home/user/tmp/pacman/lib/libalpm' > make[3]: Nothing to be done for `all-am'. > make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > Making all in src/util > make[2]: Entering directory `/home/user/tmp/pacman/src/util' > CCLD testpkg > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > > Seems like MD5 related library has to be installed. I do not know which > one to install. I was expecting ./configure scritpt to report about these > required libraries. > > Br, > Talespin > > sounds like you didn't google, since googling this issue shows me that people tried to include openssl.h. So the issue could be that you are missing openssl-dev. Take a look at pacman's dependencies with: pactree pacman -- Jelle van der Waa From talespin_kit at yahoo.com Wed Mar 28 06:10:20 2012 From: talespin_kit at yahoo.com (Talespin Kit) Date: Wed, 28 Mar 2012 03:10:20 -0700 (PDT) Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> Message-ID: <1332929420.88773.YahooMailNeo@web120906.mail.ne1.yahoo.com> > sounds like you didn't google, since googling this issue shows me that > people tried to include openssl.h. So the issue could be that you are > missing openssl-dev. Take a look at pacman's dependencies with: I initally thought that might be problem and looked at the ./configure output which reported (also libssl-dev is installed) ....... checking whether to link with libssl... yes checking for MD5_Final in -lssl... yes ...... Found library "gpgme" was missing. After installing it below is the following error from signing.c file make[3]: Entering directory `/home/user/tmp/pacman/lib/libalpm' ? CC???? signing.lo signing.c: In function 'key_search': signing.c:301:8: error: 'GPGME_PK_ECDSA' undeclared (first use in this function) signing.c:301:8: note: each undeclared identifier is reported only once for each function it appears in signing.c:302:8: error: 'GPGME_PK_ECDH' undeclared (first use in this function) make[3]: *** [signing.lo] Error 1 make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/user/tmp/pacman' make: *** [all] Error 2 From allan at archlinux.org Wed Mar 28 06:24:36 2012 From: allan at archlinux.org (Allan McRae) Date: Wed, 28 Mar 2012 20:24:36 +1000 Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: <1332929420.88773.YahooMailNeo@web120906.mail.ne1.yahoo.com> References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332929420.88773.YahooMailNeo@web120906.mail.ne1.yahoo.com> Message-ID: <4F72E6E4.7020208@archlinux.org> On 28/03/12 20:10, Talespin Kit wrote: >> sounds like you didn't google, since googling this issue shows me that > >> people tried to include openssl.h. So the issue could be that you are >> missing openssl-dev. Take a look at pacman's dependencies with: > > I initally thought that might be problem and looked at the ./configure > output which reported (also libssl-dev is installed) > ....... > checking whether to link with libssl... yes > checking for MD5_Final in -lssl... yes > ...... > > Found library "gpgme" was missing. After installing it below is the following error > from signing.c file > > make[3]: Entering directory `/home/user/tmp/pacman/lib/libalpm' > CC signing.lo > signing.c: In function 'key_search': > signing.c:301:8: error: 'GPGME_PK_ECDSA' undeclared (first use in this function) > signing.c:301:8: note: each undeclared identifier is reported only once for each function it appears in > signing.c:302:8: error: 'GPGME_PK_ECDH' undeclared (first use in this function) > make[3]: *** [signing.lo] Error 1 > make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > make[2]: *** [all-recursive] Error 1 > make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/user/tmp/pacman' > make: *** [all] Error 2 > That requires gpgme-1.3.0 which was released over two years ago... That is entirely unrelated to your issue with "undefined reference to `MD5_Init'". Attach your configure and build output if you want help with that. Allan From allan at archlinux.org Wed Mar 28 06:32:23 2012 From: allan at archlinux.org (Allan McRae) Date: Wed, 28 Mar 2012 20:32:23 +1000 Subject: [pacman-dev] [PATCH] Check minimum required gpgme version Message-ID: <1332930743-14034-1-git-send-email-allan@archlinux.org> We use interfaces first introduced in gpgme-1.3.0 so test we have at least that version. Signed-off-by: Allan McRae --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b44e8ba..0fe3287 100644 --- a/configure.ac +++ b/configure.ac @@ -179,7 +179,7 @@ require_gpgme=no AS_IF([test "x$with_gpgme" != "xno"], [AS_IF([test "x$with_gpgme" = "xyes"], [require_gpgme=yes]) - AM_PATH_GPGME([], + AM_PATH_GPGME([1.3.0], [LIBS_save="$LIBS" CPPFLAGS_save="$CPPFLAGS" CFLAGS_save="$CFLAGS" -- 1.7.9.5 From talespin_kit at yahoo.com Wed Mar 28 07:04:33 2012 From: talespin_kit at yahoo.com (Talespin Kit) Date: Wed, 28 Mar 2012 04:04:33 -0700 (PDT) Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: <4F72E6E4.7020208@archlinux.org> References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332929420.88773.YahooMailNeo@web120906.mail.ne1.yahoo.com> <4F72E6E4.7020208@archlinux.org> Message-ID: <1332932673.64183.YahooMailNeo@web120902.mail.ne1.yahoo.com> Below is the output of ./configure script. $ ./autogen.sh && ./configure + aclocal -I m4 --install + autoheader + automake --foreign + autoconf checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for style of include used by make... GNU checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking dependency style of gcc... gcc3 checking for gawk... (cached) gawk checking for curl-config... /usr/bin/curl-config checking for the version of libcurl... 7.21.6 checking for libcurl >= version 7.19.4... yes checking whether libcurl is usable... yes checking for curl_free... yes checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking for gawk... (cached) gawk checking for gcc option to accept ISO C99... -std=gnu99 checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking dependency style of g++... gcc3 checking whether ln -s works... yes checking whether make sets $(MAKE)... (cached) yes checking how to print strings... printf checking for a sed that does not truncate output... /bin/sed checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for fgrep... /bin/grep -F checking for ld used by gcc -std=gnu99... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking the maximum length of command line arguments... 1572864 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking how to convert i686-pc-linux-gnu file names to i686-pc-linux-gnu format... func_convert_file_noop checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop checking for /usr/bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc -std=gnu99 object... ok checking for sysroot... no checking for mt... mt checking if mt is a manifest tool... no checking how to run the C preprocessor... gcc -std=gnu99 -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc -std=gnu99 supports -fno-rtti -fno-exceptions... no checking for gcc -std=gnu99 option to produce PIC... -fPIC -DPIC checking if gcc -std=gnu99 PIC flag -fPIC -DPIC works... yes checking if gcc -std=gnu99 static flag -static works... yes checking if gcc -std=gnu99 supports -c -o file.o... yes checking if gcc -std=gnu99 supports -c -o file.o... (cached) yes checking whether the gcc -std=gnu99 linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC -DPIC checking if g++ PIC flag -fPIC -DPIC works... yes checking if g++ static flag -static works... yes checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for ranlib... (cached) ranlib checking for python2.7... python2.7 checking for bash... /bin/bash checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... /usr/bin/xgettext checking for msgmerge... /usr/bin/msgmerge checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking for CFPreferencesCopyAppValue... no checking for CFLocaleCopyCurrent... no checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking for fabs in -lm... yes checking for archive_read_data in -larchive... yes checking whether to link with libssl... yes checking for MD5_Final in -lssl... yes checking whether to link with libgpgme... yes checking for gpgme-config... /usr/bin/gpgme-config checking for GPGME - version >= 0.4.2... yes checking for sane gpgme... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking float.h usability... yes checking float.h presence... yes checking for float.h... yes checking glob.h usability... yes checking glob.h presence... yes checking for glob.h... yes checking libintl.h usability... yes checking libintl.h presence... yes checking for libintl.h... yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking mntent.h usability... yes checking mntent.h presence... yes checking for mntent.h... yes checking netinet/in.h usability... yes checking netinet/in.h presence... yes checking for netinet/in.h... yes checking netinet/tcp.h usability... yes checking netinet/tcp.h presence... yes checking for netinet/tcp.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking for string.h... (cached) yes checking sys/ioctl.h usability... yes checking sys/ioctl.h presence... yes checking for sys/ioctl.h... yes checking sys/mnttab.h usability... no checking sys/mnttab.h presence... no checking for sys/mnttab.h... no checking sys/mount.h usability... yes checking sys/mount.h presence... yes checking for sys/mount.h... yes checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking sys/statvfs.h usability... yes checking sys/statvfs.h presence... yes checking for sys/statvfs.h... yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for sys/types.h... (cached) yes checking sys/ucred.h usability... no checking sys/ucred.h presence... no checking for sys/ucred.h... no checking syslog.h usability... yes checking syslog.h presence... yes checking for syslog.h... yes checking termios.h usability... yes checking termios.h presence... yes checking for termios.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for inline... inline checking for int64_t... yes checking for mode_t... yes checking for off_t... yes checking for pid_t... yes checking for size_t... yes checking for ssize_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for uid_t in sys/types.h... yes checking for dirent.h that defines DIR... yes checking for library containing opendir... none required checking for struct dirent.d_type... yes checking PATH_MAX defined... yes checking vfork.h usability... no checking vfork.h presence... no checking for vfork.h... no checking for fork... yes checking for vfork... yes checking for working fork... yes checking for working vfork... (cached) yes checking for library containing getmntent... none required checking whether lstat correctly handles trailing slash... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking whether time.h and sys/time.h may both be included... yes checking for sys/time.h... (cached) yes checking for unistd.h... (cached) yes checking for alarm... yes checking for working mktime... yes checking for working strcoll... yes checking for dup2... yes checking for getcwd... yes checking for geteuid... yes checking for getmntinfo... no checking for gettimeofday... yes checking for memmove... yes checking for memset... yes checking for mkdir... yes checking for realpath... yes checking for regcomp... yes checking for rmdir... yes checking for setenv... yes checking for setlocale... yes checking for strcasecmp... yes checking for strchr... yes checking for strcspn... yes checking for strdup... yes checking for strerror... yes checking for strndup... yes checking for strrchr... yes checking for strsep... yes checking for strstr... yes checking for strtol... yes checking for swprintf... yes checking for tcflush... yes checking for wcwidth... yes checking for uname... yes checking for struct stat.st_blksize... yes checking filesystem statistics type... checking for getmntinfo... (cached) no checking for getmntent... (cached) yes struct statvfs checking for struct statvfs.f_flag... yes checking for struct statfs.f_flags... no checking whether gcc -std=gnu99 accepts -fvisibility=internal... yes checking for -fgnu89-inline... yes checking for asciidoc... asciidoc checking for building documentation... yes, enabled by configure checking for doxygen... no checking for doxygen... no, disabled by configure checking for debug mode request... no checking whether to use git version if available... no, disabled by configure configure: creating ./config.status config.status: creating lib/libalpm/Makefile config.status: creating lib/libalpm/po/Makefile.in config.status: creating src/pacman/Makefile config.status: creating src/pacman/po/Makefile.in config.status: creating src/util/Makefile config.status: creating scripts/Makefile config.status: creating scripts/po/Makefile.in config.status: creating doc/Makefile config.status: creating etc/Makefile config.status: creating test/pacman/Makefile config.status: creating test/pacman/tests/Makefile config.status: creating test/util/Makefile config.status: creating contrib/Makefile config.status: creating Makefile config.status: creating config.h config.status: executing depfiles commands config.status: executing libtool commands config.status: executing po-directories commands config.status: creating lib/libalpm/po/POTFILES config.status: creating lib/libalpm/po/Makefile config.status: creating src/pacman/po/POTFILES config.status: creating src/pacman/po/Makefile config.status: creating scripts/po/POTFILES config.status: creating scripts/po/Makefile pacman: ? Build information: ??? source code location?? : . ??? prefix???????????????? : /usr/local ??? sysconfdir???????????? : /usr/local/etc ?????? conf file?????????? : /usr/local/etc/pacman.conf ??? localstatedir????????? : /usr/local/var ?????? database dir??????? : /usr/local/var/lib/pacman/ ?????? cache dir?????????? : /usr/local/var/cache/pacman/pkg/ ??? compiler?????????????? : gcc -std=gnu99 ??? preprocessor flags???? :? ??? compiler flags???????? : -g -O2? -Wall ??? defines??????????????? : -DHAVE_CONFIG_H ??? library flags????????? : -lssl -larchive -lm? -lgpgme -L/usr/lib/i386-linux-gnu -lgpg-error ??? linker flags?????????? : ??? Architecture?????????? : i686 ??? Host Type????????????? : i686-pc-linux-gnu ??? Filesize command?????? : stat -c %s ??? In-place sed command?? : sed -i ??? libalpm version??????? : 7.0.2 ??? libalpm version info?? : 7:2:0 ??? pacman version???????? : 4.0.2 ??? using git version????? : no ? Directory and file information: ??? root working directory : / ??? package extension????? : .pkg.tar.gz ??? source pkg extension?? : .src.tar.gz ??? build script name????? : PKGBUILD ? Compilation options: ??? Use libcurl??????????? : yes ??? Use GPGME????????????? : yes ??? Use OpenSSL??????????? : yes ??? Run make in doc/ dir?? : yes ??? Doxygen support??????? : no ??? debug support????????? : no ________________________________ From: Allan McRae To: Talespin Kit ; Discussion list for pacman development Sent: Wednesday, March 28, 2012 3:54 PM Subject: Re: [pacman-dev] Unable to compile pacman in ubuntu-11.10 On 28/03/12 20:10, Talespin Kit wrote: >> sounds like you didn't google, since googling this issue shows me that > >> people tried to include openssl.h. So the issue could be that you are >> missing openssl-dev. Take a look at pacman's dependencies with: > > I initally thought that might be problem and looked at the ./configure > output which reported (also libssl-dev is installed) > ....... > checking whether to link with libssl... yes > checking for MD5_Final in -lssl... yes > ...... > > Found library "gpgme" was missing. After installing it below is the following error > from signing.c file > > make[3]: Entering directory `/home/user/tmp/pacman/lib/libalpm' >? CC? ? signing.lo > signing.c: In function 'key_search': > signing.c:301:8: error: 'GPGME_PK_ECDSA' undeclared (first use in this function) > signing.c:301:8: note: each undeclared identifier is reported only once for each function it appears in > signing.c:302:8: error: 'GPGME_PK_ECDH' undeclared (first use in this function) > make[3]: *** [signing.lo] Error 1 > make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > make[2]: *** [all-recursive] Error 1 > make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/user/tmp/pacman' > make: *** [all] Error 2 > That requires gpgme-1.3.0 which was released over two years ago... That is entirely unrelated to your issue with "undefined reference to `MD5_Init'".? Attach your configure and build output if you want help with that. Allan From dpmcgee at gmail.com Wed Mar 28 19:10:32 2012 From: dpmcgee at gmail.com (Dan McGee) Date: Wed, 28 Mar 2012 18:10:32 -0500 Subject: [pacman-dev] [translation] pacman 4.0.3 string freeze Message-ID: Only very minor updates, very few strings have changed. More info: http://www.archlinux.org/pacman/translation-help.html Transifex page: https://www.transifex.net/projects/p/archlinux-pacman/r/4-0-3/ Due by: 2012-04-02 Thanks! -Dan From talespin_kit at yahoo.com Thu Mar 29 07:42:04 2012 From: talespin_kit at yahoo.com (Talespin Kit) Date: Thu, 29 Mar 2012 04:42:04 -0700 (PDT) Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: <1332932673.64183.YahooMailNeo@web120902.mail.ne1.yahoo.com> References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332929420.88773.YahooMailNeo@web120906.mail.ne1.yahoo.com> <4F72E6E4.7020208@archlinux.org> <1332932673.64183.YahooMailNeo@web120902.mail.ne1.yahoo.com> Message-ID: <1333021324.85598.YahooMailNeo@web120904.mail.ne1.yahoo.com> Some improvement over the build by providing --without-gpgme arg to ./configure script . The complete steps is mentioned below $ git clean -xfd; ./autogen.sh && ./configure --without-gpgme && make .......... make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' Making all in src/util make[2]: Entering directory `/home/user/tmp/pacman/src/util' ? CC???? vercmp.o ? CCLD?? vercmp ? CC???? testpkg.o ? CCLD?? testpkg ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' The actual command executed while tryint to linking is found by running dry make (make -n ) cd pacman/src/util $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' collect2: ld returned 1 exit status Now finding which library contains **MD5_Init** symbol using the below bash commands for i in `find /usr/lib -type f -name '*.so.*'`; do ???? nm -D $i | grep MD5_Init; ???? if [ $? -eq 0 ]; ???? then ????????? echo $i; ???? fi; done Output:- ====== 00004320 T MD5_Init /usr/lib/i386-linux-gnu/libgnutls-openssl.so.26.16.14 Now linking with the libgnutls-openssl library $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm -lgnutls-openssl ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' collect2: ld returned 1 exit status Only MD5_* symbols are able to find by ld. Problem with SHA256_* symbols. Finding the **SHA256_Init** symbol using the above bash commands outputs. 00187db0 T SHA256_Init /usr/lib/libgs.so.9.04 Trying to link with the libgs.so.9.04 library gives the following error. $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm -lgnutls-openssl -lgs /usr/bin/ld: cannot find -lgs collect2: ld returned 1 exit status No idea why the linker fails to find the libgs library. ________________________________ From: Talespin Kit To: Allan McRae ; Discussion list for pacman development Sent: Wednesday, March 28, 2012 4:34 PM Subject: Re: [pacman-dev] Unable to compile pacman in ubuntu-11.10 Below is the output of ./configure script. $ ./autogen.sh && ./configure + aclocal -I m4 --install + autoheader + automake --foreign + autoconf checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for style of include used by make... GNU checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking dependency style of gcc... gcc3 checking for gawk... (cached) gawk checking for curl-config... /usr/bin/curl-config checking for the version of libcurl... 7.21.6 checking for libcurl >= version 7.19.4... yes checking whether libcurl is usable... yes checking for curl_free... yes checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking for gawk... (cached) gawk checking for gcc option to accept ISO C99... -std=gnu99 checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking dependency style of g++... gcc3 checking whether ln -s works... yes checking whether make sets $(MAKE)... (cached) yes checking how to print strings... printf checking for a sed that does not truncate output... /bin/sed checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for fgrep... /bin/grep -F checking for ld used by gcc -std=gnu99... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking the maximum length of command line arguments... 1572864 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking how to convert i686-pc-linux-gnu file names to i686-pc-linux-gnu format... func_convert_file_noop checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop checking for /usr/bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc -std=gnu99 object... ok checking for sysroot... no checking for mt... mt checking if mt is a manifest tool... no checking how to run the C preprocessor... gcc -std=gnu99 -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc -std=gnu99 supports -fno-rtti -fno-exceptions... no checking for gcc -std=gnu99 option to produce PIC... -fPIC -DPIC checking if gcc -std=gnu99 PIC flag -fPIC -DPIC works... yes checking if gcc -std=gnu99 static flag -static works... yes checking if gcc -std=gnu99 supports -c -o file.o... yes checking if gcc -std=gnu99 supports -c -o file.o... (cached) yes checking whether the gcc -std=gnu99 linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC -DPIC checking if g++ PIC flag -fPIC -DPIC works... yes checking if g++ static flag -static works... yes checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for ranlib... (cached) ranlib checking for python2.7... python2.7 checking for bash... /bin/bash checking whether NLS is requested... yes checking for msgfmt... /usr/bin/msgfmt checking for gmsgfmt... /usr/bin/msgfmt checking for xgettext... /usr/bin/xgettext checking for msgmerge... /usr/bin/msgmerge checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for shared library run path origin... done checking for CFPreferencesCopyAppValue... no checking for CFLocaleCopyCurrent... no checking for GNU gettext in libc... yes checking whether to use NLS... yes checking where the gettext function comes from... libc checking for fabs in -lm... yes checking for archive_read_data in -larchive... yes checking whether to link with libssl... yes checking for MD5_Final in -lssl... yes checking whether to link with libgpgme... yes checking for gpgme-config... /usr/bin/gpgme-config checking for GPGME - version >= 0.4.2... yes checking for sane gpgme... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking float.h usability... yes checking float.h presence... yes checking for float.h... yes checking glob.h usability... yes checking glob.h presence... yes checking for glob.h... yes checking libintl.h usability... yes checking libintl.h presence... yes checking for libintl.h... yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking locale.h usability... yes checking locale.h presence... yes checking for locale.h... yes checking mntent.h usability... yes checking mntent.h presence... yes checking for mntent.h... yes checking netinet/in.h usability... yes checking netinet/in.h presence... yes checking for netinet/in.h... yes checking netinet/tcp.h usability... yes checking netinet/tcp.h presence... yes checking for netinet/tcp.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking for string.h... (cached) yes checking sys/ioctl.h usability... yes checking sys/ioctl.h presence... yes checking for sys/ioctl.h... yes checking sys/mnttab.h usability... no checking sys/mnttab.h presence... no checking for sys/mnttab.h... no checking sys/mount.h usability... yes checking sys/mount.h presence... yes checking for sys/mount.h... yes checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking sys/statvfs.h usability... yes checking sys/statvfs.h presence... yes checking for sys/statvfs.h... yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for sys/types.h... (cached) yes checking sys/ucred.h usability... no checking sys/ucred.h presence... no checking for sys/ucred.h... no checking syslog.h usability... yes checking syslog.h presence... yes checking for syslog.h... yes checking termios.h usability... yes checking termios.h presence... yes checking for termios.h... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for inline... inline checking for int64_t... yes checking for mode_t... yes checking for off_t... yes checking for pid_t... yes checking for size_t... yes checking for ssize_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for uid_t in sys/types.h... yes checking for dirent.h that defines DIR... yes checking for library containing opendir... none required checking for struct dirent.d_type... yes checking PATH_MAX defined... yes checking vfork.h usability... no checking vfork.h presence... no checking for vfork.h... no checking for fork... yes checking for vfork... yes checking for working fork... yes checking for working vfork... (cached) yes checking for library containing getmntent... none required checking whether lstat correctly handles trailing slash... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking whether time.h and sys/time.h may both be included... yes checking for sys/time.h... (cached) yes checking for unistd.h... (cached) yes checking for alarm... yes checking for working mktime... yes checking for working strcoll... yes checking for dup2... yes checking for getcwd... yes checking for geteuid... yes checking for getmntinfo... no checking for gettimeofday... yes checking for memmove... yes checking for memset... yes checking for mkdir... yes checking for realpath... yes checking for regcomp... yes checking for rmdir... yes checking for setenv... yes checking for setlocale... yes checking for strcasecmp... yes checking for strchr... yes checking for strcspn... yes checking for strdup... yes checking for strerror... yes checking for strndup... yes checking for strrchr... yes checking for strsep... yes checking for strstr... yes checking for strtol... yes checking for swprintf... yes checking for tcflush... yes checking for wcwidth... yes checking for uname... yes checking for struct stat.st_blksize... yes checking filesystem statistics type... checking for getmntinfo... (cached) no checking for getmntent... (cached) yes struct statvfs checking for struct statvfs.f_flag... yes checking for struct statfs.f_flags... no checking whether gcc -std=gnu99 accepts -fvisibility=internal... yes checking for -fgnu89-inline... yes checking for asciidoc... asciidoc checking for building documentation... yes, enabled by configure checking for doxygen... no checking for doxygen... no, disabled by configure checking for debug mode request... no checking whether to use git version if available... no, disabled by configure configure: creating ./config.status config.status: creating lib/libalpm/Makefile config.status: creating lib/libalpm/po/Makefile.in config.status: creating src/pacman/Makefile config.status: creating src/pacman/po/Makefile.in config.status: creating src/util/Makefile config.status: creating scripts/Makefile config.status: creating scripts/po/Makefile.in config.status: creating doc/Makefile config.status: creating etc/Makefile config.status: creating test/pacman/Makefile config.status: creating test/pacman/tests/Makefile config.status: creating test/util/Makefile config.status: creating contrib/Makefile config.status: creating Makefile config.status: creating config.h config.status: executing depfiles commands config.status: executing libtool commands config.status: executing po-directories commands config.status: creating lib/libalpm/po/POTFILES config.status: creating lib/libalpm/po/Makefile config.status: creating src/pacman/po/POTFILES config.status: creating src/pacman/po/Makefile config.status: creating scripts/po/POTFILES config.status: creating scripts/po/Makefile pacman: ? Build information: ??? source code location?? : . ??? prefix???????????????? : /usr/local ??? sysconfdir???????????? : /usr/local/etc ?????? conf file?????????? : /usr/local/etc/pacman.conf ??? localstatedir????????? : /usr/local/var ?????? database dir??????? : /usr/local/var/lib/pacman/ ?????? cache dir?????????? : /usr/local/var/cache/pacman/pkg/ ??? compiler?????????????? : gcc -std=gnu99 ??? preprocessor flags???? :? ??? compiler flags???????? : -g -O2? -Wall ??? defines??????????????? : -DHAVE_CONFIG_H ??? library flags????????? : -lssl -larchive -lm? -lgpgme -L/usr/lib/i386-linux-gnu -lgpg-error ??? linker flags?????????? : ??? Architecture?????????? : i686 ??? Host Type????????????? : i686-pc-linux-gnu ??? Filesize command?????? : stat -c %s ??? In-place sed command?? : sed -i ??? libalpm version??????? : 7.0.2 ??? libalpm version info?? : 7:2:0 ??? pacman version???????? : 4.0.2 ??? using git version????? : no ? Directory and file information: ??? root working directory : / ??? package extension????? : .pkg.tar.gz ??? source pkg extension?? : .src.tar.gz ??? build script name????? : PKGBUILD ? Compilation options: ??? Use libcurl??????????? : yes ??? Use GPGME????????????? : yes ??? Use OpenSSL??????????? : yes ??? Run make in doc/ dir?? : yes ??? Doxygen support??????? : no ??? debug support????????? : no ________________________________ From: Allan McRae To: Talespin Kit ; Discussion list for pacman development Sent: Wednesday, March 28, 2012 3:54 PM Subject: Re: [pacman-dev] Unable to compile pacman in ubuntu-11.10 On 28/03/12 20:10, Talespin Kit wrote: >> sounds like you didn't google, since googling this issue shows me that > >> people tried to include openssl.h. So the issue could be that you are >> missing openssl-dev. Take a look at pacman's dependencies with: > > I initally thought that might be problem and looked at the ./configure > output which reported (also libssl-dev is installed) > ....... > checking whether to link with libssl... yes > checking for MD5_Final in -lssl... yes > ...... > > Found library "gpgme" was missing. After installing it below is the following error > from signing.c file > > make[3]: Entering directory `/home/user/tmp/pacman/lib/libalpm' >?? CC? ?? signing.lo > signing.c: In function 'key_search': > signing.c:301:8: error: 'GPGME_PK_ECDSA' undeclared (first use in this function) > signing.c:301:8: note: each undeclared identifier is reported only once for each function it appears in > signing.c:302:8: error: 'GPGME_PK_ECDH' undeclared (first use in this function) > make[3]: *** [signing.lo] Error 1 > make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > make[2]: *** [all-recursive] Error 1 > make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/user/tmp/pacman' > make: *** [all] Error 2 > That requires gpgme-1.3.0 which was released over two years ago... That is entirely unrelated to your issue with "undefined reference to `MD5_Init'".?? Attach your configure and build output if you want help with that. Allan From d at falconindy.com Thu Mar 29 08:17:51 2012 From: d at falconindy.com (Dave Reisner) Date: Thu, 29 Mar 2012 08:17:51 -0400 Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: <1333021324.85598.YahooMailNeo@web120904.mail.ne1.yahoo.com> References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332929420.88773.YahooMailNeo@web120906.mail.ne1.yahoo.com> <4F72E6E4.7020208@archlinux.org> <1332932673.64183.YahooMailNeo@web120902.mail.ne1.yahoo.com> <1333021324.85598.YahooMailNeo@web120904.mail.ne1.yahoo.com> Message-ID: <20120329121751.GF27963@rampage> On Thu, Mar 29, 2012 at 04:42:04AM -0700, Talespin Kit wrote: > Some improvement over the build by providing --without-gpgme arg to > ./configure script . > > The complete steps is mentioned below > > > $ git clean -xfd; ./autogen.sh && ./configure --without-gpgme && make > > .......... > make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > Making all in src/util > make[2]: Entering directory `/home/user/tmp/pacman/src/util' > ? CC???? vercmp.o > ? CCLD?? vercmp > ? CC???? testpkg.o > ? CCLD?? testpkg > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > > > The actual command executed while tryint to linking is found by running dry make (make -n ) > > cd pacman/src/util > > $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > collect2: ld returned 1 exit status > > > Now finding which library contains **MD5_Init** symbol using the below > > bash commands > > for i in `find /usr/lib -type f -name '*.so.*'`; > do > ???? nm -D $i | grep MD5_Init; > ???? if [ $? -eq 0 ]; > > ???? then > > ????????? echo $i; > ???? fi; > done > > > Output:- > > ====== > 00004320 T MD5_Init > /usr/lib/i386-linux-gnu/libgnutls-openssl.so.26.16.14 No, that's the wrong library -- we link against openssl's libcrypto. Is libssl-dev installed? NB: I've yet to be able to build pacman successfully against anything involving gnutls, and i've even had build failures when libarchive linked to gnutls (though that may have been resolved by binutils 2.22). > > Now linking with the libgnutls-openssl library > > > $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm -lgnutls-openssl > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > collect2: ld returned 1 exit status > > > Only MD5_* symbols are able to find by ld. > > Problem with SHA256_* symbols. Finding the **SHA256_Init** symbol > using the above bash commands outputs. > > 00187db0 T SHA256_Init > /usr/lib/libgs.so.9.04 This is ghostscript... I assure you we don't link against this. It should all be covered by openssl. > > Trying to link with the libgs.so.9.04 library gives the following error. > > > $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm -lgnutls-openssl -lgs > /usr/bin/ld: cannot find -lgs > collect2: ld returned 1 exit status > > > No idea why the linker fails to find the libgs library. > From d at falconindy.com Thu Mar 29 08:46:45 2012 From: d at falconindy.com (Dave Reisner) Date: Thu, 29 Mar 2012 08:46:45 -0400 Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: <20120329121751.GF27963@rampage> References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332929420.88773.YahooMailNeo@web120906.mail.ne1.yahoo.com> <4F72E6E4.7020208@archlinux.org> <1332932673.64183.YahooMailNeo@web120902.mail.ne1.yahoo.com> <1333021324.85598.YahooMailNeo@web120904.mail.ne1.yahoo.com> <20120329121751.GF27963@rampage> Message-ID: <20120329124645.GG27963@rampage> On Thu, Mar 29, 2012 at 08:17:51AM -0400, Dave Reisner wrote: > On Thu, Mar 29, 2012 at 04:42:04AM -0700, Talespin Kit wrote: > > Some improvement over the build by providing --without-gpgme arg to > > ./configure script . > > > > The complete steps is mentioned below > > > > > > $ git clean -xfd; ./autogen.sh && ./configure --without-gpgme && make > > > > .......... > > make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > > make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > > Making all in src/util > > make[2]: Entering directory `/home/user/tmp/pacman/src/util' > > ? CC???? vercmp.o > > ? CCLD?? vercmp > > ? CC???? testpkg.o > > ? CCLD?? testpkg > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > > > > > > The actual command executed while tryint to linking is found by running dry make (make -n ) > > > > cd pacman/src/util > > > > $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > > collect2: ld returned 1 exit status > > > > > > Now finding which library contains **MD5_Init** symbol using the below > > > > bash commands > > > > for i in `find /usr/lib -type f -name '*.so.*'`; > > do > > ???? nm -D $i | grep MD5_Init; > > ???? if [ $? -eq 0 ]; > > > > ???? then > > > > ????????? echo $i; > > ???? fi; > > done > > > > > > Output:- > > > > ====== > > 00004320 T MD5_Init > > /usr/lib/i386-linux-gnu/libgnutls-openssl.so.26.16.14 > > No, that's the wrong library -- we link against openssl's libcrypto. > Is libssl-dev installed? > > NB: I've yet to be able to build pacman successfully against anything > involving gnutls, and i've even had build failures when libarchive > linked to gnutls (though that may have been resolved by binutils 2.22). > > > > > Now linking with the libgnutls-openssl library > > > > > > $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm -lgnutls-openssl > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > > collect2: ld returned 1 exit status > > > > > > Only MD5_* symbols are able to find by ld. > > > > Problem with SHA256_* symbols. Finding the **SHA256_Init** symbol > > using the above bash commands outputs. > > > > 00187db0 T SHA256_Init > > /usr/lib/libgs.so.9.04 > > This is ghostscript... I assure you we don't link against this. It > should all be covered by openssl. > > > > > Trying to link with the libgs.so.9.04 library gives the following error. > > > > > > $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm -lgnutls-openssl -lgs > > /usr/bin/ld: cannot find -lgs > > collect2: ld returned 1 exit status > > > > > > No idea why the linker fails to find the libgs library. > > Ok, so I just compiled this on a 10.04 install... $ ./configure --prefix=/usr --sysconfdir=/etc \ --localstatedir=/var --enable-git-version \ --enable-debug --without-gpgme readelf shows the following linkages: $ readelf -d ./lib/libalpm/.libs/libalpm.so Dynamic section at offset 0x29d58 contains 27 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libcurl-gnutls.so.4] 0x0000000000000001 (NEEDED) Shared library: [libssl.so.0.9.8] 0x0000000000000001 (NEEDED) Shared library: [libarchive.so.2] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000e (SONAME) Library soname: [libalpm.so.7] ... $ readelf -d ./src/pacman/.libs/pacman Dynamic section at offset 0x18de0 contains 27 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libalpm.so.7] 0x0000000000000001 (NEEDED) Shared library: [libcurl-gnutls.so.4] 0x0000000000000001 (NEEDED) Shared library: [libssl.so.0.9.8] 0x0000000000000001 (NEEDED) Shared library: [libarchive.so.2] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] ... dave From talespin_kit at yahoo.com Fri Mar 30 08:12:11 2012 From: talespin_kit at yahoo.com (Talespin Kit) Date: Fri, 30 Mar 2012 05:12:11 -0700 (PDT) Subject: [pacman-dev] Unable to compile pacman in ubuntu-11.10 In-Reply-To: <20120329124645.GG27963@rampage> References: <1332870920.65269.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332918126.81910.YahooMailNeo@web120904.mail.ne1.yahoo.com> <1332929420.88773.YahooMailNeo@web120906.mail.ne1.yahoo.com> <4F72E6E4.7020208@archlinux.org> <1332932673.64183.YahooMailNeo@web120902.mail.ne1.yahoo.com> <1333021324.85598.YahooMailNeo@web120904.mail.ne1.yahoo.com> <20120329121751.GF27963@rampage> <20120329124645.GG27963@rampage> Message-ID: <1333109531.16209.YahooMailNeo@web120905.mail.ne1.yahoo.com> Finally managed to compile in ubuntu-11.10. Seems the problem was the Makefile generated by the configure script for the **libalpm** does not add the? **libcrypto** as dependency in the LIBS variable. Below is the steps. I have used the git commit e6f72c61a098b52ea29e54b8eb4739a2ff81e6b0in repo git://projects.archlinux.org/pacman.git 1) $ git clean -xfd; ./autogen.sh && ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ --enable-git-version --enable-debug --without-gpgme 2) cd lib/libalpm 3) In the Makefile replace line LIBS = -lssl -larchive -lm with LIBS = -lssl -larchive -lm -lcrypto 4) cd ../../ && make ------ TalespinKit ________________________________ From: Dave Reisner To: Talespin Kit ; Discussion list for pacman development Sent: Thursday, March 29, 2012 6:16 PM Subject: Re: [pacman-dev] Unable to compile pacman in ubuntu-11.10 On Thu, Mar 29, 2012 at 08:17:51AM -0400, Dave Reisner wrote: > On Thu, Mar 29, 2012 at 04:42:04AM -0700, Talespin Kit wrote: > > Some improvement over the build by providing --without-gpgme arg to > > ./configure script . > > > > The complete steps is mentioned below > > > > > > $ git clean -xfd; ./autogen.sh && ./configure --without-gpgme && make > > > > .......... > > make[3]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > > make[2]: Leaving directory `/home/user/tmp/pacman/lib/libalpm' > > Making all in src/util > > make[2]: Entering directory `/home/user/tmp/pacman/src/util' > > ? CC???? vercmp.o > > ? CCLD?? vercmp > > ? CC???? testpkg.o > > ? CCLD?? testpkg > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > > > > > > The actual command executed while tryint to linking is found by running dry make (make -n ) > > > > cd pacman/src/util > > > > $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Final' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `MD5_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > > collect2: ld returned 1 exit status > > > > > > Now finding which library contains **MD5_Init** symbol using the below > > > > bash commands > > > > for i in `find /usr/lib -type f -name '*.so.*'`; > > do > > ???? nm -D $i | grep MD5_Init; > > ???? if [ $? -eq 0 ]; > > > > ???? then > > > > ????????? echo $i; > > ???? fi; > > done > > > > > > Output:- > > > > ====== > > 00004320 T MD5_Init > > /usr/lib/i386-linux-gnu/libgnutls-openssl.so.26.16.14 > > No, that's the wrong library -- we link against openssl's libcrypto. > Is libssl-dev installed? > > NB: I've yet to be able to build pacman successfully against anything > involving gnutls, and i've even had build failures when libarchive > linked to gnutls (though that may have been resolved by binutils 2.22). > > > > > Now linking with the libgnutls-openssl library > > > > > > $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm -lgnutls-openssl > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Init' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Update' > > ../../lib/libalpm/.libs/libalpm.so: undefined reference to `SHA256_Final' > > collect2: ld returned 1 exit status > > > > > > Only MD5_* symbols are able to find by ld. > > > > Problem with SHA256_* symbols. Finding the **SHA256_Init** symbol > > using the above bash commands outputs. > > > > 00187db0 T SHA256_Init > > /usr/lib/libgs.so.9.04 > > This is ghostscript... I assure you we don't link against this. It > should all be covered by openssl. > > > > > Trying to link with the libgs.so.9.04 library gives the following error. > > > > > > $ /bin/bash ../../libtool --silent --tag=CC?? --mode=link gcc -std=gnu99 -pedantic -D_GNU_SOURCE -g -O2 -Wall?? -o testpkg testpkg.o ../../lib/libalpm/.libs/libalpm.la -lssl -larchive -lm -lgnutls-openssl -lgs > > /usr/bin/ld: cannot find -lgs > > collect2: ld returned 1 exit status > > > > > > No idea why the linker fails to find the libgs library. > > Ok, so I just compiled this on a 10.04 install... $ ./configure --prefix=/usr --sysconfdir=/etc \ ? ? ? ? ? ? ? --localstatedir=/var --enable-git-version \ ? ? ? ? ? ? ? --enable-debug --without-gpgme readelf shows the following linkages: $ readelf -d ./lib/libalpm/.libs/libalpm.so Dynamic section at offset 0x29d58 contains 27 entries: ? Tag? ? ? ? Type? ? ? ? ? ? ? ? ? ? ? ? Name/Value 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libcurl-gnutls.so.4] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libssl.so.0.9.8] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libarchive.so.2] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libm.so.6] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libc.so.6] 0x000000000000000e (SONAME)? ? ? ? ? ? Library soname: [libalpm.so.7] ... $ readelf -d ./src/pacman/.libs/pacman Dynamic section at offset 0x18de0 contains 27 entries: ? Tag? ? ? ? Type? ? ? ? ? ? ? ? ? ? ? ? Name/Value 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libalpm.so.7] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libcurl-gnutls.so.4] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libssl.so.0.9.8] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libarchive.so.2] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libm.so.6] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED)? ? ? ? ? ? Shared library: [libc.so.6] ... dave From d at falconindy.com Fri Mar 30 14:45:13 2012 From: d at falconindy.com (Dave Reisner) Date: Fri, 30 Mar 2012 14:45:13 -0400 Subject: [pacman-dev] Fwd: Re: Unable to compile pacman in ubuntu-11.10 Message-ID: <20120330184513.GJ27963@rampage> ----- Forwarded message from Dave Reisner ----- > Date: Fri, 30 Mar 2012 14:44:05 -0400 > From: Dave Reisner > To: Talespin Kit > Subject: Re: [pacman-dev] Unable to compile pacman in ubuntu-11.10 > > On Fri, Mar 30, 2012 at 05:12:11AM -0700, Talespin Kit wrote: > > Finally managed to compile in ubuntu-11.10. > > > > Seems the problem was the Makefile generated by the configure script for the > > **libalpm ** > > does not add the **libcrypto** as dependency in the LIBS variable. > > > > Below is the steps. > > > > I have used the git commit e6f72c61a098b52ea29e54b8eb4739a2ff81e6b0 in > > repo git://projects.archlinux.org/pacman.git > > > > 1) $ git clean -xfd; ./autogen.sh && ./configure --prefix=/usr --sysconfdir=/ > > etc --localstatedir=/var \ > > --enable-git-version --enable-debug --without-gpgme > > > > 2) cd lib/libalpm > > > > 3) In the Makefile replace line > > > > LIBS = -lssl -larchive -lm > > with > > LIBS = -lssl -larchive -lm -lcrypto > > 4) cd ../../ && make > > > > top-posted HTML... awesome... I've made some alterations to the build > system and dropped them in a branch in my repo: > > git clone git://code.falconindy.com/pacman.git buildsys > > If you could check out this branch and see if you have any more luck > with auto configuration, it'd be appreciated. I tested this on my 10.04 > LTS install with: > > ./autogen.sh > ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var > --enable-git-version --enable-debug > > curl and ssl were properly detected for the build. If it does succeed, > I'd like to see the output of: > > readelf -d ./lib/libalpm/.libs/libalpm.so > > Thanks, > dave > ----- End forwarded message ----- Forwarding to list because I didnt reply-all... d From pierre at archlinux.de Sat Mar 31 09:54:14 2012 From: pierre at archlinux.de (Pierre Schmitz) Date: Sat, 31 Mar 2012 15:54:14 +0200 Subject: [pacman-dev] [PATCH 3/4] pacman-key: reduce verbosity of --populate In-Reply-To: References: Message-ID: <1333202054-10107-1-git-send-email-pierre@archlinux.de> Do not bother the user with gpg's verbose output. Signed-off-by: Pierre Schmitz --- scripts/pacman-key.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index 46773ac..b4bad1d 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -250,7 +250,7 @@ populate_keyring() { # Add keys from requested keyrings for keyring in "${KEYRINGIDS[@]}"; do msg "$(gettext "Appending keys from %s.gpg...")" "$keyring" - "${GPG_PACMAN[@]}" --import "${KEYRING_IMPORT_DIR}/${keyring}.gpg" + "${GPG_PACMAN[@]}" --quiet --import "${KEYRING_IMPORT_DIR}/${keyring}.gpg" done # Read the trusted key IDs to an array. Because this is an ownertrust @@ -275,12 +275,12 @@ populate_keyring() { msg "$(gettext "Locally signing trusted keys in keyring...")" for key_id in "${!trusted_ids[@]}"; do msg2 "$(gettext "Locally signing key %s...")" "${key_id}" - "${GPG_PACMAN[@]}" --quiet --batch --yes --lsign-key "${key_id}" + "${GPG_PACMAN[@]}" --quiet --batch --yes --lsign-key "${key_id}" 2>/dev/null done msg "$(gettext "Importing owner trust values...")" for keyring in "${KEYRINGIDS[@]}"; do if [[ -f "${KEYRING_IMPORT_DIR}/${keyring}-trusted" ]]; then - "${GPG_PACMAN[@]}" --import-ownertrust "${KEYRING_IMPORT_DIR}/${keyring}-trusted" + "${GPG_PACMAN[@]}" --import-ownertrust "${KEYRING_IMPORT_DIR}/${keyring}-trusted" 2>/dev/null fi done fi -- 1.7.9.5 From pierre at archlinux.de Sat Mar 31 09:55:14 2012 From: pierre at archlinux.de (Pierre Schmitz) Date: Sat, 31 Mar 2012 15:55:14 +0200 Subject: [pacman-dev] [PATCH 4/4] pacman-key: Actually verify signatures and exit with correct codes In-Reply-To: <4F6F2A67.9040901@archlinux.org> References: <4F6F2A67.9040901@archlinux.org> Message-ID: <1333202114-10167-1-git-send-email-pierre@archlinux.de> We cannot rely on gpg's exit code. Instead we have to check the status-fd to figure out whether a signature is valid or not. In addition to this pacman-key --verify can now be used in scripts as it will return an exit code of 1 if the signature is invalid. Signed-off-by: Pierre Schmitz --- scripts/pacman-key.sh.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index b4bad1d..081a10a 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -436,10 +436,14 @@ refresh_keys() { } verify_sig() { - if ! "${GPG_PACMAN[@]}" --verify $SIGNATURE ; then + local fd="$(mktemp)" + "${GPG_PACMAN[@]}" --status-file "${fd}" --verify $SIGNATURE + if ! grep -q TRUST_FULLY "${fd}"; then + rm -f "${fd}" error "$(gettext "The signature identified by %s could not be verified.")" "$SIGNATURE" exit 1 fi + rm -f "${fd}" } updatedb() { -- 1.7.9.5