From 8b010ae56207338aca1933e89ac7c28c877a2f47 Mon Sep 17 00:00:00 2001 From: Jose V Beneyto Date: Mon, 21 Jun 2010 11:44:04 +0200 Subject: [PATCH] Applied some patches to pkgadd's stuff in order to avoid .la files on installations --- pkgadd-cross | 7 ++----- src/pkgadd.cc | 24 ++++++++++++++++-------- src/pkgadd.conf | 5 +++++ src/pkgadd.h | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/pkgadd-cross b/pkgadd-cross index d780311..8d68c81 100755 --- a/pkgadd-cross +++ b/pkgadd-cross @@ -3,6 +3,7 @@ TOPDIR="$(cd $(dirname $(which $0)); pwd)" PKGADD=$TOPDIR/src/pkgadd +PKGADD_CONF=$TOPDIR/src/pkgadd.conf PKGMK_CONF=$TOPDIR/src/pkgmk.conf . $PKGMK_CONF @@ -17,10 +18,6 @@ if [ ! -f $CLFS/var/lib/pkg/db ]; then touch $CLFS/var/lib/pkg/db fi -$PKGADD -r $CLFS $@ - -# we shoudl avoid .la files when crosscompiling, these files -# contains the libdir variable hardcoded which is used by libtool -[ $? -eq 0 ] && find $CLFS -type f -name '*.la' -delete +$PKGADD -c $PKGADD_CONF -r $CLFS $@ # End of file diff --git a/src/pkgadd.cc b/src/pkgadd.cc index 4bc1652..335ffdd 100644 --- a/src/pkgadd.cc +++ b/src/pkgadd.cc @@ -33,6 +33,7 @@ void pkgadd::run(int argc, char** argv) // Check command line options // string o_root; + string o_config; string o_package; bool o_upgrade = false; bool o_force = false; @@ -43,6 +44,10 @@ void pkgadd::run(int argc, char** argv) assert_argument(argv, argc, i); o_root = argv[i + 1]; i++; + } else if (option == "-c" || option == "--config") { + assert_argument(argv, argc, i); + o_config = argv[i + 1]; + i++; } else if (option == "-u" || option == "--upgrade") { o_upgrade = true; } else if (option == "-f" || option == "--force") { @@ -71,7 +76,7 @@ void pkgadd::run(int argc, char** argv) db_open(o_root); pair package = pkg_open(o_package); - vector config_rules = read_config(); + vector config_rules = read_config(o_config); bool installed = db_find_pkg(package.first); if (installed && !o_upgrade) @@ -112,18 +117,21 @@ void pkgadd::print_help() const { cout << "usage: " << utilname << " [options] " << endl << "options:" << endl - << " -u, --upgrade upgrade package with the same name" << endl - << " -f, --force force install, overwrite conflicting files" << endl - << " -r, --root specify alternative installation root" << endl - << " -v, --version print version and exit" << endl - << " -h, --help print help and exit" << endl; + << " -u, --upgrade upgrade package with the same name" << endl + << " -f, --force force install, overwrite conflicting files" << endl + << " -r, --root specify alternative installation root" << endl + << " -c, --config use alternate configuration file" << endl + << " -v, --version print version and exit" << endl + << " -h, --help print help and exit" << endl; } -vector pkgadd::read_config() const +vector pkgadd::read_config(string file) const { vector rules; unsigned int linecount = 0; - const string filename = root + PKGADD_CONF; + string filename = root + PKGADD_CONF; + + if (!file.empty()) filename = file; ifstream in(filename.c_str()); if (in) { diff --git a/src/pkgadd.conf b/src/pkgadd.conf index 6af9cb8..234f961 100644 --- a/src/pkgadd.conf +++ b/src/pkgadd.conf @@ -2,6 +2,11 @@ # /etc/pkgadd.conf: pkgadd(8) configuration # +# Crosscompiling rules to avoid libtool issues +# with the hardcoded libdir variable +INSTALL .*\.la NO +UPGRADE .*\.la NO + # Default rule (implicit) #UPGRADE ^.*$ YES diff --git a/src/pkgadd.h b/src/pkgadd.h index e121dc1..e20561b 100644 --- a/src/pkgadd.h +++ b/src/pkgadd.h @@ -48,7 +48,7 @@ public: virtual void print_help() const; private: - vector read_config() const; + vector read_config(string file) const; set make_keep_list(const set& files, const vector& rules) const; set apply_install_rules(const string& name, pkginfo_t& info, const vector& rules); void find_rules(const vector& rules, rule_event_t event, vector& found) const; -- 2.26.2