[build formula] Use spec folder as first schema

Change-Id: Id5ab63e1e7e63bb6dc6e5a3d89c122f67ccd73aa
diff --git a/build-debian-packages-pipeline.groovy b/build-debian-packages-pipeline.groovy
index 5d16339..864f0bc 100644
--- a/build-debian-packages-pipeline.groovy
+++ b/build-debian-packages-pipeline.groovy
@@ -64,12 +64,16 @@
           checkout changelog: true, poll: false,
             scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
             extensions: extensions,  submoduleCfg: [], userRemoteConfigs: userRemoteConfigs]
+
+          /* There are 2 schemas of build spec keeping:
+                 1. Separate directory with specs.
+                 2. Separate branch with build specs. I.e. debian/xenial
+             Logic below makes package build compatible with both schemas.
+          */
+          if (fileExists('debian/changelog')) {
+              debian_branch = null
+          }
           if (debian_branch){
-            /* There are 2 schemas of build spec keeping:
-                   1. Separate branch with build specs. I.e. debian/xenial
-                   2. Separate directory with specs.
-               Logic below makes package build compatible with both schemas.
-            */
             def retStatus = sh(script: 'git checkout ' + DEBIAN_BRANCH, returnStatus: true)
             if (retStatus != 0) {
               common.warningMsg("Cannot checkout ${DEBIAN_BRANCH} branch. Going to build package by ${SOURCE_BRANCH} branch.")