CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Applied some patches to pkgadd's stuff in order to avoid .la files on installations
authorJose V Beneyto <sepen@crux.nu>
Mon, 21 Jun 2010 09:44:04 +0000 (11:44 +0200)
committerJose V Beneyto <sepen@crux.nu>
Mon, 21 Jun 2010 09:44:04 +0000 (11:44 +0200)
pkgadd-cross
src/pkgadd.cc
src/pkgadd.conf
src/pkgadd.h

index d780311818e27a9481724d7d495bd6c4f70a7dd9..8d68c81648a2cf644936046333224b0eaaec038a 100755 (executable)
@@ -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
index 4bc16520aea2b166627f549318af5ef66939909b..335ffddecba4f16161992a50390be2de3fce1d64 100644 (file)
@@ -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<string, pkginfo_t> package = pkg_open(o_package);
-               vector<rule_t> config_rules = read_config();
+               vector<rule_t> 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] <file>" << endl
             << "options:" << endl
-            << "  -u, --upgrade       upgrade package with the same name" << endl
-            << "  -f, --force         force install, overwrite conflicting files" << endl
-            << "  -r, --root <path>   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 <path>    specify alternative installation root" << endl
+            << "  -c, --config <file>  use alternate configuration file" << endl 
+            << "  -v, --version        print version and exit" << endl
+            << "  -h, --help           print help and exit" << endl;
 }
 
-vector<rule_t> pkgadd::read_config() const
+vector<rule_t> pkgadd::read_config(string file) const
 {
        vector<rule_t> 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) {
index 6af9cb809439ba838be9b68960d245e54ffd7390..234f961b17c5f745fa887b72baf26d02df5f5bf2 100644 (file)
@@ -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
 
index e121dc1d8d4c1c5ac7050b418428683a2f107ddc..e20561bbd80f30080f471e1ff4650db858053b04 100644 (file)
@@ -48,7 +48,7 @@ public:
        virtual void print_help() const;
 
 private:
-       vector<rule_t> read_config() const;
+       vector<rule_t> read_config(string file) const;
        set<string> make_keep_list(const set<string>& files, const vector<rule_t>& rules) const;
        set<string> apply_install_rules(const string& name, pkginfo_t& info, const vector<rule_t>& rules);
        void find_rules(const vector<rule_t>& rules, rule_event_t event, vector<rule_t>& found) const;