3

Trying to build my extensions more automatically and without magentos GUI. I've wrote a little script, based on a blog post by Sven Varkel, it pulls a vanilla magento source base and my extension, puts everything together but the resulting .tgz file only contains the package.xml.

At first I got this error:

Notice: Trying to get property of non-object in /home/rof/build/downloader/lib/Mage/Connect/Validator.php on line 472

Call Stack:
0.0004     309704   1. {main}() /home/rof/build/downloader/mage.php:0
0.0006     319296   2. __cli_Mage_Connect->run() /home/rof/build/downloader/mage.php:155
0.0048     864624   3. __cli_Mage_Connect->runCommand() /home/rof/build/downloader/mage.php:147
0.0052     926576   4. Mage_Connect_Command->run() /home/rof/build/downloader/mage.php:119
0.0052     926912   5. Mage_Connect_Command_Package->doPackage() /home/rof/build/downloader/lib/Mage/Connect/Command.php:160
0.0090    1322104   6. Mage_Connect_Package->save() /home/rof/build/downloader/lib/Mage/Connect/Command/Package.php:71
0.0090    1322104   7. Mage_Connect_Package->validate() /home/rof/build/downloader/lib/Mage/Connect/Package.php:220
0.0092    1336000   8. call_user_func_array:{/home/rof/build/downloader/lib/Mage/Connect/Package.php:1234}() /home/rof/build/downloader/lib/Mage/Connect/Package.php:1234
0.0092    1336424   9. Mage_Connect_Validator->validateContents() /home/rof/build/downloader/lib/Mage/Connect/Package.php:1234

Done building package

I've look into that file and it reads like it's trying to access an object called config so I replaced that line with an hardcoded path. That's how i fixed the notice. But still nothing shows up in my .tgz file and when i execute ./mage package ... it says my files already exists. If i delete them it works but still nothing else than package.xml in my .tgz file.

Questions:.. Does nobody have an existing solution ? Can't imagine i'm the only one facing the problem of deploying updates to multiple extensions rapidly i guess.. Secondly why my script isn't working cause i can't tell.

7
  • and what is the question? Commented Aug 3, 2015 at 21:35
  • Kinda two things.. Does nobody have an existing solution ? Can't imagine i'm the only one facing the problem of deploying updates to multiple extensions rapidly i guess.. Secondly why my script isn't working cause i can't tell. Commented Aug 3, 2015 at 21:38
  • Please edit your question and add those things. Hopefully someone knows something about this. Commented Aug 4, 2015 at 4:37
  • Gui is Best for packaging a extensions. As you can load the extensions if you are having update in your extension. Commented Aug 4, 2015 at 4:45
  • @BhupendraJadeja it's not bad if you have one extension but in my case we have 5 extensions right now and 3 developer so it takes alot of time using the gui... Commented Aug 4, 2015 at 6:05

2 Answers 2

6
  1. Go to System->Magento Connect->Package Extensions
  2. Link your Package`s File once
  3. Please put your package Release Stability to development until final version
  4. Then Save data and create package.
  5. After if any changes are in your module then load it from local packages.
  6. Save data and Crate package again it will crate package with all your changes not need to map all file again and again

enter image description here

5
  • Can't have two Extensions package.xml in var/connect at the same time, so that wouldn't work for me.. only if I setup one dev magento per extension. Because until now my extensions are internally modman managed. But thanks anyway for your help Commented Aug 4, 2015 at 7:12
  • But i have two extensions in load local package and it is working fine. Both having the package.xml in .tgz folder. Yes, there is only one package xml in var/connect Commented Aug 4, 2015 at 7:16
  • You can delete the package.xml in var/connect because .tgz file having the its own package.xml for specific module Commented Aug 4, 2015 at 7:24
  • ok thanks, not solving my problem that I would like to use an ci but seems to be a workaround I can use until i found out how to use an ci solution. Commented Aug 4, 2015 at 7:27
  • ok for CI i dont having that much knowledge . Please do share once you got any solution Commented Aug 4, 2015 at 7:28
2

CI Solution

Only tested against Codeship.io right now

I've rewrote most of my build script now and using Alan Storm's awesome MagentoTarToConnect. It expects multiple Environment Variables:

  • FTP_USER
  • FTP_PASSWORD
  • FTP_HOST
  • NAME
  • GIT_URL
  • CI_BRANCH (in case of codeship.io provided by the system)

build.sh:

# Install modman
SRC="https://raw.githubusercontent.com/colinmollenhour/modman/master/modman"
DEST="mm"
# test if curl/wget is installed
if hash curl 2>&- ; then
CMD="curl -s -L $SRC -o $DEST"
elif hash wget 2>&- ; then
CMD="wget -q --no-check-certificate -O $DEST $SRC"
else
echo "You need to have curl or wget installed."
exit 1
fi
$CMD
chmod +x $DEST

# Download MagentoTarToConnect.phar to build.phar

wget -O build.phar https://github.com/astorm/MagentoTarToConnect/blob/master/magento-tar-to-connect.phar?raw=true
chmod +x build.phar

#Build package
mkdir build
./mm init build
./mm clone --copy ${GIT_URL} --branch ${CI_BRANCH}
rm -r build/var
tar -cf build.tar -C build .

./build.phar build.config.php

R_VERSION=`echo $CI_BRANCH| cut -d'_' -f 2`

# Comment the following line out if you don't want to use ftp to copy the result on a remote ftp server
lftp -c "open -u $FTP_USER,$FTP_PASSWORD $FTP_HOST; set ssl:verify-certificate no; mirror -R ${PWD}/build_artifact /${NAME}/${R_VERSION}"

Haven't cleaned it up sorry for that guys, if someone is willing to do so please help yourself :)

build.config.php:

This config file is required by MagentoTarToConnect and contains extension specific informations. I have marked attributes you should change according to your extension with an "YOUR_" value. Of course you can change any other value as well but to work with my build script base_dir,archive_files,path_output needn't be changed.

<?php
return array(
'base_dir'               => $_ENV["PWD"],
'archive_files'          => 'build.tar',
'extension_name'         => 'YOUR_EXTENSIONNAME',
'extension_version'      => 'YOUR_VERSION',
'skip_version_compare'   => false,
'auto_detect_version'    => false,
'path_output'            => $_ENV["PWD"] .'/build_artifact',
'stability'              => 'YOUR_STABILITY',
'license'                => 'YOUR_LICENSE',
'channel'                => 'community',
'summary'                => 'YOUR_SUMMARY',
'description'            => 'YOUR_DESCRIPTION',
'notes'                  => 'YOUR_RELEASE NOTES',
'author_name'            => 'YOUR_NAME',
'author_user'            => 'YOUR_USER',
'author_email'           => 'YOUR_EMAIL',
'php_min'                => '5.2.0',
'php_max'                => '5.6.0',
'extensions'             => array()
);
1
  • If it help you then you can marked as correct answer Commented Aug 4, 2015 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.