Page 1 of 1

Silent build-upload automation?

Published: Dec 17, 2018 - 4:18 PM
by olaplanche
- Installed WAPT version: 1.6.2.7
- Server OS: Debian Stretch
- Administration/package creation machine OS: Windows 10

Hello,

I would like to know if it's possible to silently script the creation and upload of a package?
My idea is to completely automate package updates if possible...

When I use the following command: wapt-get.exe build-upload mypackagepath, it prompts me for my private key password. I suspect this behavior is intended, but is there another way to do it?

Thank you

Re: Silent build-upload automation?

Published: Dec 17, 2018 - 10:27 PM
by sfonteneau
Example code that edits a package, performs the package update, and then rebuilds the package to maturity VALIDITY-WAIT

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
from waptpackage import *
from common import *

devrep = makepath('c:','waptdev')
packagename='smp-firefox-esr'
repcomplet=makepath(devrep,packagename)
myWapt = Wapt(config_filename=makepath(r'C:\Users\Administrateur\AppData\Local\waptconsole\waptconsole.ini'))
if isdir(repcomplet):
    remove_tree(repcomplet)
myWapt.edit_package(packagename,target_directory=repcomplet)
thepackage = PackageEntry(waptfile=repcomplet)
thepackage.call_setup_hook('update_package',wapt_context=myWapt)
myWapt.build_upload(repcomplet,private_key_passwd=ur'passwordkey',wapt_server_user='admin',wapt_server_passwd=ur'passwordserver',set_maturity='VALIDITY-WAIT')

Re: Silent build-upload automation?

Published: Dec 18, 2018 - 11:48
by olaplanche
I'd like to comment on the code to make sure I've understood it correctly:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
from waptpackage import *
from common import *

# Défini la variable devrep avec le chemin "c:\waptdev"
devrep = makepath('c:','waptdev')
# Défini la variable packagname avec le nom du paquet "smp-firefox-esr"
packagename='smp-firefox-esr'
# Défini la variable repcomplet avec la concaténation des variables devrep et packagename
repcomplet=makepath(devrep,packagename)
# Défini la variable myWapt avec le chemin du fichier de conf local de ma console
myWapt = Wapt(config_filename=makepath(r'C:\Users\Administrateur\AppData\Local\waptconsole\waptconsole.ini'))
# Supprimer le dossier local du package si il existe
if isdir(repcomplet):
    remove_tree(repcomplet)
# Télécharger et extraire le package depuis le repository wapt dans le dossier "repcomlet"
myWapt.edit_package(packagename,target_directory=repcomplet)
# Défini la variable thepackage avec les infos récupérées depuis le dossier local du package
thepackage = PackageEntry(waptfile=repcomplet)
# Appel de la fonction update_package du paquet en question
thepackage.call_setup_hook('update_package',wapt_context=myWapt)
# build et upload du paquet mis à jour sur le repository wapt
myWapt.build_upload(repcomplet,private_key_passwd=ur'passwordkey',wapt_server_user='admin',wapt_server_passwd=ur'passwordserver',set_maturity='VALIDITY-WAIT')
If I'm not mistaken, you then need to add the update_package function to the desired package and then save the above customized Python script for the desired package and run it in a scheduled task, for example?!

THANKS

Re: Silent build-upload automation?

Published: Dec 18, 2018 - 1:38 PM
by sfonteneau
That's it

Re: Silent build-upload automation?

Published: Dec 19, 2018 - 2:54 PM
by olaplanche
Good morning,

I get the following error when running my Python script:

Code: Select all

wapt-wAdministratif_8.4-64_all.wapt[================================] 26555304/26555304 - 00:00:00
No handlers could be found for logger "root"
Traceback (most recent call last):
  File "e:\update_package_wapt-wAdministratif.py", line 23, in <module>
    myWapt.edit_package(packagename,target_directory=repcomplet)
  File "C:\wapt\common.py", line 6228, in edit_package
    raise Exception(u'Unable to unzip package in %s' % target_directory)
Exception: Unable to unzip package in c:\waptdev\wapt-wAdministratif
I'm running it as administrator, but it seems it can't decompress the package...

Any ideas?

Edit: Actually, it's not downloading the package at all, and I can't access it through the console either when I click on "edit package"...

THANKS

Re: Silent build-upload automation?

Published: Dec 22, 2018 - 11:34
by sfonteneau
Does waptdev exist?

Re: Silent build-upload automation?

Published: January 8, 2019 - 9:17 AM
by olaplanche
Hello,

Yes, the c:\waptdev folder does exist.

PS: I wish the whole team a very happy 2019 and thank you again for this fabulous tool!

Re: Silent build-upload automation?

Published: January 15, 2019 - 2:42 PM
by olaplanche
I've just revisited this problem and I can't reproduce the error mentioned earlier...
Instead, I'm seeing a new, strange behavior:

In my waptdev folder, my package folder is named "wapt-wAdministratif-wapt", and the package name in its control file and in the console is "wapt-wAdministratif". When I run the Python script above, the wapt-wAdministratif folder is created in my waptdev folder...
okay, that makes sense, I understand that much. Currently, the script crashes on the package's update function.
The strangest thing is that when I edit my package c:\waptdev\wapt-wAdministratif-wapt (to edit the update function, for example) and then run a build-upload, my package is successfully generated and uploaded to the server. I deleted the old one from the console and ran the Python script above again. It downloaded the wapt-wAdministratif package to the c:\waptdev\wapt-wAdministratif folder, but the contents don't match the latest version of the package I edited, generated, and uploaded previously. It seems I only have one version of the package on the server, so I don't understand how this is possible.

I'll keep looking, but if anyone has any ideas, please let me know!

Thanks