Skip to content

Instantly share code, notes, and snippets.

@dnaeon
dnaeon / gist:1102775
Created July 24, 2011 16:10
pkg multi repo install
# pkg install security/apg security/apg
pkg: /!\ Working on multiple repositories /!\
pkg: /!\ This is an unsupported preview feature /!\
pkg: /!\ It can kill kittens and puppies /!\
The following packages will be installed:
apg-2.3.0b_2 [ found in repos: test dnaeon-test dnaeon ]
Fetching package from repository 'test' [http://false-address1.sofia.unix-heaven.org:8000/]
@dnaeon
dnaeon / gist:1113998
Created July 29, 2011 15:04
pkg install test
tsunami# setenv PACKAGESITE http://tsunami:8000/
tsunami# pkg install security/apg
The following packages will be installed:
apg-2.3.0b_2
Installing apg-2.3.0b_2... done
tsunami# pkg info -a | grep apg
apg-2.3.0b_2: An automated password generator
int
pkgdb_rquery_build_search_query(struct sbuf *sql, match_t match, unsigned int field)
{
switch (match) {
case MATCH_ALL:
case MATCH_EXACT:
sbuf_cat(sql, "name LIKE ?1 ");
if (field & REPO_SEARCH_COMMENT)
sbuf_cat(sql, "OR comment LIKE ?1 ");
else if (field & REPO_SEARCH_DESCRIPTION)
@dnaeon
dnaeon / gist:1116796
Created July 31, 2011 13:28
test sql
SELECT rowid, origin, name, version, comment, desc, arch, arch, osversion, maintainer, www, flatsize, pkgsize, cksum, path, dbname FROM ( SELECT rowid, origin, name, version, comment, desc, arch, arch, osversion, maintainer, www, flatsize, pkgsize, cksum, path, 'dnaeon-test' AS dbname FROM 'dnaeon-test'.packages WHERE name LIKE ?1 UNION SELECT rowid, origin, name, version, comment, desc, arch, arch, osversion, maintainer, www, flatsize, pkgsize, cksum, path, 'dnaeon' AS dbname FROM 'dnaeon'.packages WHERE name LIKE ?1 );
@dnaeon
dnaeon / gist:1118638
Created August 1, 2011 17:56
pkgdb_open - leak
The following packages will be installed:
apg-2.3.0b_2
Installing apg-2.3.0b_2... done
==14049==
==14049== HEAP SUMMARY:
==14049== in use at exit: 180,527 bytes in 124 blocks
==14049== total heap usage: 2,523 allocs, 2,399 frees, 9,561,760 bytes allocated
==14049==
==14049== Searching for pointers to 124 not-freed blocks
==14049== Checked 769,136 bytes
# jls name
1
2
3
4
5
6
7
8
10
@dnaeon
dnaeon / gist:1139944
Created August 11, 2011 15:31
pkgng - progress meter
jail-test# pkg update
http://tsunami:8000/repo.txz 100% 44KB 43.9KB/s 43.9KB/s 00:00
jail-test# pkg install -x apache
The following packages will be installed:
perl-threaded-5.10.1_3
pcre-8.12
gdbm-1.8.3_3
db42-4.2.52_5
apr-ipv6-devrandom-gdbm-db42-1.4.2.1.3.10
@dnaeon
dnaeon / gist:1140379
Created August 11, 2011 18:34
pkgng - empty jobs
tsunami# pkg info -x apg
apg-2.3.0b_2: An automated password generator
tsunami# pkg install -x apg
The following packages will be installed:
apg-2.3.0b_2
Proceed with installing packages [y/N]: y
@dnaeon
dnaeon / gist:1140389
Created August 11, 2011 18:37
pkgdb.c - patch
# git diff
diff --git a/libpkg/pkgdb.c b/libpkg/pkgdb.c
index 93484e1..84df484 100644
--- a/libpkg/pkgdb.c
+++ b/libpkg/pkgdb.c
@@ -703,7 +703,9 @@ pkgdb_query_remote(struct pkgdb *db, const char *pattern)
"arch, osversion, maintainer, www, pkgsize, "
"flatsize AS newflatsize, cksum, path AS repopath "
"FROM remote.packages "
- "WHERE origin = ?1";
@dnaeon
dnaeon / gist:1160798
Created August 21, 2011 16:11
print_info() - common interface for printing information from 'search' and 'info'
diff --git a/pkg/info.c b/pkg/info.c
index 6206f80..e554788 100644
--- a/pkg/info.c
+++ b/pkg/info.c
@@ -2,7 +2,6 @@
#include <err.h>
#include <inttypes.h>
-#include <libutil.h>
#include <pkg.h>