@@ -76,6 +76,7 @@ static gboolean sign = FALSE;
7676static gboolean no_appstream = FALSE;
7777gchar * * remaining_args = NULL ;
7878gchar * updateinformation = NULL ;
79+ static gboolean guessupdateinformation = FALSE;
7980gchar * bintray_user = NULL ;
8081gchar * bintray_repo = NULL ;
8182gchar * sqfs_comp = "gzip" ;
@@ -403,6 +404,7 @@ static GOptionEntry entries[] =
403404{
404405 { "list" , 'l' , 0 , G_OPTION_ARG_NONE , & list , "List files in SOURCE AppImage" , NULL },
405406 { "updateinformation" , 'u' , 0 , G_OPTION_ARG_STRING , & updateinformation , "Embed update information STRING; if zsyncmake is installed, generate zsync file" , NULL },
407+ { "guess" , 'g' , 0 , G_OPTION_ARG_NONE , & guessupdateinformation , "Guess update information based on Travis CI environment variables" , NULL },
406408 { "bintray-user" , 0 , 0 , G_OPTION_ARG_STRING , & bintray_user , "Bintray user name" , NULL },
407409 { "bintray-repo" , 0 , 0 , G_OPTION_ARG_STRING , & bintray_repo , "Bintray repository" , NULL },
408410 { "version" , 0 , 0 , G_OPTION_ARG_NONE , & version , "Show version number" , NULL },
@@ -720,27 +722,29 @@ main (int argc, char *argv[])
720722
721723 /* If the user has not provided update information but we know this is a Travis CI build,
722724 * then fill in update information based on TRAVIS_REPO_SLUG */
723- if (updateinformation = = NULL ){
725+ if (guessupdateinformation ! = NULL ){
724726 if (travis_repo_slug != NULL ){
725- if (github_token != NULL ){
726- gchar * zsyncmake_path = g_find_program_in_path ("zsyncmake" );
727- if (zsyncmake_path ){
728- char buf [1024 ];
729- gchar * * parts = g_strsplit (travis_repo_slug , "/" , 2 );
730- /* https://github.com/AppImage/AppImageSpec/blob/master/draft.md#github-releases
731- * gh-releases-zsync|probono|AppImages|latest|Subsurface-*-x86_64.AppImage.zsync */
732- gchar * channel = "continuous" ;
733- if (travis_tag != NULL ){
734- if ((strcmp (travis_tag , "" ) != 0 ) && (strcmp (travis_tag , "continuous" ) != 0 )) {
735- channel = "latest" ;
736- }
727+ gchar * zsyncmake_path = g_find_program_in_path ("zsyncmake" );
728+ if (zsyncmake_path ){
729+ char buf [1024 ];
730+ gchar * * parts = g_strsplit (travis_repo_slug , "/" , 2 );
731+ /* https://github.com/AppImage/AppImageSpec/blob/master/draft.md#github-releases
732+ * gh-releases-zsync|probono|AppImages|latest|Subsurface-*-x86_64.AppImage.zsync */
733+ gchar * channel = "continuous" ;
734+ if (travis_tag != NULL ){
735+ if ((strcmp (travis_tag , "" ) != 0 ) && (strcmp (travis_tag , "continuous" ) != 0 )) {
736+ channel = "latest" ;
737737 }
738- sprintf (buf , "gh-releases-zsync|%s|%s|%s|%s-_*-%s.AppImage.zsync" , parts [0 ], parts [1 ], channel , app_name_for_filename , arch );
739- updateinformation = buf ;
740- printf ("As a courtesy, automatically embedding update information based on $TRAVIS_TAG=%s and $TRAVIS_REPO_SLUG=%s\n" , travis_tag , travis_repo_slug );
741- printf ("%s\n" , updateinformation );
742- }
738+ }
739+ sprintf (buf , "gh-releases-zsync|%s|%s|%s|%s-_*-%s.AppImage.zsync" , parts [0 ], parts [1 ], channel , app_name_for_filename , arch );
740+ updateinformation = buf ;
741+ printf ("Guessing update information based on $TRAVIS_TAG=%s and $TRAVIS_REPO_SLUG=%s\n" , travis_tag , travis_repo_slug );
742+ printf ("%s\n" , updateinformation );
743+ } else {
744+ printf ("Will not guess update information since zsyncmake is missing\n" );
743745 }
746+ } else {
747+ printf ("Cannot guess update information since $TRAVIS_REPO_SLUG is missing\n" );
744748 }
745749 }
746750
0 commit comments